Sha256: 63ebb8e140c88343d2cd60e39569c2ad80c1ee4591f6d84463b60ed8017539fe
Contents?: true
Size: 815 Bytes
Versions: 8
Compression:
Stored size: 815 Bytes
Contents
/** * Converts an RGB color to CIE Yxy. * <p>The conversion is described in * <a href="http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform">Luminance Transform</a> * </p> * * @name czm_RGBToXYZ * @glslFunction * * @param {vec3} rgb The color in RGB. * * @returns {vec3} The color in CIE Yxy. * * @example * vec3 xyz = czm_RGBToXYZ(rgb); * xyz.x = max(xyz.x - luminanceThreshold, 0.0); * rgb = czm_XYZToRGB(xyz); */ vec3 czm_RGBToXYZ(vec3 rgb) { const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193, 0.3576, 0.7152, 0.1192, 0.1805, 0.0722, 0.9505); vec3 xyz = RGB2XYZ * rgb; vec3 Yxy; Yxy.r = xyz.g; float temp = dot(vec3(1.0), xyz); Yxy.gb = xyz.rg / temp; return Yxy; }
Version data entries
8 entries across 8 versions & 1 rubygems