Shadows

Blitz3D Forums/Blitz3D Programming/Shadows

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Now now... its easy enough. I suspect you're becoming stuck only because you're not up on the background info.

Lets concentrate on that and hopefully things will click into place.

A shadow in real life will usually be the same shape as you. When you walk around, your shadow is a filled in outline of you.

To make this, a camera is placed at the light source and pointed at you. The resulting render is placed on a texture. This is the shadow texture. More often than not it will be enough to convince you that it is a shadow for real. A few more tricks such as entitycolour or entityfx are used to color the render.

The scene is then rendered again, this time with the shadow texture already in place. This is usually going to be on a terrain or flat floor for this kind of trick.

points to note:

1. color objects dark grey
2. render these objects from above
3. copy the renderworld to a texture
4. apply this new "shadow" texture to the ground
5. restore the original objects
6. render the game
7 goto 1

This is the basic cycle of creating a realtime shadow map norc's way. Its really quite effective when done carefully.

As for typical shadows, such as a blob under the player's feet it may well be better to use a single sprite. if the ground is basically flat this is all you need. SpriteViewMode will prevent the sprite from turning.

If the ground has hills or it's a level - then my flex code does the same thing, except the shadow bends to fit the floor's bumps and hills.

I hope this is a little bit clearer... :)