PDA

View Full Version : TBN Matrix on back-side of triangle



Jan
06-26-2008, 11:41 AM
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.

innuendo
06-27-2008, 09:37 AM
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?

Eosie
06-27-2008, 10:10 AM
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.

Jan
06-28-2008, 04:02 AM
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.

Eosie
06-28-2008, 09:11 AM
I think that inverting all three vectors will do... technically nothing. :) 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.