srgbToLinear.glsl 407 B

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