Upcoming Events
Unite 2010
11/10 - 11/12 @ Montrťal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27††

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
79 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Fake Shadows
 Vertex Projection
 Shadow Z-Buffers
 Shadow Volumes
 Combining
 Algorithms


 Printable version
 Discuss this article
 in the forums


 


Vertex Projection

This method is still very simple, but it is considerably better than the last one. In this method, you project each polygon onto the ground. If there is any confusion, look at figure 3.1.

Figure 3.1


Example of vertex projection

The calculations for this method are incredibly simple, as you can see in listing 3.1

Listing 3.1

void shadow_poly(Point3D p[], Point3D s[], Point3D l, num_verts)
{
  for (i=0; i<num_verts; i++)
  {
    s[i].x = p[i].x - (p[i].y / l.y) - l.x;
    s[i].z = p[i].z - (p[i].y / l.y) - l.z;
  }
}

(Where s is the shadow vertex, p is the object vertex, and l is the point the light originates from.)

Although this is much better, this algorithm is still pretty simple, and restricted in itís use. Once again, it only works if the ground is flat and it still doesnít shadow other objects. Donít worry though; there are still two more algorithms!




Next : Shadow Z-Buffers