Working Not Working Half and Half

The first image shows a spotlight shining correctly on the floor. The second image shows the same spotlight but rotated 180 degrees.

The first is correct, the second is not.

The third image shows the light "half if and half out"

Can anyone understand what is happening here?

Normal mapping code:


vec3 CalcBumpedNormal()
vec3 Normal = normalize(normal0);
vec3 Tangent = normalize(tangent0);
Tangent = normalize(Tangent - dot(Tangent, Normal) * Normal);
vec3 Bitangent = cross(Tangent, Normal);
mat3 TBN = mat3(Tangent, Bitangent, Normal);

return normalize(TBN * (255.0/128.0 * texture2D(normalMap, texCoord0.xy).xyz - 1 ));

The model is Sponza by crytek. Loaded using Assimp Model Loader.

  • \$\begingroup\$ When you say the spotlight is "rotated 180 degrees", what exactly do you mean? Rotated around what axis? The lower picture looks like it might be getting some bit of spill from the spotlight. Maybe you could debug it by slooowly rotating the spotlight, to see at what point what you expect deviates from what you see... \$\endgroup\$ Commented Jan 19, 2015 at 18:37
  • \$\begingroup\$ Hi thanks for the reply. I am rotating the light using a Quaternion on the axis (0,1,0) by 180 (converted to radians). I will add another image that shows the light half in and half out (if you get what I mean). \$\endgroup\$
    – Nick
    Commented Jan 19, 2015 at 18:38
  • \$\begingroup\$ Image added to main post. \$\endgroup\$
    – Nick
    Commented Jan 19, 2015 at 18:42
  • \$\begingroup\$ I don't have the experience with opengl that I do with DirectX, but why are you calculating the tangent and bitangent? I believe that's where the problem is. Can't you just use the tangent0 and bitangent0 semantics? \$\endgroup\$
    – Peethor
    Commented Jan 20, 2015 at 6:15
  • \$\begingroup\$ Thanks for the info, however I have worked out what was wrong and will post it as an answer. \$\endgroup\$
    – Nick
    Commented Jan 20, 2015 at 9:09

1 Answer 1


The sponza model from crytek loads bump map from an .mtl file where I found the "bump" map for the flooring..

map_bump textures\spnza_bricks_a_diff.tga bump textures\spnza_bricks_a_diff.tga

If you take a look at these textures, they are clearly not normal / bump maps, and as the image name suggests; they are diffuse textures.

If you swap the two names with the corresponding normal texture that is supplied "spnza_bricks_a_ddn.tga" then the normals work correctly.



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .