I've followed a tutorial that uses the XNA 4 SkinnedEffect for my animation on that model . How can i also make a shadow for my SkinnedEffect model ?
Shadows can be a thorny subject. There are many ways to create shadows in games, broadly split in to 3 techniques: Stencil shadows Texture space shadow maps/light maps Shadow buffers
Stencil shadows give hard, sharp shadow edges and use the stencil buffer and geometry extruded from every triangle (or the silhouette edges, if you can find it quick enough) of a mesh. http://www.gamedev.net/page/resources/_//183/403/the-theory-of-stencil-shadow-volumes-r1873 here's a good page describing the technique in more detail.
Texture space shadow maps or light maps are typically created off-line and stored as a static texture. Generally speaking, these are not dynamic although there are some interesting techniques that can generate light maps in real-time.
Finally, real-time shadow buffers are the most commonly used techniques. These methods all render the scene again in an off-screen buffer from the light's point of view, storing depth values instead of colours. This is called the 'shadow buffer'.
When rendering the scene from the camera's point of view, every pixel is reverse transformed (in your shader code) into the shadow buffer's space and checked to see if the depth of the pixel being written is deeper than the depth stored in the shadow buffer. So far, so good. It gets more complicated when you realise that there isn't enough resolution in the shadow buffer to give good shadows in most cases. There are many techniques to try and increase the effective resolution of your shadow buffer. These are either view space distortion techniques (Perspective, Light space perspective, Trapezoidal) or multi-shadow buffer techniques such as cascaded shadow maps http://msdn.microsoft.com/en-us/library/ee416307%28v=vs.85%29.aspx
From bitter, bitter experience, I would avoid distortion techniques -they just don't work for all situations and introduce nasty biasing problems when sampling from the shadow map. You will spend months trying to sort out the fiddly edge cases whilst your boss (if you have one) becomes ever less patient. Use cascaded or split buffer shadow maps where the view frustum is split into smaller chunks which have their own shadow map. Then use simple bounding volumes to zoom in on shadow casters and receivers. This is the technique that 90% of games I see use.
Good luck, the devil is in the details but there's lots of help out there. Hopefully this will give you the pointers you need.
|show 3 more comments|