I am using a lot of vertex point lights in my scene and when they pass by an object, as soon as the object is out of range, it will cause a noticeable popping of the light turning off. I did some tests with a single point light and object and I get the same results. It seems at the very outer edge of the light radius it does not attenuate to 0 and as a result, as soon as a vertex enters the range, it causes the object to light up significantly.
Is this a bug or just how vertex lights work? I would think that there would be a smooth transition from 0 to 1 intensity within the light range.
Any help would be greatly appreciated as I can’t really use pixel lights for my current project.
There’s a limit to the number of lights than can be rendered on an object in forward rendering. You get a single directional light, a default of 4 per-pixel lights, and 4 vertex lights. Any beyond that get added to the object’s “ambient light”, but only if the light is hitting the object’s center. If you have >4 vertex lights touching an object it tries to use the 4 brightest or closest lights, and if you have any per pixel lights enabled one of those vertex lights might be a blended per pixel light.
Thanks for the response, bgolus. I thought it might be an issue with reaching the maximum light capacity but I get the same problem even in a new scene with 1 cube and 1 point light. You can see the difference in brightness in the attached image. It looks subtle there but when you see it popping in it’s quite noticeable.
That atten function results in a falloff that is a “bit” larger than a per pixel point light (in fact it’s infinite), which is ultimately what’s causing the popping. I’m not sure what calculation is used to build the lookup texture used by per pixel lights, but I suspect it’s similar but with a distance clamp.
Thanks for the response. Unfortunately, editing that code is beyond my capabilities. I don’t have much experience with custom shaders or lighting calculations like this.
If anyone is able to edit the code to reduce/eliminate the light attenuation popping that would be awesome, otherwise I’ll have to pursue other options.