Why do spot lights that cast no shadows cast no light? Topic is solved

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


jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Why do spot lights that cast no shadows cast no light?

Post by jwwalker »

I started with Sample_ShadowMapFromCode, turned off the directional light using

Code: Select all

light->setVisible( false );
, and for each of the 2 spot lights did

Code: Select all

light->setCastShadows( false );
. The result is that everything is black except for the background color. Why?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: Why do spot lights that cast no shadows cast no light?

Post by dark_sylinc »

See Forward3D sample and its help (press F1)
jwwalker
Goblin
Posts: 248
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Re: Why do spot lights that cast no shadows cast no light?

Post by jwwalker »

Thanks for the workaround, though it doesn't really answer the "why" for me. I would have bet anything that lighting without shadows would always be an order of magnitude simpler than lighting with shadows.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5436
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1343

Re: Why do spot lights that cast no shadows cast no light?

Post by dark_sylinc »

jwwalker wrote: Mon Nov 15, 2021 11:12 pm Thanks for the workaround
It's not a workaround, it's the recommended solution.
jwwalker wrote: Mon Nov 15, 2021 11:12 pm though it doesn't really answer the "why" for me. I would have bet anything that lighting without shadows would always be an order of magnitude simpler than lighting with shadows.
What you're describing is called simply "Forward" rendering. If you've got a simple scene it's probably the best way to render everything.

But once you have larger scenes you want to have each object to be affected by the least possible number of lights (i.e. culling by distance to each object). This either requires expensive per object light lists (because it grows with N * M, N being the number of objects on the scene and M number of lights) or have all lights visible at all times.

It works for shadow mapping because shadow maps are few and the most expensive part is the shadow map pass, so we simply evaluate lights' proximity to camera and have it enabled for all objects.

But for regular lights, much more efficient algorithms like Forward+ (or Deferred, which we don't implement) are preferred which can deal with large numbers of objects and lights.