-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples: Linearize sRGB material color in Matcap example #20279
Conversation
@donmccurdy This is something we have not been careful about. There are a lot of examples that need to be changed if we want to handle this consistently... |
I'm not sure we want to go down this path since the respective code is confusing for most users. Since the color picking is in some sense a subjective choice, I'm not sure color spaces do matter much in these cases. |
Most users are not coding.
Color spaces do not matter much? We have to handle color space correctly -- and consistently. Otherwise, for example, |
Most user do code ( The engine should try to hide this complexity as good as possible. It's the same motivation like integrating PMREM. Delegating these tasks to the user is just a proof that the engine is not capable of handling it internally. |
@Mugen87 said
With all due respect, we should not have to be debating whether color space is important at this point. //
How is the engine going to know if the color was selected by a color-picker? It is the developer's responsibility to linearize it. |
Color spaces are important but the engine should try to not confront the user with it whenever possible. The proposed solution (asking users to work with I just wanted to highlight with my statement that users often "visually" pick a color. The user does not care in what color space it is. The engine should somehow find a way so that the selected color is actually rendered at screen without asking for further configurations from the user. If necessary, with a custom color-picker. |
Or maybe something like |
The user of the app is not the same as the developer of the app.
The developer must care. glTF, for example, has a spec, and adheres to the same conventions that three.js does. The developer must understand that spec. Just as developers must set |
When you load a |
You are confusing user with developer.
You are blocking my PR based on some ideal in your head which has neither a spec nor a solution. Please avoid doing that. Do not let the perfect be the enemy of the good. |
Sorry but project members sometimes have different opinions on certain topics. Please try to accept this instead of becoming defensive. |
Sorry, that is a deflection tactic. Please stay on-topic. // I would like the demo I am maintaining to work correctly. This 2-line PR makes it work correctly. This PR also demonstrates to @donmccurdy an issue I am concerned about so we can address it in the future. |
See #20287 (comment) for my thoughts, but I'm afraid I don't really like either of the If the user has done [TBD], these color conversions should happen automatically. I'm just not sure what the "TBD" should be yet, or how to implement it. Perhaps something like: import { Color } from 'three';
const color = new Color();
color.setHex( 0xCCCCCC ); // no conversion
Color.setLinearWorkflow( true );
color.setHex( 0xCCCCCC ); // automatic sRGB -> linear Eventually, |
I'm fine with that goal. For me, it's important to not spread the code base with color conversion related logic (and thus not confront users with it). Providing a proper default and enable color space configuration at a single place sounds like a good solution. |
Exactly. No one does. In the mean time, I would like the demo I am maintaining to be correct. With #20287 I could do color.setSRGB( value ); |
I'm fine with this PR. @Mugen87 I do see your concern about complexity, but I agree with @WestLangley that the current usage is badly incorrect. Until we have an agreed-upon API, we should try to show correct usage, whether it's ugly or not... |
Okay, for this demo I'm fine with the usage of |
Since we are in agreement, merging for now. I will not correct other examples until alternative APIs have been discussed. At least everyone is aware of the issue now. :-) |
What do you guys think about adding |
I am not sure it is a good idea to assign a particular colorspace to THREE.Color... |
I share @WestLangley's concern ... and requiring users to replace Continuing from #20287:
I'm okay with @WestLangley's suggestion here, too, that |
I was thinking we could add an additional parameter to the relevant methods to specify the color space/encoding, but I think |
Color pickers return CSS colors in sRGB colorspace, while
material.color
is a scene-referred linear value.