# Specular error - wrong TBN transformations

I have a problem with TBN matrices due to their transformation in world space.

In .cpp I am trasforming my worldMatrix based on rotation:

worldMatrix = DirectX::XMMatrixMultiply(worldMatrix, DirectX::XMMatrixRotationY(m_Camera->GetRotation().y / 3.14f));
worldMatrix = DirectX::XMMatrixMultiply(worldMatrix, DirectX::XMMatrixRotationX(m_Camera->GetRotation().x / 3.14f));


In .vs I do:

output.normal = mul(input.normal, (float3x3)worldMatrix);
output.normal = normalize(output.normal);

output.tangent = mul(input.tangent, (float3x3)worldMatrix);
output.tangent = normalize(output.tangent);

output.binormal = mul(input.binormal, (float3x3)worldMatrix);
output.binormal = normalize(output.binormal);


Which results in screen below. Problem occurs due to multiplying my TBN by rotation which badly transforms them and destroys my specular calculation (PBR Forward Renderer). How can I avoid that?

I have already tried splitting worldMatrix to worldMatrix and rotationMatrix but it didn't worked for me.

• You are in World Space, why do you rotate by the camera's rotation at all? That'd be a step for going from World Space to Eye Space. Unless I don't understand correctly and your World Matrix is for the transformation World Space -> Eye Space and you are in Eye Space? – Tare Jun 19 at 14:08