How to convert tangent space normal to world space ?

kumayu

Newcomer
As Far as I know,
ReflectColor = TexCUBE( EnvCubeMap , ReflectDir );
The ReflectDir used here need to be in World Space?

We can Get ReflectDir this way...
float3 ReflectDir = normalize(2.0 * NdotL * Normal.xyz - LightDir.xyz);
So I need Normal vector in World Space , too.

But my normal map is Tangent Space,
Before we can use it to get ReflectDir,
We need to convert normal to world space.
Question is:
How to convert tangent space normal to world space ?
 
You need a tangent/binormal basis to rotate the tangent space normal map back into world space.
Usually defined at the vertex level based on vertex uv and normal, and interpolated across the surface of the triangle.
 
if you have a tangent space normal, the world space normal is:

Code:
float3 ws_normal = tangent * ts_normal.x + binormal * ts_normal.y + normal * ts_normal.z;

where tangent, binormal and normal define the tangent space of the polyogon.
 
Freely ignore this tangent, but I can't help remembering when "beginner's questions" were all about texel fillrates and driver problems. Looking at this thread for example... maybe we need a Dropout's Questions subforum. ;)

Okay, kumayu, just consider this a free bump. (Well, for the good answers you got. ;))
 
Back
Top