The BlackBodyRadiation function approximates luminance and chromaticity of a black body radiation emitted at the given temperature. Approximation errors are not provided, so this function should not be used where computational accuracy is critical! Instead, the primary purpose of this function is to render a black body surface in real time, which can be used in CG shaders, therefore the function is written in HLSL.
The luminance and chromaticity of a black body radiation are computed independently of each other. The alpha-component of returned value is effective radiance in W/(sr*m2), which should be multiplied by 683.002 lm/W to get the corresponding luminance in cd/m2. The rgb-components of returned value are color components expressed in linear sRGB color space. Relative luminance of returned color is close to 1 for temperatures above about 1000 K. Note, that returned color can have negative components, which means that chromaticity of a black body is outside the sRGB gamut for a given temperature (g-component < 0 for temperatures below about 900 K and b-component < 0 for temperatures below about 1900 K). To get final color of a black body radiation with luminance in cd/m2 the rgb-components should be multiplied by the alpha-component and by 683.002 lm/W.
sRGB is defined according to ITU-R BT.709:
chromaticity | x | y |
---|---|---|
white point | 0.3127 | 0.3290 |
red primary | 0.64 | 0.33 |
green primary | 0.30 | 0.60 |
blue primary | 0.15 | 0.06 |
More details about how this approximation was derived can be found here https://www.desmos.com/calculator/qaxw5zb0zc