Deferred shading example

Hi!

I am working on a demo based on the deferred shading example. However, I am a bit confused on the shadow map generation. Questions:

  1. Do the shadow casters self shadow?
  2. Is it only the “room” that receives the shadows? What determines if an object is a shadow caster or a receiver?
  3. Changing the prime light lower doesn’t seem to produce shadows on the walls in the room.

This is a really cool example!

Jonas

Hi,

generally speaking, shadow casters will self shadow when using shadow maps. Casters are drawn to the shadow map first. Then, when it’s time to render the scene, the casters are drawn using a shader that does a lookup in the shadow map. If it finds that the fragment is further away from the light than the corresponding fragment in the shadow map, it treats the fragment as “in shadow”.

All objects that are drawn to the shadow map are casters. All objects that are drawn using a shader that uses the shadow map are receivers.

I hope this clarifies a few things. See also: LearnOpenGL - Shadow Mapping

~Paul