- Home /
Limit to number of lights?
Is there a limit to the number of lights you can have in a single scene?
I have 4 spotlights and two point lights and I'm trying to add them to create a more dramatic effect. When I try to add another light, It does not illuminate anything. However, when I move the lights in different proximities to each other they seem to add and diminish each other. Am I overlooking something that prevents me from having multiple lights?
Yes, that is exactly what I'm looking for. Thanks! Do you have any experience with performance lag and at what threshold? I'm assu$$anonymous$$g a mobile phone is worst case scenario. (If you make this an answer I can select it)
Thanks for the conversion! Sorry, a bit new to the forums... Glad this helped!
As for the performance threshhold, Unity talks about this a bit in documentation. Basically, 1 pixel light max for mobile, if I remember correctly. And I can see why. Ins$$anonymous$$d of calculating per vertex and interpolating, you're calculating lighting per pixel in the surface/frag shader. This enables bumpmapping and some other nice effects though, so you may need it.
Answer by OP_toss · Apr 09, 2013 at 02:16 AM
I believe there is a Pixel Light Count, which is settable in Edit->ProjectSettings->Quality.
Also there is a "priority" variable on the lights which determines which show and which hide. The highest priority also become Pixel-shaded lights. And I'm assuming the closest get higher priority if they match.
That help?
Is it bad if I have a really high pixel light count? Say, 4,000.
If you're using forward rendering, performance is described by:
O(num_geometry_fragments * num_lights)
For deferred rendering, complexity is
O(screen_resolution * num_lights)
Performance with either gets worse with the number of lights, although deferred scales better if you have a small number of pixel lights affecting many objects.