Sign in to follow this  

ATI vs. Nvidia Issue

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

So, I have set up an HLSL effect. It worked great on my NVidia card but not so great on the ATI card. I think I found the issue with my vertex declaration but then I ran into, yet, another issue between ati and nvidia. For more background, I'm using a normal mapping shader that takes in: float3 posL : POSITION0, float3 normalL : NORMAL0, float3 tex0 : TEXCOORD0, float3 tangentL : TANGENT0, float3 binormalL : BINORMAL0 as parameters. My Vertex Declaration is:
Dim elems(5) As VertexElement
elems(0) = New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0)
elems(1) = New VertexElement(0, 12, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0)
elems(2) = New VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0)
elems(3) = New VertexElement(0, 36, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Tangent, 0)
elems(4) = New VertexElement(0, 48, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.BiNormal, 0)
elems(5) = VertexElement.VertexDeclarationEnd

'With a vertex declaration of
Private Structure terVertTBN
	Public p As Vector3
	Public n As Vector3
	Public tu As Single
	Public tv As Single
	Public tw As Single

	Public tangent As Vector3
	Public binormal As Vector3
End Structure
Private terVertFmtTBN As VertexFormats = VertexFormats.Position Or _
 VertexFormats.Normal Or VertexFormats.Texture3 Or _
 VertexTextureCoordinate.Size3(0) Or VertexTextureCoordinate.Size3(1) Or _
 VertexTextureCoordinate.Size3(2)


That fixes the original issue on the ATI card but creates a weird shading effect. Fortunately, and thankfully, the ATI and nVidia cards function the same way with this setup. So, I changed some things to make it work on my nVidia.
Dim elems(5) As VertexElement
elems(0) = New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0)
elems(1) = New VertexElement(0, 12, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0)
elems(2) = New VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0)
elems(3) = New VertexElement(0, 36, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 1)
elems(4) = New VertexElement(0, 48, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 2)
elems(5) = VertexElement.VertexDeclarationEnd


So... boom... works on nVidia. Woot! Take it to my ATI card and it has the original problem I was trying to fix in the first place. I'll post some screenshots of what I'm talking about in a minute.

Share this post


Link to post
Share on other sites
Ok, here are the images...

This first one is the original issue. The ground texture would 'flicker'... but only the normal map. What's worse is, this would only occur on the ATI cards, not the nVidia.

Original Issue


This is the image of what it looked like after my first remedy to the problem. Notice the squares or blocks of area on the terrain that are not normal mapped. This occurs for both nVidia and ATI cards.

Strange Issue where both cards worked the same

After my last change, the nVidia card looks like this which is correct. So I thought all would be good when I took it to the ATI card. Nope. The ATI card now looks like the original error (the first image).

What it is supposed to look like

Share this post


Link to post
Share on other sites
Your first post seems to be missing the first version of code (the one causing the first problem).

Anyway, one thing which doesn't look right is that your shader input is using the tangent and binormal semantics, but your vertex declaration uses the texcoord semantics for these values.

Share this post


Link to post
Share on other sites
The original code is the vertex declaration was not defined. I was using only vertex formats... which oddly enough, worked fine on nVidia but not on ATI.

The result of the original code is the first image (with the flicker). But again, this is only on ATI Cards, not on nVidia.

I added the vertex declaration which resulted in my second image on both nVidia and ATI cards. This vertex declaration is the binormal and tangent defined.

I then changed the vertex declaration to all texture coordinates which fixed the problem on nVidia cards but the ATI cards went back to the original issue.

Share this post


Link to post
Share on other sites

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