Sign in to follow this  
_Camus_

Nvidia HW Shadow Map tex2Dproj very dark shadow[SOLVED]

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

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