Sign in to follow this  
Endemoniada

Simple Shadow Map Sanity Check Please

Recommended Posts

Endemoniada    430

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:

 

awu1.jpg

 

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


Link to post
Share on other sites
unbird    8336

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


Link to post
Share on other sites
Endemoniada    430

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


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this