ShadowMap

From Odwiki

(Redirected from ShadowMaps)
Jump to: navigation, search

In mantra, a shadow map is a simply a single channel image which stores the z-distance from a light source to the surface - which is also called a DepthMap. Basically, this is equivalent to storing the Pz VEX variable in the image.

When it comes time to evaluate the shadow, the idea is that you compute the distance from the point you're shading to the light source. You then look up the distance in the shadow map. If the map's distance is less than the distance to the surface, it's in shadow. Otherwise, the point isn't shadowed.

Mantra can generate maps using the closest surface to the light source. However, this can cause PrecisionErrors or false-shadowing in some cases.

Mantra can also take the two closest surfaces and average the depth before it stores the values in the shadow map. This helps with the false-shadow errors and can produce much cleaner shadows on surfaces. However, mid-point shadow maps don't work very well when used in fog shading since the depth stored in the map doesn't actually represent a surface.

Because mantra only stores a single depth value per pixel, it isn't possible to represent transparent surfaces in shadow maps.

Pixar's RenderMan (prman) has the option to create a DeepShadow which allows for much smaller resolution images to be used, and also allows for transparency information and MotionBlur (albiet limited) to be stored in the shadow map.


Pros and cons of using Shadow Maps to cast shadows (over RayTraced shadows):

Advantages:

  • Its basically precomputing the illumination occlusion, which means that if the contents of the view from the light doesnt change then you can re-use those shadowmaps over and over, saving a lot of time.
  • It uses regular micropoly rendering (in mantra) meaning that displacement mapping is quick and efficient
  • Blurred shadows are very quick and easy and don't require regenerating the shadowmaps. Read more about FastBlurredShadows.

Disadvantages:

  • There is some waste of time computing shadows of part of the scene with are not in view (out of the frustum or occluded from view by some object)
  • The resolution of the map has to carefully chosen to match the shadow size and quality in frame.
  • A little more administration is required for re-use of shadowmaps.
© 2009 od[force].net | advertise