# ATI vs. Nvidia Issue

This topic is 3532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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.

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.

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).

##### 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 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.