Monday 2 January 2012

Casting a shadow

From doing some research, it would seem that shadows in games and game engines is not an easy thing.

Getting a good looking shadows or even shadows at all takes some doing.

The Riemers XNA tutorials have a good section on dynamic lighting and using HLSL to write realistically lit scenes. The output is quite impressive but the effort to implement is substantial and not required for what I want.

I Just want a shadow cast from directly under the player UFO, nothing more than that.

So more research shows that shadow volumes are an easy way to build basic shadows.

There are XNA tutorials on shadow volumes and implementing them with the XNA stencil buffer. Problem is, every example I found was for XNA 3.1 or before and none of them seemed to work in XNA 4.0.

Rather than mess around with trying to get it to work I found another way using shadow maps.

Msdn has a nice example of how to implement a shadow map (link) and it gives me essentially what I'm after (and it works in XNA 4.0)

No comments:

Post a Comment