Creepy sack girl!

September 16th, 2008 by Michael

We’ve had a lot of trouble making characters cast shadows in the game. Our engine uses a technique called Stencil Shadows. Those can be created very fast on the videocard. Except that they don’t work with characters! So we always had to resort to a very slow software-based solution. In The Path, turning on shadows could easily reduce the framerate by a quarter.

So we started experimenting a little and came up with an extremely primitive yet efficient solution. Instead of using the deformed mesh of the character to cast the shadow, we modelled simple shapes that approximated the character’s different body parts (head, arms, pelvis, etc).

Then we render these in the place where they are in the game (at the position where the character’s skeleton’s bones are). It is this collection of simple objects that we use to cast the shadow.

Of course the result is a very crude shape. So then we blur the shadow to make it look pretty. Which is kind of a bonus, because soft shadows are another thing that is hard to do in games.

The result is realtime shadows that look nice and cause virtually no framerate reduction.