Pixel light performance issues

How much of a performance hit will be taken by using dozens of point and spotlights spaced every 3 - 10 units in Unity 5? I experimented with 70 point lights in a fairly dense cluster (every 2 - 5 m or so) with a range of 5 for each of them and a setting of 4 overlapping lights per pixel, and there literally wasn’t any performance change at all even on my cheap PC (and yes, the lights were all functioning) except when I enable shadows on them, in which case there’s a large hit and shadows fluctuate with batching spurts. But I can have about a dozen of them without flickering and with an FPS of about half the normal rate. Does anyone know what the average experience is with different video cards?

If you had dozens of lights, probably not all of them should cast shadows. Only choose a few to cast shadows.
In deferred mode you could have many of lights without any performance loss (not considering shadows)
Are you in forward rendering mode? The flickering is because the pixel light count in the quality settings is too low, and only one light can illuminate a mesh at a time, assuming the pixel light count is set to one.

1 Like

Thank you. Is deferred rendering also faster for multiple shadowcaster lights? The information available about this is contradictory, and mostly for older versions of Unity that may be different than 5.0.

The best way is to try it out yourself by using the profiler. But you got me curious, so I tested it out my self. I created a scene with two shadow casting cubes and three lights. One light per cube, and the last light hitting both cubes. The conclusion is that it forward mode is 3x more costly for rendering shadows. So deferred would be better here.

0.37 ms in Deferred
1.10 ms in Forward

2780597--201175--fvsdef.png

But i ran the test on other scenes I had and noticed that deferred rendering somehow causes MORE shadows casters compared to forward when using OC. But sometimes running simple test scenes is not good enough and can be misleading. You have to run tests like this in a complex scene because your mileage will vary significantly.
I only run Forward for scenes which use baked lighting so I can take advantage of the AA. Deferred is used for when there is too many lights in the scene to use Forward, and it would result in higher batches and triangles being rendered.