Beginner understanding - lights & compositing

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
screwt
Kobold
Posts: 29
Joined: Wed Feb 28, 2007 9:18 am
x 2

Beginner understanding - lights & compositing

Post by screwt »

Hello,

I'm facing something i do not understand about lights. I have a "static" scene where four lamps exists.
But when i turn the camera arround the scene, some light turn on & off depending on the camera position.
Could someone explain this behavior?

The problem: https://www.youtube.com/watch?v=DQ1V3LR ... e=youtu.be
The code: https://github.com/screwt/ogre_experime ... ceneLoader

Thank you for your help and time.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Beginner understanding - lights & compositing

Post by dark_sylinc »

Thanks for providing code using the EmptyProject, makes easier to troubleshoot and explain what's wrong.

What's going on:
Without ForwardClustered/Forward3D enabled, except for directional lights, point & spot lights only appear if they cast shadows.
Your shadow node is the same shadow node we use for many of our samples; but it is written to have 1 directional light using PSSM (3 splits) and 2 additional lights (these additional lights can be directional, spot, or point). Because of this, only 2 of your 4 point lights are getting picked up. One possible solution is to edit the shadow node to remove the directional light (if you don't use it) and add 2 more point lights so you can use them all at once with shadows (but this will consume more framerate, making your app more demanding)

Alternatively, you can enable ForwardClustered or Forward3D to have the other 2 lights show up, without shadows. Ogre will still cycle through the closest point lights that cast shadows, and you may still see the scene "change" as you move the camera, because the shadows will be changing. If that's annoying you can either use light->setCastShadows( false ); on the other lights; or use static shadows to manually control shadow & lighting (see StaticShadowMaps demo)
screwt
Kobold
Posts: 29
Joined: Wed Feb 28, 2007 9:18 am
x 2

Re: Beginner understanding - lights, shadow & compositing

Post by screwt »

Thank you for the tips Dark.
I'll study the compositing node stuff.
Post Reply