Hi,
I'm developing a shader that will display parallax occlusion mapping and some other effects. To have it working I need to use normals and tangents.
My vertices contain normal information in the NORMAL semantic (am I using correct word here ?) and the tangents are stored in TEXCOORD1.
Since the result is not what I expect, I display the normals and tangent values as the output color.
When the normals are displayed, I get what I expect: a gradient between various colors representing the normal values.
But when I do exactly the same thing with tangent values, there is not gradient and each face has a constant color (even if faces have different colors).
So it seems like something prevents the interpolation to occur when the tangent values are used.
I send the given values to pixel shader via COLOR1 or TEXCOORD2 and get the same result. I've also tried some other TEXCOORDs and COLORs.
The code is something like (copied from my code but without many other things):
struct VS_OUTPUT_DIR
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORD0;
float4 Diffuse : COLOR0;
float4 specular : COLOR1;
};
VS_OUTPUT_DIR vertexMain(in float4 vPosition : POSITION,
in float3 vNormal : NORMAL,
in float3 Tangent : TEXCOORD1,
float2 texCoord : TEXCOORD0,
float4 diffuse : COLOR0)
{
VS_OUTPUT_DIR Output;
...
Output.specular = float4(Tangent, 1);
return Output;
}
float4 pixelMain( VS_OUTPUT_DIR IN) : COLOR
{
...
return abs(IN.specular);
}
So any clue of what I could test or check would be very appreciated.
Note: I use Intel GPA tools to debug the shaders.
Thanks,
K.