Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Question about managing lights in a basic light system.

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2014
    Posts
    13

    Question about managing lights in a basic light system.

    Hi guys, I have implemented differents lights by GLSL, ( points, spot, directional ). Now I want to program a basic lights system, which only manages static lights and uses forward rendering.

    I have read that for example engines like Doom 3 use only 8 light sources in the shader, but then my question is: are 8 light sources per rendered mesh, or are 8 ones for the whole scene.

    In the first case, I need to get the eight lights that have more influence for each mesh that will be rendered.
    In the second one, I need to get the eight lights that have more influence in the entire scene that will be rendered.

    Thanks in adavance.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,728
    Doom 3 can support an arbitrary number of lights, although in practice the number of simultaneous lights per fragment is limited, but this is for performance reasons rather than on account of any kind of limit.

    Fortunately the source code is available so you can study it and learn how it worked. And so that we can avoid debates containing erroneous claims about how it worked.

    In summary, and simplified a little, Doom 3 first fills the scene to black, then enables additive blending and accumulates each light individually, with shadowed out regions excluded using the stencil buffer.

    Accumulating each light individually is important, there is no loop over a number of lights in it's shaders, instead each pass just handles one light, but there can be any arbitrary number of such additive passes, with no upper limit.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •