Color management in three.js

Definitions

  • Linear-sRGB / THREE.LinearEncoding: Linear transfer functions, Rec. 709 primaries, D65 white point.
  • sRGB / THREE.sRGBEncoding: sRGB transfer functions, Rec. 709 primaries, D65 white point.

Best practices

  1. Textures with color data (.map.emissiveMap, …) should be configured with .encoding = sRGBEncoding. Non-color textures use LinearEncoding. Exceptions exist for some formats (like OpenEXR), which typically use LinearEncoding for color data.
  2. Vertex colors should be stored in Linear-sRGB.
  3. Materials and lights require RGB components in Linear-sRGB. Hexadecimal and CSS colors are generally sRGB, and must be converted.1
  4. Renderer should have .outputEncoding = sRGBEncoding when not using post-processing. With three.js default post-processing, use LinearEncoding and apply a GammaCorrectionShader

Leave a comment

Your email address will not be published. Required fields are marked *