public static pb_CIE_Lab_Color FromXYZ(pb_XYZ_Color xyz) { return pb_ColorUtil.XYZToCIE_Lab(xyz); }
/** * Convert XYZ color to CIE_Lab */ public static pb_CIE_Lab_Color XYZToCIE_Lab(pb_XYZ_Color xyz) { float var_X = xyz.x / 95.047f; // ref_X = 95.047 Observer= 2°, Illuminant= D65 float var_Y = xyz.y / 100.000f; // ref_Y = 100.000 float var_Z = xyz.z / 108.883f; // ref_Z = 108.883 if ( var_X > 0.008856f ) var_X = Mathf.Pow(var_X, ( 1/3f )); else var_X = ( 7.787f * var_X ) + ( 16f / 116f ); if ( var_Y > 0.008856f ) var_Y = Mathf.Pow(var_Y, ( 1/3f )); else var_Y = ( 7.787f * var_Y ) + ( 16f / 116f ); if ( var_Z > 0.008856f ) var_Z = Mathf.Pow(var_Z, ( 1/3f )); else var_Z = ( 7.787f * var_Z ) + ( 16f / 116f ); float L = ( 116f * var_Y ) - 16f; float a = 500f * ( var_X - var_Y ); float b = 200f * ( var_Y - var_Z ); return new pb_CIE_Lab_Color(L, a, b); }