Lights in the shadow

Hi, i have a doubt about my shader. I use it for bump mapping but there is something i think is wrong. I’d like to remove all the reflections in the shadow. You can see the picture, sorry if i’m not able to explain better.

http://img651.imageshack.us/img651/5781/moonbc.png

The question is: i should change the normal map or there is something wrong in shader or in my code? I post the shader too:

Vertex:


uniform vec3 fvLightPosition;

varying vec2 Texcoord;
varying vec3 LightDirection;
   
attribute vec3 rm_Tangent;

void main( void )
{
   gl_Position = ftransform();
   Texcoord    = gl_MultiTexCoord0.xy;
       
   vec3 fvLightDirection = fvLightPosition;
     
   vec3 fvNormal         = normalize(gl_NormalMatrix * gl_Normal);
   vec3 fvTangent        = normalize(gl_NormalMatrix * rm_Tangent);
   vec3 fvBinormal       = cross(fvNormal, fvTangent);  
   
   LightDirection.x  = dot( fvLightDirection.xyz, fvTangent );
   LightDirection.y  = dot( fvLightDirection.xyz, fvBinormal );
   LightDirection.z  = dot( fvLightDirection.xyz, fvNormal );
   
}

Fragment:


uniform vec4 fvDiffuse;
uniform vec4 fvAmbient;

uniform sampler2D baseMap;
uniform sampler2D bumpMap;

varying vec2 Texcoord;
varying vec3 LightDirection;

void main( void )
{
 // fetch normal from normal map, expand to the [-1, 1] range, and normalize
  vec3 lightVec = normalize(LightDirection);
  
  vec3 normal = 2.0 * texture2D (bumpMap, Texcoord).rgb - 1.0;
  normal = normalize (normal);

  // compute diffuse lighting
  float lamberFactor= max (dot (lightVec, normal), 0.0) ;
  
  vec4 diffuseMaterial =texture2D (baseMap, Texcoord);	  
  gl_FragColor =	diffuseMaterial * fvDiffuse * lamberFactor ;  	
   
}

The normal-map looks like it doesn’t have mip-mapping.
In any case, you could also try multipling lamberFactor by a similar dot-product, which ignores bump-mapping (is simple per-pixel shading, based on fvNormal and fvLightDirection.xyz).

LOL you’re right. I must set mipmaps. Now it works :stuck_out_tongue:

Thank you! :wink: