Sign in to follow this  
ctuo

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

Recommended Posts

ctuo    122
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
Madoc    146

You MUST have introduced some serious bugs in your code, I don't see how else the ATI card could be working properly.

Share this post


Link to post
Share on other sites
MJP    19754
Determining the cause of your problems is difficult without knowing the details of your implementation. My first instinct is that you're rendering your shadow map to a texture format not supported by one of those GPU's.

Share this post


Link to post
Share on other sites
ctuo    122
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
ctuo    122
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

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