Skip to content

Conversation

@donmccurdy
Copy link
Collaborator

@donmccurdy donmccurdy commented Feb 17, 2023

Related issue:

Description

Adds THREE.DisplayP3ColorSpace constant, and related CPU-side transforms in THREE.ColorManagement. No rendering code is affected — the only direct effect is that color.getStyle( 'display-p3' ) will now apply a conversion.

No gamut mapping is applied. Given a Display P3 input that is out-of-gamut for sRGB, conversion to sRGB will yield RGB values outside the range [0, 1]. That is the only lossless choice, which I think is important here, and users can use Color.js or other libraries to select an appropriate gamut mapping method if necessary.

/cc @WestLangley

@donmccurdy
Copy link
Collaborator Author

Added unit tests. I'm using http://www.russellcottrell.com/photo/matrixCalculator.htm to compute the conversion matrices, and https://colorjs.io/ to generate and compare expected values for tests. Color.js is written by co-authors of the CSS Color 4 specification.

@mrdoob mrdoob added this to the r150 milestone Feb 17, 2023
@mrdoob mrdoob merged commit 791f845 into mrdoob:dev Feb 17, 2023
@donmccurdy donmccurdy deleted the feat/displayp3 branch February 17, 2023 12:14
0b5vr added a commit to 0b5vr/three-ts-types that referenced this pull request Mar 13, 2023
and `ColorManagement.convert` now supports the `DisplayP3ColorSpace`

This commit addresses a part of three-types#357

See: mrdoob/three.js#25520
Methuselah96 pushed a commit to three-types/three-ts-types that referenced this pull request Mar 24, 2023
and `ColorManagement.convert` now supports the `DisplayP3ColorSpace`

This commit addresses a part of #357

See: mrdoob/three.js#25520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants