Point Light Attenuation
In real world, lighting attenuation is governed by the inverse-square law:
However, in computer graphics things are a little trickier. Inverse-square law works for real lights because they have area, hence the projection of this area on receiver geometry gets exponentially smaller with distance. Point lights are an approximation and using the law on them produces one obvious problem: as distance approaches zero, lighting intensity approaches infinity.
There are multiple ways to solve it.
r = Light Range
This is an arbitrary hand-tweaked function. It does in fact resemble the inverse square curve, except fixed at distance of 5 and then scaled based on Range parameter. It has a nice property of being exactly 1 in the center. Scaling the same gradient allowed Unity to even store it inside a texture. A 8-bit texture unfortunately, that also lacks precision and produces visible banding when rendering with gamma correction.
As Unity, it also has the "+1" part to replace infinity with 1, but its range is unlimited and falls off based on distance. A similar function is also used in UE4 (you need access to UE4 github repository to open that link).
However, the "1" constant is still arbitrary and will look different depending on scene size/units.
s = Light Size
In both of these renderers, light size is hardcoded to be 0.01 (1cm), which means brightest value of the untinted light is 10000.
With Light Size being 0.01, it looks similar to HDRP formula, except instead of clamping it will slightly rescale the curve. With a value of 1 it works like the original Bakery falloff.
What value should I use?
When matching Bakery light to a HDRP light, Faloff min size will be automatically set to 0.01 to look identical. This value makes sense if your point light does indeed represent a 1cm emissive surface. However, there are cases when you can set it to a higher value:
- When literally using point lights for larger surfaces (e.g. lamp of a traffic light).
- When building for mobile platforms where lightmap compression is limited and cannot represent extremely bright values well; or tonemapping not possible.