I originally had something like this :
cbuffer cbPerObject{ row_major float4x4 ViewProjectionMatrix;}...void Main_GS( ... ){ float4 v0 = mul( float4(input[0].Position, 1.f), ViewProjectionMatrix ); float4 v1 = mul( float4(input[1].Position, 1.f), ViewProjectionMatrix ); float4 v2 = mul( float4(input[2].Position, 1.f), ViewProjectionMatrix ); //subdivide ...}
I've tried something like this :
void Main_GS( ... ){ float4x4 TranslateBack = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1 }; float4x4 WVP_Matrix = TranslateBack * ViewProjectionMatrix; float4 v0 = mul( float4(input[0].Position, 1.f), WVP_Matrix ); float4 v1 = mul( float4(input[1].Position, 1.f), WVP_Matrix ); float4 v2 = mul( float4(input[2].Position, 1.f), WVP_Matrix ); //subdivide ...}
However it looks like I'm getting a scaling effect (it got smaller, but STILL in front of the other object). I'll post the PIX results in a bit but right now I just want to know if I'm doing something fundamentally incorrect.
Note: if I do the translation, concatenate that to the ViewProjectionMatrix in my C++ program and do it that way, it works just fine (it ends up behind the other object). However, I would like to do the translation in shader. Thanks.
[Edited by - 16bit_port on December 3, 2010 12:11:04 PM]