Trying to understand tangent/ worldspace,
Members - Reputation: 4370
Posted 29 January 2014 - 05:04 PM
I'm trying to fully understand my normal mapping implementation (HLSL), but there's one thing I just cant figure out.
- I have light vectors in worldspace
- before I used normal mapping, I believe my lighting calculations were done in world space
- in my normal mapping vertex shader I make a matrix for transforming coordinate space, using normal, binormal and tangent vectors
- in the pixel shader I retrieve the normal map normal and multiply it by the matrix above
I believe this means my normalmap normal is transformed from tangent space to world space, so all my lighting calculations are in 1 coordinate space: worldspace.
So far so good.
But... Why is the matrix I described almost always called worldtotangentspace, when it's used to transform tangent space normal map normals into world space? (so shouldn't it be tangenttoworldspace)
Is my theory/ are my assumptions right or am I overseeing something?
Ps: the matrix is formed by multiplying normal, binormal and tangent with the objects world matrix
Crealysm game & engine development: http://www.crealysm.com
Looking for a passionate, disciplined and structured producer? PM me