Nvidia HW Shadow Map tex2Dproj very dark shadow[SOLVED]

Started by
4 comments, last by _Camus_ 13 years, 6 months ago
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]
Advertisement
why dont you just:
tex2proj(depth_samp, texCoord) + 0.2f;
Because the non-shadowed parts will be brighter.
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);
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
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

This topic is closed to new replies.

Advertisement