Author Topic: [Implementation Question] Lighting from Shots/Missiles  (Read 2503 times)

0 Members and 1 Guest are viewing this topic.

Offline Vidmaster

  • 211
  • Inventor of FS2 bullettime ;-)
[Implementation Question] Lighting from Shots/Missiles
How exactly does the engine actually do that? Is every single shot really a light source? I cannot believe that  :)
To me, it looks like it is only every third or forth one when firing something fast. And how could it be? I mean, when hundreds of shots and missile are flying around it would be overkill for the rendering loop. And, aiming to avoid loops in shaders, one would have to swap out the shaders constantly, depending on the number of light sources.

I know the OpenSource concept but really, I have never looked into the FS2 code before and thus I think it is probably faster if I just ask this question here.

How does the SCP engine handle the dynamic light source thing?
Devoted member of the Official Karajorma Fan Club (Founded and Led by Mobius).

Does crazy Software Engineering for a living, until he finally musters the courage to start building games for real. Might never happen.

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
Re: [Implementation Question] Lighting from Shots/Missiles
This is all something that will be solved by deferred lighting actually.

 

Offline MatthTheGeek

  • Captain Obvious
  • 212
  • Frenchie McFrenchface
Re: [Implementation Question] Lighting from Shots/Missiles
If you are not using Valathil's deferred lighting builds, the engine is limited to 8 active light sources. Each laser, beam, missile etc is still a potential light source, but the engine only take the 8 most relevant ones.

If you use a deferred lighting build, then indeed they all are actual light sources. For great justice.
People are stupid, therefore anything popular is at best suspicious.

Mod management tools     -     Wiki stuff!     -     Help us help you

666maslo666: Releasing a finished product is not a good thing! It is a modern fad.

SpardaSon21: it seems like you exist in a permanent state of half-joking misanthropy

Axem: when you put it like that, i sound like an insane person

bigchunk1: it's not retarded it's american!
bigchunk1: ...

batwota: steele's maneuvering for the coup de gras
MatthTheGeek: you mispelled grâce
Awaesaar: grace
batwota: oh right :P
Darius: ah!
Darius: yes, i like that
MatthTheGeek: the way you just spelled it it means fat
Awaesaar: +accent I forgot how to keyboard
MatthTheGeek: or grease
Darius: the killing fat!
Axem: jabba does the coup de gras
MatthTheGeek: XD
Axem: bring me solo and a cookie

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: [Implementation Question] Lighting from Shots/Missiles
Clarification: 8 light sources for any one object being illuminated.

I think.

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Minecraft
    • Skype
    • Twitter
    • Headdie on Deviant Art
Re: [Implementation Question] Lighting from Shots/Missiles
Clarification: 8 light sources for any one object being illuminated.

I think.

I was under the impression it was a global limit
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline Iss Mneur

  • 210
  • TODO:
Re: [Implementation Question] Lighting from Shots/Missiles
Clarification: 8 light sources for any one object being illuminated.

I think.

I was under the impression it was a global limit
It is a global limit.  What Matt said is exactly how it works, with one amendum, projectiles in particular are grouped by the code so that only a single group is considered a lighting source, not each bolt, this is to cover the (common case in FS) where you have a group of bolts all travelling together.

Also note, that the 8 active lights can change every frame, so the engine is always rescoring the lights to find the most relevant and "best" place to light them (say when they are just passing another ship).

Of course this all goes out the window with Valithil's deferred lighting test builds.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Vidmaster

  • 211
  • Inventor of FS2 bullettime ;-)
Re: [Implementation Question] Lighting from Shots/Missiles
GL_Light has may be more than 8 depending on the Graphics Card, but 8 is the minimum. So yeah, that makes sense.

Each laser, beam, missile etc is still a potential light source, but the engine only take the 8 most relevant ones.

That's exactly my question, HOW does it do that? Closest too the player?
Devoted member of the Official Karajorma Fan Club (Founded and Led by Mobius).

Does crazy Software Engineering for a living, until he finally musters the courage to start building games for real. Might never happen.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: [Implementation Question] Lighting from Shots/Missiles
Magic, really.

In pseudocode, what it does is I think something like this:

For every object
   Add all directional (i.e. sun) lights to render queue
   For all lights within object radius
       add light to render queue


But yes, all of this bs is going away once deferred lighting is on the table.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Vidmaster

  • 211
  • Inventor of FS2 bullettime ;-)
Re: [Implementation Question] Lighting from Shots/Missiles
ah, so it is per object. Makes more sense!
Devoted member of the Official Karajorma Fan Club (Founded and Led by Mobius).

Does crazy Software Engineering for a living, until he finally musters the courage to start building games for real. Might never happen.

 

Offline Valathil

  • ...And I would have had a custom title if it wasn't for you meddling kids!
  • 29
  • Custom Title? Wizards need no Custom Title!
Re: [Implementation Question] Lighting from Shots/Missiles
If you want a little history about the lighting system and the crazy things that went on in there before I patched a lot of little things in there you should swing by IRC. I can tell you stories man.
┏┓╋┏┓╋╋╋╋╋╋╋╋╋┏┓
┃┃╋┃┃╋╋╋╋╋╋╋╋╋┃┃
┃┃┏┫┃┏┳━━┓┏━━┓┃┗━┳━━┳━━┳━━┓
┃┃┣┫┗┛┫┃━┫┃┏┓┃┃┏┓┃┏┓┃━━┫━━┫
┃┗┫┃┏┓┫┃━┫┃┏┓┃┃┗┛┃┗┛┣━━┣━━┃
┗━┻┻┛┗┻━━┛┗┛┗┛┗━━┻━━┻━━┻━━┛

 

Offline Nighteyes

  • 211
Re: [Implementation Question] Lighting from Shots/Missiles
on the same topic, lighting from missiles flag doesn't seem to do anything, it might just mean that the models will receive light.

deferred lighting and shadows are going to upgrade this engine considerably  :yes:

 

Offline Flaser

  • 210
  • man/fish warsie
Re: [Implementation Question] Lighting from Shots/Missiles
If you are not using Valathil's deferred lighting builds, the engine is limited to 8 active light sources. Each laser, beam, missile etc is still a potential light source, but the engine only take the 8 most relevant ones.

If you use a deferred lighting build, then indeed they all are actual light sources. For great justice.

There is a deferred lighting build?!?  :eek2:

Link please! :o


Nevermind.
Valanthil, you're a true wizard.
« Last Edit: October 03, 2012, 08:14:27 am by Flaser »
"I was going to become a speed dealer. If one stupid fairytale turns out to be total nonsense, what does the young man do? If you answered, “Wake up and face reality,” you don’t remember what it was like being a young man. You just go to the next entry in the catalogue of lies you can use to destroy your life." - John Dolan