workingToColorSpace
Explicitly converts a color from the renderer's linear working color space (usually Linear-sRGB) to another specified target color space (e.g., sRGB) within the shader node graph.
Core Advantages
It encapsulates complex color space transformation math (e.g., gamma correction, matrix transforms) into a single function, letting developers declare intent without manual formulas, which makes the node graph cleaner and less error-prone.
Common Uses
Implementing post-effects like film grain or color grading in a perceptual space like sRGB
Baking textures for other tools, ensuring the color data matches the target format
During debugging, converting any intermediate linear color to sRGB for a proper on-screen preview
How to adjust
Adjust by changing the `targetColorSpace` string parameter (e.g., 'srgb', 'display-p3') on node creation. This parameter dictates the specific mathematical transform applied, altering the output color's value and visual appearance.
Code Examples
1// Assuming linearColorNode is a color node in the linear working space
2// Manually convert it to the sRGB color space
3const srgbColorNode = workingToColorSpace( linearColorNode, 'srgb' );