|
|
|
|
|
|
|
|
|
|
float3 unL = positionWS - lightData.positionWS; |
|
|
|
|
|
|
|
// Pick the axis along which to expand the fade-out sphere into an ellipsoid. |
|
|
|
// Pick the axis along which to dilate the attenuation sphere into an ellipsoid. |
|
|
|
// We define the ellipsoid s.t. r1 = r, r2 = (r + len / 2). |
|
|
|
// We define the ellipsoid s.t. r1 = r2 = r, r3 = (r + len / 2). |
|
|
|
// TODO: This could be precomputed. |
|
|
|
float radius = rsqrt(lightData.invSqrAttenuationRadius); |
|
|
|
float invAspectRatio = radius / (radius + (0.5 * len)); |
|
|
|
|
|
|
|
|
|
|
float3 unL = positionWS - lightData.positionWS; |
|
|
|
|
|
|
|
// Pick the axis along which to expand the fade-out sphere into an ellipsoid. |
|
|
|
// Pick the axis along which to dilate the attenuation sphere into an ellipsoid. |
|
|
|
// We define the ellipsoid s.t. r1 = r, r2 = (r + |w - h| / 2). |
|
|
|
// We define the ellipsoid s.t. r1 = r2 = r, r3 = (r + |w - h| / 2). |
|
|
|
// TODO: This could be precomputed. |
|
|
|
float radius = rsqrt(lightData.invSqrAttenuationRadius); |
|
|
|
float invAspectRatio = radius / (radius + abs(halfWidth - halfHeight)); |
|
|
|