-
Notifications
You must be signed in to change notification settings - Fork 138
Specify colors as sRGB-Rec709-D65 for color management #148
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
Conversation
|
It would also be an option to do this: const col = new Color(color.x, color.y, color.z).convertSRGBToLinear();On a strictly technical level that's better. This way it fixes both paths, with or without THREE.ColorManagement. three.js users should be setting But that will be a breaking change for any of your current users, so the code given in the PR is safer as an upgrade. Up to you! |
|
Hey @donmccurdy, I tested this for web-ifc-three. I have added the screenshot, the colors are more whitish with sRGBEncoding. |
|
Hi @aka-blackboots — you'll have to tell me what I'm looking at here, sorry, or how I can reproduce it. :) I only have the single example found in the three.js codebase. If input colors are specified in the correct color space, then |
|
@donmccurdy if only the line in screenshot was added, @aka-blackboots never called convertSRGBToLinear() on the colors |
|
This fix is contingent on THREE.ColorManagement being enabled — without it the change does nothing and Maybe I'm overcomplicating this in the name of backward-compatibility though. Other three.js loaders like GLTFLoader and FBXLoader simply call
|
|
Sorry for the delay, I'll check this out tomorrow! |


Hi! The three.js project is working toward improved color management workflows, which are necessary for better lighting, PBR shading, and upcoming WebGL / WebGPU features like wide-gamut color spaces. As part of that, we've added a color management guide. One thing to note there is a new THREE.ColorManagement API:
It's called
legacyMode = falsein the current release but should be renamed as shown above soon:Under this mode, RGB components are assumed to be in Linear-sRGB colorspace by default, and that conflicts with current usage here. I don't know what color management information exists for IFC models, whether configurable or not. But (without this PR) the new mode changes display of colors in IFC models, which you probably don't want!
Based on the current example in the repository, I'm assuming that material colors for IFC models are given in sRGB color space (sRBG transfer function, Rec 709 primaries, D65 white point). This PR specifies colorspace when configuring the material, so that: