Upcoming Events
Southwest Gaming Expo
11/20 - 11/22 @ Dallas, TX

Workshop on Network and Systems Support for Games (NetGames 2009)
11/23 - 11/25 @ Paris, France

ICIDS 2009 Interactive Storytelling
12/9 - 12/11 @ Guimarăes, Portugal

Global Game Jam
1/29 - 1/31  

More events...


Quick Stats
6531 people currently visiting GDNet.
2341 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!



Link to us

Link to us

  Intel sponsors gamedev.net search:   

Shadow Caster Volumes For The Culling Of Potential Shadow Casters


4.0 Semi-Transparent Objects

Rendering semi-transparent objects that can receive shadows is very expensive. First the scene must be rendered as normal using all opaque objects. The main steps for an additive stencil shadow algorithm [LENG02b] are given below,

  1. Get all opaque objects who's bounding volume intersects the view frustum.
  2. Render objects using ambient and emissive lighting.
  3. Get a light source who's bounding volume intersects the view frustum.
  4. Calculate light source's shadow caster volume.
  5. Render to the stencil buffer, shadow volumes for all shadow casters, that intersect both the shadow caster volume and the light source's bounding volume.
  6. Render all opaque objects from 1 that intersect the light source's bounding volume.
  7. While more light sources, goto 4.

Once this has been done, we need to render the semi-transparent objects, one at a time, from back to front order. To render each individual object we need to perform the following steps,

  1. Render semi-transparent object using ambient and emissive lighting.
  2. Get a light source who's bounding volume intersects the view frustum and the semi-transparent object's bounding volume.
  3. Calculate light source's shadow caster volume for the semi-transparent object.
  4. Render to the stencil buffer, shadow volumes for all shadow casters, that intersect the shadow caster volume and the light source's bounding volume.
  5. Render semi-transparent object using current light source.
  6. While more light sources, goto 2.

An important improvement is that the shadow caster volume calculated for each light source, semi-transparent object pair, can be greatly reduced from the general shadow caster volume for the light source. Instead of calculating the shadow caster volume from the view frustum, we instead calculate it from the semi-transparent object's bounding box.


Diagram 7: The shadow caster volume for a light source and a semi-transparent object.

Once we convert the semi-transparent object's bounding box to a polyhedron, the calculation of the shadow caster volume is the same as for a view frustum.

We assume that the bounding box is stored as four vectors, R , S , T and C . R , S and T are the orthogonal axes of the bounding box, with the each vector's magnitude being the size of the box along the axis. C is the center of the bounding box.

For each axis, we want to calculate the two planes for the box's end points. Let A be the axis we are currently dealing with.


Diagram 8: End point planes for axis A of bounding box.

As derived above, we can define a plane given its normal, and a point on the plane. So the two planes for an axis A are,

Given a normal convex polyhedron – bounding volume intersection test implementation, polyhedron planes that meet at an acute angle are likely to give false positives. This occurs because it is possible for an object's bounding volume to intersect the positive half space of each plane, yet still not intersect the polyhedron. Diagram 9 illustrates an example of this.


Diagram 9: Polyhedra with planes that meet at an acute angle increase occurrence of false positives.

Acute angles are much more likely to occur when generating shadow caster volumes for semi-transparent objects than for view frustums. A solution to this problem is to add an additional plane to the shadow caster volume polyhedron [LENG02a].


Diagram 10: Adding an extra plane to the polyhedron prevents the false positive.





5.0 Summary

Contents
  1.0 Introduction
  2.0 Point Light Sources
  2.1 LUP Decomposition
  2.2 Calculating the New Shadow Caster Volume Planes
  3.0 Directional Light Sources
  4.0 Semi-Transparent Objects
  5.0 Summary
  Listings

  Printable version
  Discuss this article