繁体   English   中英

深度缓冲区的绝对距离

[英]Absolute distance of depth buffer

1.如何找到深度缓冲区的绝对距离?

2.如何计算depth_bias和depth_scale的实际值? 我尝试过的建议:

glGetDoublev(GL_DEPTH_BIAS,  &depth_bias);  // (Returns only 0.00)
glGetDoublev(GL_DEPTH_SCALE, &depth_scale); // (Returns only 1.0 )

在我的代码中,我声明了此值-zNear,zFar。 我决定给它们提供什么值,以便它们不是const.so距离取决于ZFAR,ZNEAR和depthBufferValue(逐像素变化)–

Distance = NearClipPlane + DepthBufferValue * (FarClipPlane - NearClipPlane);

近/远裁剪平面值用于构造投影矩阵。 您应该能够在代码中看到它们。 例如:

glOrtho(left, right, bottom, top, nearVal, farVal); // <-- Last two values here
gluPerspective(fovy, aspect, zNear, zFar); // <-- Last two values here

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM