TBN Matrix on back-side of triangle

Hi there

Small question: When i don’t do back-face culling and am looking on the back-side of a triangle, and i want to rotate the light vector into the tangent-space of that triangle, i do need to invert the normal of the triangle.

The question is, do i also need to invert the tangent and bi-tangent or do they stay the same, when i use the same texture-coordinates to sample from the normal-map ? My data is too fuzzy to see whether one or the other is correct, so i thought i’d ask people who know for sure.

Thanks,
Jan.

Why? Have you any reasons for such actions ?
You just revert normal. You dont change texcoord, do you?

It depends…

If you revert only a normal, shading will look like the normal map was generated using an inverted height map which is the desired behavior in most cases.

Ah, interesting to know. I think i don’t want it to look inverted on the back-side, so i will invert all three vectors.

Thanks for clearing that up,
Jan.

I think that inverting all three vectors will do… technically nothing. :slight_smile: Imagine a TBN matrix - if you invert a normal, you’ll end up with a negative determinant of the matrix, therefore it will look inverted. Next, if you invert both a tangent and a bitangent (AKA binormal), the determinant will remain unchanged (negated twice) so it will still be inverted. If I were you, I would invert either the tangent or the bitangent, not both.