about lights

Hi,i known maxmim number of lights is 8,so how can simulating a dozen lights?!

This, among various other questions that you’ve asked, can be answered by a little bit of googling or by reading a recent book like the Superbible.

Aside from that, 8 lights are permitted only when using the fixed-function pipeline. With deferred shading and deferred lighting this limit is obsolete, as they are fully shader based approaches.

Also with all techniques there is nothing from stopping you from running multiple passes.

To be a bit more precise, if you do forward rendering, you generally render the scene once for each light. This is also the same for deferred rendering: you apply each light separately from your data stored in your FBO.

So you commonly never render several lights at once, whether you do forward rendering or deferred rendering, and even if you are stuck with no shaders.

To be more precise, you have choices:

  1. Use fixed function lighting
  2. Use a shader based forward renderer
  3. Use a deferred renderer
    (actually there are more possibilities but I suppose this is enough)

In case of option #1, you need to render the scene once for each 8 lights and use additive blending to accumulate the results (or you can use also the accumulation buffer if you wish).

In case of option #2, you need to render the scene once for each light (or each N light, depending on the implementation), but again, you add together the results using additive blending.

In case of option #3, you need to render the scene only once, to the G-Buffer and then render the lights in additional full-screen, quad, or volume based passes, but the main point remains the same: use additive blending to accumulate the results.