Description
Related:
Roadmap and discussion for supporting for wide-gamut color spaces in three.js. Many displays now support Display P3 (+50% larger gamut volume than sRGB), and web browsers are beginning to extend that support to WebGL contexts. Other color wide-gamut color spaces exist (Rec. 2020, ACEScg) and may be relevant to our internal rendering pipeline, but probably will not be widely available as display color spaces in WebGL for a very long time.
Broadly the goals here are (1) to identify useful and correct workflows for users, and (2) to make any necessary changes in the three.js rendering pipeline. I suspect that (1) may be the harder part of the problem.
Decisions
- Working color space: In addition to "Linear sRGB", which working color space(s) should be supported?
- Options include Linear P3, Linear Rec. 2020, and ACEScg. We may want to consider providing a mechanism to register new color spaces with three.js, rather than including conversions to/from each combination of color spaces out of the box. Each will also have different luminance calculations, different tone mapping, ...
- Tone mapping: What tone mapping should be used for wide-gamut displays?
- Unlit vs Lit: Support for unlit workflows (e.g. a photo editing app) will be easier than lit workflows, which require changes to tone mapping and perhaps PBR equations. Should we consider shipping unlit support first?
Workflows
I'm skeptical than wide-gamut features can be enabled automatically; it will require significant care from users to get the benefits of these displays, and should be opt-in. I'm not sure which 3D modeling tools support the P3 gamut at all. Files in standard formats like glTF are almost exclusively using sRGB today. Users will need to load textures manually and assign texture.colorSpace
correctly. We cannot infer texture color space safely without user input of some kind.
Tasks
Task numbers begin at 2.1, following up from #23614.
- (2.1) Support changing
ColorManagement.workingColorSpace
- Allow one or both of "acescg" or "p3-linear", in addition to current "srgb-linear"
- (2.2) Support THREE.Color getters/setters in new working color space(s)
- (2.3) Support
renderer.outputColorSpace = THREE.DisplayP3ColorSpace
- (2.4) Model loaders must delegate management to THREE.ColorManagement, not convert to Linear-sRGB explicitly
- (2.5) Texture loaders should identify and tag wide-gamut textures where possible (OpenEXR, KTX2, ...?)
- (2.6) Use
gl.unpackColorSpace
to unpack "display-p3" PNG, JPEG, and WebP images into the working color space - (2.7) Provide tone-mapping implementations from wide-gamut working color space(s) to "srgb" and "display-p3" output color spaces
Activity