blackbody.cpp
// Polynomial fit to sRGB-D60 of Planck equation integrated over NVIDIA fit of 10-degree XYZ data
//
Polynomial fit to sRGB-D60 of Planck equation integrated over NVIDIA fit of 10-degree XYZ data
Polynomial fit to sRGB - D60 of Planck equation integrated over NVIDIA fit of 10 - degree XYZ data
vec3 blackbody_FitSRGB( float K )
{
    float x = clamp( ( ( K - 1000.0f ) / 19000.0f ), 0.0f, 1.0f );
    float x2 = x * x; float x3 = x2 * x; float x4 = x2 *x2; float x5 = x3 *x2; float x6 = x3 * x3;
    vec3 y = vec3(
        -0.029972778695974256f + 7.669083294646621f * x +  2.214401294577103f * x2 - 49.42474372087125f  * x3 + 103.53915061107702f * x4 - 89.5574774811751f   * x5 + 28.588440157789307f * x6,
        -0.0374521902577345f   + 5.613905742381423f * x + 16.608160380839113f * x2 - 88.52816707661721f  * x3 + 157.8362751079448f  * x4 - 127.4927963970656f  * x5 + 39.14505232781722f * x6,
        -0.21282402472640047f  + 5.342342069940462f * x + 23.583032531526992f * x2 - 106.91106640514953f * x3 + 181.48860203094765f * x4 - 143.00625735899658f * x5 + 43.27750211769455f  * x6
    );
    return vec3( pow( y.x, 5.0f ), pow( y.y, 5.0f ), pow( y.z, 5.0f ) );
}
vec3 blackbody_FitSRGB ( float K ) { float x = clamp ( ( ( K - 1000.0f ) / 19000.0f ) , 0.0f , 1.0f ) ; float x2 = x * x ; float x3 = x2 * x ; float x4 = x2 * x2 ; float x5 = x3 * x2 ; float x6 = x3 * x3 ; vec3 y = vec3 ( -0.029972778695974256f + 7.669083294646621f * x + 2.214401294577103f * x2 - 49.42474372087125f * x3 + 103.53915061107702f * x4 - 89.5574774811751f * x5 + 28.588440157789307f * x6 , -0.0374521902577345f + 5.613905742381423f * x + 16.608160380839113f * x2 - 88.52816707661721f * x3 + 157.8362751079448f * x4 - 127.4927963970656f * x5 + 39.14505232781722f * x6 , -0.21282402472640047f + 5.342342069940462f * x + 23.583032531526992f * x2 - 106.91106640514953f * x3 + 181.48860203094765f * x4 - 143.00625735899658f * x5 + 43.27750211769455f * x6 ) ; return vec3 ( pow ( y . x , 5.0f ) , pow ( y . y , 5.0f ) , pow ( y . z , 5.0f ) ) ; }
Polynomial fit to sRGB-D60 of Planck equation integrated over NVIDIA fit of 10-degree XYZ data
Polynomial fit to sRGB - D60 of Planck equation integrated over NVIDIA fit of 10 - degree XYZ data