i am not even doing some lighting here. i just want the normals in worldspace to be displaced so they dont rotate with the objects.
Code:
float4x4 matWorldViewProj;
float4x4 matWorld;
struct vsIn
{
float4 position : POSITION;
float4 normal : NORMAL;
};
struct vsOut
{
float4 position : POSITION;
float4 normal : TEXCOORD0;
};
vsOut mainVS (vsIn In)
{
vsOut Out;
Out.position = mul(In.position,matWorldViewProj);
Out.normal = mul(In.normal,matWorld);
return Out;
}
float4 mainPS (vsOut In) : COLOR
{
return In.normal;
}
technique normals
{
pass p0
{
CullMode = CCW;
VertexShader = compile vs_2_0 mainVS();
PixelShader = compile ps_2_0 mainPS();
}
}
here is an image with untransposed normals, you see the rotated figure which of course has unfitting normals for the overall scene:
and here with transposed normals, i really dont get it:
