Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualTispe

Posted 08 November 2013 - 01:09 AM

For every light source you need to generate a shadow map. A shadow map is a a complete render of the scene where the camera is placed at the light source. Instead of saving the colors like a normal render pass, you save the depth Z.

 

When you have all the shadow maps you need there are several ways of applying shadows to the scene:

Option A, render the scene and check each pixel against each shadow map. This requires you to bind the shadow maps to samplers, and you are limited with how many samplers you have available.

 

Option B, you can also composition shadows ontop of the rendered scene. This is handy if you have many shadow maps. Render the scene to a texture for color and a depth buffer for Z. Then render a fullscreen quad with the scene. For each pixel check the depth buffer value against each shadow map.

 

 

Before you start applying shadows to your scene, try to render something like this first:

shadowmap-small.png

This is an inverted shadow map with a single channel. Instead of colors, the distance to the light determines the pixel value.


#1Tispe

Posted 08 November 2013 - 01:01 AM

For every light source you need to generate a shadow map. A shadow map is a a complete render of the scene where the camera is placed at the light source. Instead of saving the colors like a normal render pass, you save the depth Z.

 

When you have all the shadow maps you need there are several ways of applying shadows to the scene:

Option A, render the scene and check each pixel against each shadow map. This requires you to bind the shadow maps to samplers, and you are limited with how many samplers you have available.

 

Option B, you can also composition shadows ontop of the rendered scene. This is handy if you have many shadow maps. Render the scene to a texture for color and a depth buffer for Z. Then render a fullscreen quad with the scene. For each pixel check the depth buffer value against each shadow map.

 

 

Before you start applying shadows to your scene, try to render something like this first:

shadowmap-small.png

This is a shadow map with a single channel. Instead of colors, the distance to the light determines the pixel value.


PARTNERS