Sign in to follow this  

shadowmap render ok in ati card but not in nvidia card, why?

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

the same code in my program, implement at different cards(ati x1650 and geforce 7600gs),the front one is normal, another is failed...why??????? the depth surface is normal for both cards..

Share this post


Link to post
Share on other sites
thank you for everyone.

the vs & ps code is follow: (use D3DFMT_R32F format and zbuffer clear to 0xffffffff)

struct VSD
{
float pos : POSITION;
float2 uv : TEXCOORD0;
float4 vProjCoord : TEXCOORD1;
//Diffuse,fog
};

VSD vs_main(float4 pos : POSITION, float2 uv : TEXCOORD0)
{
VSD o = (VSD)0;
o.pos = mul(mWVP, pos);
o.uv = uv;
o.vProjCoord = mul(mTG0, pos);
... //some other code
return VSD;
}

float4 ps_main(VSD IN) : COLOR0
{
float4 vColor = tex2D( ColorSampler, IN.uv );
float fShadowTerm = (tex2Dproj( ShadowSampler, IN.vProjCoord) < IN.vProjCoord.z) ? 0.5f : 1.0f;
return (vColor * fShadowTerm);
}

I found the IN.vProjcoord.z always equivalent to 1, that is, the fShadowTerm value always equivalent to 1.0f, I think the IN.vProjCoord.z value is error...

if change the code
float fShadowTerm = (tex2Dproj( ShadowSampler, IN.vProjCoord) < IN.vProjCoord.z) ? 0.5f : 1.0f;
to
float fShadowTerm = (tex2Dproj( ShadowSampler, IN.vProjCoord).r
then the result is a projected shadow effect(shadow is showed).

why the IN.vProjCoord.z always 1??

Share this post


Link to post
Share on other sites
to MJP:
I'm test to divide vProjCoord.z/vProjCoord.w, but have a same result..

to Madoc:
sorry, the program in anthor computer at internal network.

Share this post


Link to post
Share on other sites

This topic is 3712 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.

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