## 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);

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 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 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.