I dunno, right now I am doing this kind of thing:
//Vertex Program.
OUT.ScreenUV = OUT.Position.xy/OUT.Position.w;
OUT.Depth = OUT.Position.zw;
//Fragment Program.
float2 sUV = 0.5 * ((IN.ScreenUV) + float2(0.5f, 0.5f));
sUV.y = 1 - sUV.y;
float partDepth = IN.Depth.x;
partDepth /= IN.Depth.y;
float sDepth = tex2D(DeepSample, sUV).r;
float4 dvSample = mul(float4(IN.ScreenUV, sDepth, 1), Projection);
float4 dpSample = mul(float4(IN.ScreenUV, partDepth, 1), Projection);
Now, outputting dvSample or dpSample yields a coloured pixel. As seen here, output of dvSample(
http://i43.tinypic.com/35kqy52.jpg ). To my limited knowledge of such things, that appears correct. If I use the following code:
float bah;
cTV_3DMATRIX miP;
m_Math->TVMatrixInverse(&miP, &bah, &m_Cam->GetProjectionMatrix());
shadeSoft->SetEffectParamMatrix("invProj", &miP);
//Fragment.
float4 dvSample = mul(float4(IN.ScreenUV, sDepth, 1), invProj);
float4 dpSample = mul(float4(IN.ScreenUV, partDepth, 1), invProj);
I get no pixel output, as such(
http://i42.tinypic.com/2qva5fo.jpg ).
The Microsoft example says:
float4 depthViewSample = mul( float4( input.ScreenTex, depthSample, 1 ), g_mInvProj );
float4 depthViewParticle = mul( float4( input.ScreenTex, particleDepth, 1 ), g_mInvProj );
So I am guessing I must use the inverse.