2014-03-29 00:06:02 +01:00
|
|
|
// Using numerical value from here
|
|
|
|
// http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering
|
|
|
|
|
|
|
|
vec3 getRGBFromCIEXxy(vec3 YxyColor)
|
|
|
|
{
|
2015-01-12 19:41:48 +01:00
|
|
|
float Yovery = YxyColor.x / max(YxyColor.z, 0.1);
|
2014-03-29 00:06:02 +01:00
|
|
|
vec3 XYZ = vec3(YxyColor.y * Yovery, YxyColor.x, (1. - YxyColor.y - YxyColor.z) * Yovery);
|
|
|
|
|
2014-09-24 01:19:37 +02:00
|
|
|
mat3 XYZ2RGB = transpose(mat3(
|
2014-03-29 00:06:02 +01:00
|
|
|
vec3(3.2405, -.9693, .0556),
|
|
|
|
vec3(-1.5371, 1.8760, -.2040),
|
2014-03-31 00:24:58 +02:00
|
|
|
vec3(-.4985, .0416, 1.0572)));
|
2014-03-29 00:06:02 +01:00
|
|
|
|
2014-09-24 01:19:37 +02:00
|
|
|
vec3 RGBColor = XYZ2RGB * XYZ;
|
|
|
|
return max(RGBColor, vec3(0.));
|
2014-03-29 00:06:02 +01:00
|
|
|
}
|
|
|
|
|