- Home /
Question by
thorikawa · Sep 17, 2020 at 02:53 PM ·
animationshaderaugmented-realitydepth
Does ConvertDistanceToDepth in ARKitBackground.shader return the correct value?
It could be my misunderstanding, but I think ConvertDistanceToDepth function in ARKitBackground.shader returns the wrong value.
In ARKitBackground.shader of ARFoundation 4.1.0 preview7, that function looks like this:
inline float ConvertDistanceToDepth(float d)
{
// Clip any distances smaller than the near clip plane, and compute the depth value from the distance.
return (d < _ProjectionParams.y) ? 0.0f : ((0.5f / _ZBufferParams.z) * ((1.0f / d) - _ZBufferParams.w));
}
From my understanding, the depth value calculated from the far clip distance should be 1.0, but this function returns 0.5. Seems like this function returns half of the actual depth value. Am I wrong or is it intentional?
Comment