Corrail

04-10-2004, 06:09 AM

Hi all!

I've got a problem with a tangent space bump mapping shader. After a lot of pseudo-debugging I noticed that the problem is in my vertex-shader. I different values for my light and my view vectors on ATI Catalyst 4.4 and NV ForceWare 57.10.

Here's my vertex shader source:

attribute vec3 a2v_Normal;

attribute vec3 a2v_Tangent;

attribute vec3 a2v_Binormal;

attribute vec2 a2v_TexCoord;

varying vec3 v2f_LightVec1;

varying vec3 v2f_LightVec2;

varying vec3 v2f_ViewVec;

varying vec2 v2f_TexCoord;

void main()

{

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

mat3 TBN_Matrix;

TBN_Matrix[0] = gl_NormalMatrix * a2v_Tangent;

TBN_Matrix[1] = gl_NormalMatrix * a2v_Binormal;

TBN_Matrix[2] = gl_NormalMatrix * a2v_Normal;

Space

vec4 Vertex_ModelView = gl_ModelViewMatrix * gl_Vertex;

v2f_LightVec1 = (TBN_Matrix * vec3(gl_LightSource[0].position - Vertex_ModelView));

v2f_LightVec2 = (TBN_Matrix * vec3(gl_LightSource[1].position - Vertex_ModelView));

v2f_ViewVec = TBN_Matrix * vec3(-Vertex_ModelView);

v2f_TexCoord = a2v_TexCoord;

}Thanks a lot for every help!

I've got a problem with a tangent space bump mapping shader. After a lot of pseudo-debugging I noticed that the problem is in my vertex-shader. I different values for my light and my view vectors on ATI Catalyst 4.4 and NV ForceWare 57.10.

Here's my vertex shader source:

attribute vec3 a2v_Normal;

attribute vec3 a2v_Tangent;

attribute vec3 a2v_Binormal;

attribute vec2 a2v_TexCoord;

varying vec3 v2f_LightVec1;

varying vec3 v2f_LightVec2;

varying vec3 v2f_ViewVec;

varying vec2 v2f_TexCoord;

void main()

{

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

mat3 TBN_Matrix;

TBN_Matrix[0] = gl_NormalMatrix * a2v_Tangent;

TBN_Matrix[1] = gl_NormalMatrix * a2v_Binormal;

TBN_Matrix[2] = gl_NormalMatrix * a2v_Normal;

Space

vec4 Vertex_ModelView = gl_ModelViewMatrix * gl_Vertex;

v2f_LightVec1 = (TBN_Matrix * vec3(gl_LightSource[0].position - Vertex_ModelView));

v2f_LightVec2 = (TBN_Matrix * vec3(gl_LightSource[1].position - Vertex_ModelView));

v2f_ViewVec = TBN_Matrix * vec3(-Vertex_ModelView);

v2f_TexCoord = a2v_TexCoord;

}Thanks a lot for every help!