Jump to content
  • Advertisement
Sign in to follow this  
ctuo

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

This topic is 3930 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
Advertisement

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
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
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
You need to divide vProjCoord.z/vProjCoord.w before comparing to the value in your shadow map. tex2Dproj is doing that division for you in the texture lookup.

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
Apologies if you misunderstood me, my post was nothing more than a little sarcasm aimed at ATI.

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!