linearToSrgb.glsl 431 B

12345678910111213141516
  1. /**
  2. * Converts a linear RGB color to an sRGB color.
  3. *
  4. * @param {vec3|vec4} linearIn The color in linear color space.
  5. * @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.
  6. */
  7. vec3 czm_linearToSrgb(vec3 linearIn)
  8. {
  9. return pow(linearIn, vec3(1.0/2.2));
  10. }
  11. vec4 czm_linearToSrgb(vec4 linearIn)
  12. {
  13. vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));
  14. return vec4(srgbOut, linearIn.a);
  15. }