• 10
• 9
• 13
• 10
• 18

# Issue with artists using physically correct attenuation ?

## Recommended Posts

Hi,
Artists like to have access to min/max attenuation but this attenuation using lerp or smoothstep is not physically correct.
The physically correct method is to do 1/dÂ² but this formula never reach to 0, so here the tweak used by unreal :

saturate(1-(distance/radius)^4)^2/(distance^2+1)

In other words it's to compute the 1/dÂ² and apply a mask :

DistanceAttenuation = 1 / ( DistanceSq + 1 );
DistanceAttenuation *= Square( saturate( 1 - Square( DistanceSq * Square( LightInvRadius ) ) );

That gives a very similar result but with a falloff to 0 at the radius.
What is the feeling with artist about that ? Does they still want the min/max attenuation ?
To me, it's always better to be more physically correct but does it break the possibilities ?
In other words, any experience about that with artists ?
Thanks

Edited by Alundra

##### Share on other sites

Ok that explains all the process and ends to use the same formula because it looks to be the best actually.
It doesn't speak about another kind of attenuation possible, maybe better to stay on one, and one physically correct is always better.

Edited by Alundra

##### Share on other sites
It is not a matter of artistic choice nor physical accuracy.
Lights have limits so they can be culled based on distance. It is not practical to have every pixel in your render lit by every single light in the game world.

L. Spiro

##### Share on other sites

Yes, it's true, I know the issue because I use clustered shading, you have to set the light in the good clusters.
But it's also a question about artists, because then with this method you have it physically correct but it's less controllable than min/max.

Edited by Alundra

##### Share on other sites

I prefer the physically correct attenuation. It's still possible to do light culling with infinite lights, you just use a threshold light intensity that is considered perceptually small (e.g. 0.01) and then solve the light attenuation equation to find the distance where the intensity drops below that value. With this method dim lights automatically get culled with small radii and bright lights are allowed to shine farther. If the epsilon is chosen correctly (e.g. considering effects of shading/exposure/tonemapping), the result should be indistinguishable from no culling at all.

##### Share on other sites

I prefer the physically correct attenuation. It's still possible to do light culling with infinite lights, you just use a threshold light intensity that is considered perceptually small (e.g. 0.01) and then solve the light attenuation equation to find the distance where the intensity drops below that value. With this method dim lights automatically get culled with small radii and bright lights are allowed to shine farther. If the epsilon is chosen correctly (e.g. considering effects of shading/exposure/tonemapping), the result should be indistinguishable from no culling at all.

You'd either need to put up with a ton of lightleak or have a LOT of (potentially very high res) shadow maps. Either that or have very few lights/very specific game content. And it's still an artificial cutoff, saves time for artists maybe, but perhaps they want to do it manually?

Edited by Frenetic Pony