• Advertisement

# Simple Shadow Map Sanity Check Please

This topic is 1666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi guys,

I'm working with simple shadow maps and can't see how they could ever be used, even with smoothing, but they are so I must be doing something wrong.

I have a pretty tight setup:

d3d_device->CreateDepthStencilSurface(1024,1024,D3DFMT_D24X8,D3DMULTISAMPLE_NONE,0,TRUE,&shadow_depth_surface,NULL);
d3d_device->CreateTexture(1024,1024,1,D3DUSAGE_RENDERTARGET,D3DFMT_R32F,D3DPOOL_DEFAULT,&shadow_texture,NULL);

D3DXMatrixPerspectiveFovLH(&light_projection,pi/4.0f,1.0f,1.0f,100.0f);

// The floor is 16x16 world units and the box height is 6 units.


Here is what happens with various depth bias values:

There is pretty much no way to tune it. I don't cull the back faces except for in the bottom-right image.

Does this look right to you ?

I know I should be using something like variance or exponential but I was having similar issues with those, either peter-panning or worse: massive self-shadowing.

Any help/info will be appreciated. Thanks.

#### Share this post

##### Share on other sites
Advertisement

The last two shots look fine to me. The artifacts will vanish as soon as you have proper lighting - since you only apply the shadow term for actually lit surfaces (N dot L > 0).

#### Share this post

##### Share on other sites

Hey unbird, I finally got it. No self-shadowing and no Peter Pans. It was like you said, I was applying the shadow term to everything and not just to (N dot L > 0), that was my problem all along. I setup a 3x3 filter too and it looks pretty good, so I'm on my way.

I'm going to try exponential now, you'll see me post again when I can't get it to work right :)

Thanks man.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### Popular Tags

• Advertisement
• ### Popular Now

• 9
• 11
• 21
• 10
• 14
• Advertisement