[osg-users] Many lights in OSG - solution

Jannik Heller scrawl at baseoftrash.de
Fri Oct 23 15:42:21 PDT 2015


Hi Chris,

Thanks for the comment. From what I can tell, Forward+ is the same technique that I'm doing, except that it uses grid culling to accelerate the building of light lists. This will give you a performance boost in scenes with thousands of lights, but isn't necessary otherwise. For me the light list collection isn't really a bottleneck at the moment, but this will depend on your scene of course.


> 
> Have you considered a non-FFP solution? Withthis, you could have more than 8 lights. 
> 

Yeah, I know. I will add shaders at some later point, but the FFP will remain as fallback (I want it to run on old hardware).

Shaders are always very engine specific, so you couldn't really make them into a general purpose plugin like I'm proposing here ;)

There are two interesting ways to leverage shaders:
- Adjust the fragment shader to handle more than GL_MAX_LIGHTS, pass the lights via uniforms. This would raise the "simultaneous" light limit per object, but you'll still want some sort of light culling or performance would be bad.
- Switch to a deferred shading. Gives you freedom to run thousands of lights with good performance, but if you don't use that many lights then forward rendering will perform better. Also, deferred shading has problems with transparent objects, and problems with material variety since the final shading all runs through the same fragment shader (there is a "spin-off" technique of deferred shading that addresses the material variety problem, I forgot what it's called). Sometimes you can reuse channels of the g-buffer for other effects like SSAO or depth of field. All this requires a careful consideration of your requirements before you start so deferred rendering is not something you would add to your engine overnight.

Cheers,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65429#65429








More information about the osg-users mailing list