// Maximum relative error: 2.6855360216340534 * 10^-6. Intensities up to 1000 are artifact-free.
float x = abs(cosTheta);
float y = 1.5707921083647782 + x * (-0.9995697178013095 + x * (0.778026455830408 + x * (-0.6173111361273548 + x * (0.4202724111150622 + x * (-0.19452783598217288 + x * 0.04232040013661036)))));
return res;
if (cosTheta < 0)
{
// Undo range reduction.
y = PI * rsqrt(saturate(1 - cosTheta * cosTheta)) - y;