Hi,
In my normal mapping implementation I currently calculate the TBN matrix in my vertex shader and pass it to the pixel shader.
There I take the normal map normal and using the TBN matrix transform it to world space, for lighting calculations.
All works fine.
Now I was wondering, in some implementations I've seen, people send the normal/binormal/tangent from the VS to the PS and build the TBN matrix in the pixel shader. Or somewhere in between, do the world transformation of those 3 vectors in the VS, send to PS and normalize there + build TBN matrix.
I've tried out both approaches but with no visible difference.
Can someone tell me why it would be beneficial to create the TBN matrix in a pixel shader instead of the vertex shader?
(the final normal is still for the pixel, because I transform the normal from the normal map in the pixel shader)
Note: when I calculate the TBN matrix in the VS, I also normalize the end resulting normal (normalize(mul(normalMapNormal, TBN)).