getCIEXYZ.frag 411 B

123456789101112131415
  1. // Using numerical value from here
  2. // http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering
  3. vec3 getCIEYxy(vec3 rgbColor)
  4. {
  5. mat3 RGB2XYZ = transpose(mat3(
  6. vec3(.4125, .2126, .0193),
  7. vec3(.3576, .7152, .1192),
  8. vec3(.1805, .0722, .9505)));
  9. vec3 xYz = RGB2XYZ * rgbColor;
  10. float tmp = max(xYz.x + xYz.y + xYz.z, 0.1);
  11. return vec3(xYz.y, xYz.xy / tmp);
  12. }