I’m trying to reconstruct position using linear depth by using this technique. From the article, he render linear depth by using z (in view space) divide by FarClip.
float4 DepthPS(in float in_fDepthVS : TEXCOORD0) : COLOR0
{
// Negate and divide by distance to far-clip plane
// (so that depth is in range [0,1])
// This is for right-handed coordinate system,
// for left-handed negating is not necessary.
float fDepth = -in_fDepthVS/g_fFarClip;
return float4(fDepth, 1.0f, 1.0f, 1.0f);
}
Urho already had function to render linear depth but using dot product of clipPos.zw and DepthMode.zw. As seen on this Transform.glsl
float GetDepth(vec4 clipPos)
{
return dot(clipPos.zw, cDepthMode.zw);
}
My question is: What actually the use of DepthMode? Is that any difference from that article implementation?