например так ( кусок из моего движка, в подписи есть ссылка на гитхаб, там можешь поглядеть на деферед с оптимизациями )
" float depth = tex2D( depthSampler, texcoord ).r;\n"
" float4 screenPosition;\n"
" screenPosition.x = texcoord.x * 2.0f - 1.0f;\n"
" screenPosition.y = -( texcoord.y * 2.0f - 1.0f );\n"
" screenPosition.z = depth;\n"
" screenPosition.w = 1.0f;\n"
" float4 p = mul( screenPosition, invViewProj );\n"
" p /= p.w;\n"
p - восстановленная позиция