convertColorSpace
Accurately transforms colors between different color spaces (e.g., sRGB and Linear) to ensure physically correct lighting and blending calculations.
Core Advantages
Abstracts complex gamma correction math (e.g., `pow(x, 2.2)`) into a single node. It is a cornerstone of Physically Based Rendering (PBR) and prevents common visual errors like blown-out highlights and unnatural color blends caused by incorrect color space handling.
Common Uses
Decoding input sRGB color textures (like albedo maps) into Linear space before lighting calculations.
Encoding the final linear render output back to sRGB space for correct display in custom post-processing.
Ensuring all colors are in the same space (usually Linear) before they are blended together.
How to adjust
The effect of this node is about visual correctness, not parameter tuning. Without conversion, lighting appears harsh and unnatural (blown-out highlights, crushed blacks). With correct conversion, light falloff and color transitions are smooth and gentle, preserving detail in both bright and dark areas for a more realistic render.
Code Examples
1// Decode an sRGB texture color into Linear space for subsequent lighting calculations
2const linearColor = convertColorSpace( srgbTextureColor, 'srgb', 'linear' );