Page MenuHome

Poor Support for Dynamic Number of Lights in GLSL Mode
Closed, ArchivedPublic


Our GLSL shaders assume a fixed number of lights (the lights available in the Blender scene when the shader is generated). This causes issues when adding lamps to the scene with add object (T20275) or adding new lights via libload (T27030).

Some possible solutions:

Recompile shaders when the number of lights change. The problem with this is recompiling shaders can be slow, especially with lots of materials and no shader cache (I think only NVIDIA cards have a shader cache at the moment).

Change where shaders get light data from. We could pass an array of light structs (e.g., via uniform buffer objects) to shaders. This would allow us to change the number of lights in a scene (up to some maximum array size, unless we do texture objects, but that seems silly) without recompiling shaders. Unfortunately, this would introduce looping and branching into the generated code, which could slow down our shaders.

Move away from forward rendering. Techniques such as deferred/inferred rendering/lighting grab light data from a buffer that is filled at render time. This allows for a lot of dynamic lights, but we probably wouldn't want to drop our forward rendering, so this would only be a partial solution.



Event Timeline

Mitchell Stokes (moguri) triaged this task as Confirmed, Low priority.May 9 2014, 1:29 AM
Mitchell Stokes (moguri) renamed this task from Poor Support Dynamic number of Lights in GLSL Mode to Poor Support for Dynamic Number of Lights in GLSL Mode.May 20 2014, 8:40 AM

I would love to see support for deferred rendering,
would it simplify the rendering code or complicate it more?

would the core dvelopers need deferred rendering of openGL
in the UI? for creating and viewing game assets like maps?

maybe you could work together to impliment it in the UI /ainimation suite first
then adapt the code for the bge? roll in OpenES support while your at it.....

I wish I were a better coder so I could help, but I am still learning,

Aaron Carlisle (Blendify) closed this task as Archived.
Aaron Carlisle (Blendify) claimed this task.

This task is being closed because the BGE has been removed in Blender 2.8.