Problem with my shader could somebody take a look?

like the title says.  it's normal mapping using just the texture coords to get TBN matrix

vert


// inverse light radius ie.. 1.0/light radius;
uniform float u_invRad;

varying   vec3 g_lightVec;
varying   vec3 g_viewVec;

vec4 lightEye = vec4(0,0,2,1);

void main()
{
   gl_Position = ftransform();
   gl_TexCoord[0] = gl_MultiTexCoord0;
   vec3 tangent  = vec3(gl_TexCoord[0].x, gl_TexCoord[0].y, gl_TexCoord[0].z);
      vec3 normal  = vec3(  gl_Normal.x,   gl_Normal.y,   gl_Normal.z);
    vec3 binormal = vec3(cross(tangent, normal));
   mat3 TBN_Matrix = gl_NormalMatrix * mat3(tangent, binormal, normal);
   vec4 mv_Vertex = gl_ModelViewMatrix * gl_Vertex;
   g_viewVec = vec3(-mv_Vertex) * TBN_Matrix ;   
   vec4 lightEye = gl_LightSource[0].position;
   lightEye = gl_ProjectionMatrixInverse * lightEye;
//   vec4 lightEye = gl_ModelViewMatrix *  gl_LightSource[0].position;
   vec3 lightVec =0.02* (gl_LightSource[0].position.xyz - mv_Vertex.xyz);            
   g_lightVec = lightVec * TBN_Matrix;
}


//textcoords x=s=tangent
//textcoords y=t=binormal
//z=n=normal


frag


uniform sampler2D TextureUnit0;
uniform sampler2D TextureUnit1;
uniform sampler2D TextureUnit2; // height in alpha ch.

varying   vec3 g_lightVec;
varying   vec3 g_viewVec;

uniform vec2 cBumpSize;// = 0.02 * vec2 (2.0, -1.0);

void main()
{  
   float LightAttenuation = clamp(1.0 - dot(g_lightVec, g_lightVec), 0.0, 1.0);
   vec3 lightVec = normalize(g_lightVec);
   vec3 viewVec = normalize(g_viewVec);
   
   float height = texture2D(TextureUnit2, gl_TexCoord[0].xy).r;
   height = height * cBumpSize.x + cBumpSize.y;

   vec2 newUV = gl_TexCoord[0].xy + viewVec.xy * height;
   vec4 color_base = texture2D(TextureUnit1,newUV);
   vec3 bump = texture2D(TextureUnit0, newUV.xy).rgb * 2.0 - 1.0;
   bump = normalize(bump);

   //vec4 base = texture2D(Base_Height, newUV.xy);
   float base = texture2D(TextureUnit2, newUV.xy).r;
   
   float diffuse = clamp(dot(lightVec, bump), 0.0, 1.0);
   float specular = pow(clamp(dot(reflect(-viewVec, bump), lightVec), 0.0, 1.0), 16.0);
   gl_FragColor = color_base * gl_LightSource[0].diffuse
               * (diffuse * base + 0.7 * specular)
               * LightAttenuation;
    gl_FragColor.a = 1.0;               
   
   
}


Output

Can you describe your problem please?  :?  I don't have my mind reading cap with me.  XD

sorry, well the only way i get the normal map effect is if i set the normal map to textureunit0(suppose to be defussed)

Have a look here.  I do something similar in my glsl earth demo (mostly from the orange book)



http://www.jmonkeyengine.com/jmeforum/index.php?topic=2057.msg15946#msg15946

i think i need help getting the eyeVec is there anyway todo it with in glsl with out having todo that lwjgl thing thx.

renanse i copied your code over and replaced lightvec with gl_lightsource[0].position.xyz and half angle with gl_lightsource[0].halfAngle.xyz and tangent with gl_textCoord.xyz and it got all messed up.  Any thoughts? thanks

No sorry, I'm out of ideas.  :expressionless:

real quick b4 i give up on it i've read in like 3 places that tangent is = to S tangent and Binormal is = to T tangent i'm just wondering if S tangent and T tangent are just a float how to people get the T.x,T.y,T.z do they fill in the other 2 with 0's.