Blending Online

Games and Tutorials on the Blender Game Engine


Static Shadows

Looking for a method to fake detailed shadows in your games? In this tutorial I'll outline a basic method of doing this. You'll need some basic knowledge of how to work with alpha channels in an image manipulation program (Photoshop, Paint Shop Pro, Gimp, etc.).

This method is ideal for adding greater realism to environments. It works best using static objects, however can also have limited uses with dynamic ones.

Firstly take the object you want to cast a shadow from. Place your camera where the lightsource will be and point the camera at your object. Set the world background to white and run the game. Take a screenshot of the object.

This is the object I will be using for this tutorial:

Import the image into your image manipulation program. Using various tools to select different areas of the image, convert the object itself into a solid block of grey and the background into black. This new image will be used as the alpha channel of the final image. Having the white background usually helps here as selection tools can easily detect the object's outline.

You should end up with something like this:

Take the original image and this time convert the object into a solid block of black, which should leave you with something like this:

Combine the 2 images using the grey object as the alpha channel, and you should end up with a nice semi-transparent shadow effect:

Save this new image in a format which maintains the alpha channel, such as PNG or TGA.

That's it for the photo manipulation aspect. Now we're ready to import the image into Blender.

Firstly create a new plane and elevate it slightly off the ground. Map the shadow image to this plane and set the face to Alpha. It should look something like this:

Now all that's left to do is properly scale and align the plane with the original object. When you're done you should have some pretty realistic looking shadows!