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
1601 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:   

  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