project-navigation
Personal tools

Author Topic: Dynamic Lights restriction  (Read 1937 times)

Offline Crystan

  • Project Artist
  • Captain
  • ***
  • Posts: 572
  • UFO:AI Lead Sound Artist
    • View Profile
    • http://crysea.cr.funpic.de/
Dynamic Lights restriction
« on: April 03, 2012, 04:12:38 pm »
Why do we have a maximum of 7 dynamic lights? Iam sure modern PCs can support more than 7.

Offline Sandro

  • Squad Leader
  • ****
  • Posts: 240
  • Maintenance guy for UFO:AI 3D engine
    • View Profile
Re: Dynamic Lights restriction
« Reply #1 on: April 03, 2012, 10:12:31 pm »
Artirfact of earlier rendering code -- it used OpenGL FFP lights, and the minimum possible count of those (defined by OpenGL spec) is 8. And since light #0 was used for the sun, only 7 lights remained to be available for dynamic lights.
Everything else would require dynamic checks on the number of available OpenGL lights, severely complicating the code.

This is a problem for a current code, too: max amount of light's data you can feed to the shader depends on hardware, and with the mess the current rendering code is, it will require a big coding effort to implement correct "maximum possible lights mode" in fail-safe way. So -- for now, let's stick with the safe maximum of 7 lights which should work on any GLSL-compatible hardware.

PS: Why would you need that amount of dynamic lights? 7 is pretty much enough IMHO.