Jump to content
  • Advertisement
Sign in to follow this  
MegaPixel

My Shadow Is too bright !?

This topic is 2953 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

I'm projecting a shadow map from a spot light, but the shadow that results from

this projection is really too bright. Could it be that the far/near plane values

are too low or too hight ?


//Shadow Map apply
//we use hardware shadow map (nvidia). so we get PCF in hw.
float3 WSPos = mul(float4(vPositionVS.xyz,1),viewMatrixInv).xyz;
float4 hpos = mul(float4(WSPos,1),mul(light.mLightMatrix,light.mPrjMatrix));
float4 SSCoords = mul(hpos,matTex);
float shadowOcclusion = tex2Dproj(shadowMapTextureSamplerD3D,SSCoords).x;
//



Here is a screenshot: http://img265.imageshack.us/img265/2377/shadowst.jpg

Why the shadow is so light ?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
//we use hardware shadow map (nvidia). so we get PCF in hw.
Is this true, or are you just projecting raw depth values onto the scene?

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
Quote:
//we use hardware shadow map (nvidia). so we get PCF in hw.
Is this true, or are you just projecting raw depth values onto the scene?


As I'm using hardware shadow map from nvidia I would expect for the shadow

depth test to happen during the PCF. Otherwise I'll try to do everything by hand ... I mean PCF is done in hardware therefore the shadow depth test is performed 4 times for the neighbor and the returned value is the interpolated value from the previous 4!

I use R32F floating point shadow buffer if that can matter.

Share this post


Link to post
Share on other sites
I haven't worked with recent NVidia hardware, but I thought that the hardware PCF only happened with Z-buffer texture formats. With R32F, it doesn't know that you're dealing with Z values, so it's probably just giving you back the actual Z values, rather than comparison results.

Share this post


Link to post
Share on other sites
Quote:
Original post by osmanb
I haven't worked with recent NVidia hardware, but I thought that the hardware PCF only happened with Z-buffer texture formats. With R32F, it doesn't know that you're dealing with Z values, so it's probably just giving you back the actual Z values, rather than comparison results.


Oh ok I see! I think, if it's not a big performance impact, to use PCF

implemented by hand. Actually I'm just using a nearest neightbor filter (i.e. I

sample the shadow map 4 times then I average the results even though I guess it's not the best way). What kind of improvement I can do from now on ?
Plus, currently I'm only handling directional and spot light shadow maps. Could you point me on the right direction if I wanna search on how to best implement shadow map for point lights? I've read some stuff, like talking about using a regular cube map to store the depth or dual paraboloid but I don't know if the latter is suitable in the case of a deferred renderer.

Thanks very much in advance.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!