stk-code_catmod/data/shaders/utils/getRGBfromCIEXxy.frag

18 lines
596 B
GLSL
Raw Normal View History

2014-03-28 19:06:02 -04:00
// Using numerical value from here
// http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering
vec3 getRGBFromCIEXxy(vec3 YxyColor)
{
float Yovery = YxyColor.x / YxyColor.z;
vec3 XYZ = vec3(YxyColor.y * Yovery, YxyColor.x, (1. - YxyColor.y - YxyColor.z) * Yovery);
mat3 XYZ2sRGB = transpose(mat3(
2014-03-28 19:06:02 -04:00
vec3(3.2405, -.9693, .0556),
vec3(-1.5371, 1.8760, -.2040),
vec3(-.4985, .0416, 1.0572)));
2014-03-28 19:06:02 -04:00
vec3 sRGBColor = XYZ2sRGB * XYZ;
2014-04-20 20:19:09 -04:00
return max(sRGBColor, vec3(0.));//vec3(pow(sRGBColor.x, 2.2), pow(sRGBColor.y, 2.2), pow(sRGBColor.z, 2.2));
2014-03-28 19:06:02 -04:00
}