簡體   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