dhpoware logo
navbar
home products source demos contact us
navbar navbar
box top left corner box top right corner
 
 
XNA 4.0 Shadow Mapping Demo.

This Windows XNA application demonstrates shadow mapping for a single directional light source. Simple shadow mapping produces very aliased shadows. This demo uses percentage-closer filtering with a 2x2 and a 3x3 kernel to soften the shadows to reduce their aliased appearance. The shadow mapping effect file that accompanies this demo targets shader model 2.0 cards. Consequently shadows still appear aliased even with percentage-closer filtering enabled. More advanced algorithms exist that produces far superior soft shadows. However such algorithms typically require shader model 3.0 or higher.

Note:
1. This demo requires shader model 2.0 or higher support.
2. This demo is provided in source form only. No pre built binaries are supplied.

screenshot

zip file Download source, assets, and XNA Game Studio 4.0 solution files.

Change History:

15 January 2011.
Initial release of demo for XNA Game Studio 4.0. The previous XNA Game Studio 3.0 version of the demo is no longer supported and is now only available upon request.

16 November 2008.
Initial release of demo for XNA Game Studio 3.0. The previous XNA Game Studio 2.0 version of the demo is no longer supported and is now only available upon request.

5 November 2008.
ShadowMapping.cs: Changed DEFAULT_SHADOWMAP_SIZE to 2048.

ShadowMapping.fx: The vertex shader now outputs the light space position's depth instead of the light space position to the pixel shader.

Lambert.fx: Added PS_ShadowMapLookup() function. Updated function PS_LambertWithShadowsPCF2x2() and PS_LambertWithShadowsPCF3x3() to use PS_ShadowLookup(). Fixed a bug in the PS_LambertWithShadowsPCF2x2() function where the wrong offsets were being used.

 
box bottom left corner content box box bottom right corner
logo logo