Question: I'm implementing normal mapping and was trying different techniques of doing that. All seemed not to give me a correct result (e.g. the normals point in weird directions). To find the problem, I broke everything down to the simplest possible solution, but I cant find the problem. 

Here is a picture of my scene outputting only the world-space normals: 

[![enter image description here](https://i.stack.imgur.com/wJRep.png)](https://i.stack.imgur.com/wJRep.png)

And here is the scene outputting the transformed normals with the normal map: 

[![enter image description here](https://i.stack.imgur.com/7fmag.png)](https://i.stack.imgur.com/7fmag.png)

As you can see, the normals are not pointed the way they should be (green should be to the right, for example).
Here is the way I caluclate the TBN-Matrix (I know, its not the correct way of doing that, but I tried the "correct" ways too).

```
vec3 tangent = cross(worldspaceNormal, vec3(0,0,1));
vec3 biTangent = cross(tangent, worldspaceNormal);
mat3 tbn = mat3(tangent, biTangent, worldspaceNormal);

vec3 map = texture(normal, texCoord).rgb;
map = 2 * map - vec3(1);

outNormal = vec4(tbn * map, 0.0);

```

The `worldspaceNormal` is just the normal of the surface multiplied by the model-matrix, with w-component `0.0`, of course.

Answer: 
Found the problem. The TBN apparently needs to be constructed as the following: `mat3(worldspaceNormal, biTangent, tangent);`. So tangent and normal need to be flipped. Don't know why, maybe a Vulkan thing.
The normal matrix should be the transpose inverse of the modelview matrix. You can't simply multiply with model-matrix. Hope this clears your problem.