-
-
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
ColorManagement: Add .getLuminanceCoefficients #28880
ColorManagement: Add .getLuminanceCoefficients #28880
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Can we please use |
I would say yes so ideally components like When thinking about it, we can have a solution without a uniform at all if you update |
Ok, works for me. 👍🏻
Will look into this – thanks! Moving this PR to 'draft' as I address feedback. |
I believe all feedback has been addressed, moving the luminance function to |
mrdoob/three.js#28880 doesn't apply to RawShaderMaterial
Follow-up to #28861. Adds a method to ColorManagement, to produce luminance coefficients for a given color space. Currently supports sRGB, Linear sRGB, Display P3, and Linear Display P3. For sRGB and Linear sRGB I used the (more common?) 4-decimal precision,
0.2126, 0.7152, 0.0722
, simply or consistency with OCIO, Blender, and ASC specifications. I expect the difference will be ~zero, but if we see E2E failures as a result, I can switch back.I believe it's fair to call these either "luma coefficients" or "luminance coefficients", I don't have a preference other than internal consistency.Certain post-processing effects were using luminance coefficients from Rec. 601, which we do not otherwise support. I've corrected those coefficients.
One notable exception on ColorManagement's use,Fixed. ✅common.glsl.js
contains hard-coded luminance coefficients. Ideally they'd be based on the working color space, but I'm unsure if it's a good idea to put a new global uniform into this shader chunk. Suggestions welcome. In terms of working toward support for wide-gamut PBR rendering, it might be more practical to focus on WebGPURenderer for now.Finally, note that while the luminance coefficients are the same for Linear sRGB vs. sRGB, and for Linear Display P3 vs. Display P3, the dot product gives different results with different meanings given linear vs. non-linear components.
/cc @Mugen87 @WestLangley