float LinearEyeDepthOrth(float z)
{
// uniform float4 _ProjectionParams;
// x = 1 or -1 (-1 if porject is flipped)
// y = near plane
// z = far plane
// w = 1/far plane
// http://www.derschmale.com/2014/03/19/reconstructing-positions-from-the-depth-buffer-pt-2-perspective-and-orthographic-general-case/
// Z_view = Z_near + Z_ndc(Z_far - Z_near)
return _ProjectionParams.y + z * (_ProjectionParams.z - _ProjectionParams.y);
}
float3 ReconstructCSPosition(float2 S, float z)
{
float linEyeZ = LinearEyeDepthOrth(z);
//return float3(( ( S.xy * _MainTex_TexelSize.zw) * _ProjInfo.xy + _ProjInfo.zw) * linEyeZ, linEyeZ);
return float3(( ( S.xy * _MainTex_TexelSize.zw) * _ProjInfo.xy + _ProjInfo.zw), linEyeZ);
...
}
这个变化后,在你的正交相机中它会正确地呈现。