Author Topic: How many light sources does FSO support?  (Read 1235 times)

0 Members and 1 Guest are viewing this topic.

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
How many light sources does FSO support?
I heared it supports 8 lights in fixed-function and glsl mode.

But what exactly does that mean?
Are 8 lights support in total, or does that mean a surface/material can not show more than 8 lights on it?


And is this still a T&L limitation?
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: How many light sources does FSO support?
It's 8 lights in hardware for the fixed function pipeline.  And that is 8 lights per render pass, not necessarily per scene/model.  With fixed function rendering it can multi-pass to get more than 8 lights.  The code limited the number of extra passes for performance reasons.  However, with the addition of shader support the code for extra passes was removed in the fixed function pipeline, so it currently only supports 8 lights per model.

Due to the lack of an up-to-date renderer, shaders only render using a single pass, which means it is limited by the code to 8 lights per model.  Attempts to multi-pass render with shaders incurred an 80-90 percent performance hit, so that capability never added beyond test builds.  If the renderer is ever rewritten to allow for the performance upgrades needed to multi-pass with shaders then the light thing wont be an issue since the shaders can be written to just support 1 or 2 lights and then it can multi-pass the rest that it needs.  This would allow for less complex shaders as well, since simply removing support for even one light in the current shaders can give as much as a 10-15 FPS performance boost.

And GLSL doesn't actually have an 8 light limit itself, that is merely a hold-over from the fixed-function pipeline support.  All of that stuff was removed in GLSL version 1.30 (OpenGL 3.0) and now you are forced to use lights the "proper" way with shaders (with vertex attributes) which basically allows for as many lights as you want (or can get away with I guess I should say) in a single pass.


Oh, and the lights that it uses are the first 8 on a sorted list.  The sorting order is:
 - directional (suns)
 - tube (beam weapons)
 - point (explosions, lasers, etc.)

And point lights are further sorted by the size and intensity of the light so that the largest and brightest lights will come first.

 

Offline Dark RevenantX

  • 29
  • anonymity —> animosity
Re: How many light sources does FSO support?
One day, someday, the code will be rewritten.  Unless the 2012 doomsday prophecy is true.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
Re: How many light sources does FSO support?
Thanks for the reply. This clears a few things up.

Sounds like there can't be a fallback to fixed-function once we move on to OpenGL 3.0/3.1, unless it's a completely separate renderer.
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------