Jump to content
  • Advertisement
Sign in to follow this  
_Camus_

Nvidia HW Shadow Map tex2Dproj very dark shadow[SOLVED]

This topic is 2846 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, I'm using hardware shadow map using the stencil buffer surface as texture, writting 0 to rgb channels in the depth pass, later in normal pass I use tex2Dproj to get the filtered intensity of the shadow, that's ok, it works, but,
it is very very dark:

filters

As tex2Dproj gives me the filtered intensity, I can't controll the "darkness" of the shadow as if I do the PCF manually, the only values that I can change is D3DRS_DEPTHBIAS and D3DRS_SLOPESCALEDEPTHBIAS...

Some ideas?

Thanks

[Edited by - _Camus_ on September 29, 2010 7:52:10 PM]

Share this post


Link to post
Share on other sites
Advertisement
It should not. "non-shadowed parts" on your depth textures are already "full" white so adding to it will not change anything.

I guess you're blending shadows with your scene something like this:

float shadow = tex2Dproj(depth_samp, shadowTexCoord) + 0.2f;
float3 scene = tex2D(scene_samp, texCoord).rgb;
OUT.Color = float4(shadow * scene, 1.0);

Share this post


Link to post
Share on other sites
Hi, thanks for reply. I don't think you are taking into account that tex2Dproj returns values between 0 ... 1, without filter 0 or 1... The tex2Dproj function makes the depth comparison and the filtering by hardware, for just attenuate the "full color", if tex2Dproj returns 1.0f your suggestion will return 1.0f + 0.2f, the actual "full color" pixel will be multiplied by 1.2f. In fact that was one of my first attempts to correct this situation:

description of your image

Other approach:

float shadowamount = tex2Dproj( ShadowSampler, OtherCoords ).r;

if( shadowamount < .9 )
shadowamount+=.5f;

return shadowamount;


It "works", but makes other problem on the edges:

description of your image


That's why

Share this post


Link to post
Share on other sites
Solved, just map from 0 ... 1 to .5 ... 1

float shadowamount = tex2Dproj( ShadowSampler, OtherCoords ).r;

shadowamount/=2.0f;
shadowamount+=0.5f;
return shadowamount;


Thanks anyway:

description of your image

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!