it doesn't really looked bump mapped or dose it? is there anyway to enphasive it (bump mapping with normal map)
bump.vert
varying vec2 texCoord;
varying vec3 direction;
varying vec3 halfVec;
uniform vec3 CAMERA_POSITION;
uniform vec3 lightPos;
void main()
{
// Transform to clip space and save texture coord.
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
texCoord = gl_MultiTexCoord0.xy;
// Calculate light direction.
vec3 lightDir = normalize(vec3(lightPos-gl_Vertex.xyz));
// Save a copy of the s tangent which was sent through the color (glColor3f).
vec3 color = gl_Color.xyz;
// Calculate the binormal as the cross between tangent and normal.
vec3 binormal = cross(color, gl_Normal);
// Create the matrix used to convert the light direction to texture space.
mat3 tbnMatrix = mat3(color, binormal, gl_Normal);
// Convert light direction to texture space.
direction = tbnMatrix * lightDir;
halfVec=direction+CAMERA_POSITION;
}
bump.frag
varying vec2 texCoord;
varying vec3 direction;
varying vec3 halfVec;
uniform sampler2D TextureUnit0;
uniform sampler2D TextureUnit1;
void main()
{
vec3 decalCol = texture2D(TextureUnit0, texCoord).xyz;
// Most image editors will save color values in the 0 to 1 (0 to 255).
// But our normals can be from -1 to 1 (-255 to 255) so we must expand it out.
// From its clamped version like so...
vec3 normal = 2.0 * (texture2D(TextureUnit1, texCoord).rgb - 0.5);
vec3 lightDir=normalize(direction);
// Normalize the light direction on a per pixel level.
vec3 halfAngle=normalize(halfVec);
float diffuse = dot(normal, lightDir);
float specular = dot(normal, halfAngle);
float specFactor = specular * specular;
specular = specFactor * specFactor;
specFactor = specular * specular;
// To make things simple I hardcoded material values but we could have passed
// these as uniform parameters.
vec3 dMat = vec3(0.8, 0.8, 0.8);
vec3 sMat = vec3(0.8, 0.8, 0.8);
float ambient = 0.4;
// Combine the decal with the bump value.
gl_FragColor.xyz = decalCol*diffuse;