hi guys,
I am working on a HLSL shader that requires me to transform vertex postion into Worldspace first, and then transform it into screen space with ViewProjection matrix because I need to offset the vertex in Worldspace.
But I got this strange problem when I do this, the whole mesh seems to be transformed into some unknown place I can’t find. It would always happen even I do absolutely nothing after the first tranformation :?:
I am not farmiliar with the matrix passed from Max, any idea is appreciated :):
P.S
here is the piece of the shader code. I only put the related part here:
float4x4 WorldViewProj : WORLDVIEWPROJ;
float4x4 World : World;
float4x4 ViewProj : VIEWPROJ;
// position get directly transformed into screen space. It works with no problem
Out.Pos = mul(float4(IN.Pos,1),WorldViewProj);
// but if I transform them into world space first, then to screen space. the mesh is immediately gone after this:
float4 worldPos = mul(float4(IN.Pos,1),World);
Out.Pos = mul(float4(IN.Pos,1),ViewProj);