when logarithmic depth is enabled, scene is rendered without z-fighting even setting the value of near is 0.01 and far is 10000000. But I found cesium uses dyamic range of near and far in each frame, the range just only cover the neareast object and the farthest object. I know it can get a best precision of rendering, but why do we do that?
Is there any article or blog to explain the reason or consideriation?
Hi @ligaofeng0901,
Here’s a blog post on logarithmic depth in CesiumJS. Does that help answer your question?
Thanks! I read it. I know Cesium uses multiple frustums in some case. I can understand the tight near and far in multi-frustums is necessary. But if we use logarithimic depth, is it necessary?
Hi @ligaofeng0901, you can turn off log depth if you prefer using Scene.logarithmicDepthBuffer
.
Hi @Gabby_Getz, is there a way to turn off dynamic near/far?
Let’s say I have set the near and far values to [0.1, 1000] using camera.frustum.near
and camera.frustum.far
. However, the actual near and far values used for rendering can sometimes be smaller than the specified range, for example, [200, 400], which can be obtained from viewer.scene.context.uniformState._currentFrustum
.
I understand that this dynamic adjustment is done for performance optimization and handling large-scale data, but it creates complications when I try to use depth externally. So, I’m wondering if there is a way to force the renderer to use a fixed near and far instead of calculating it at runtime?
Hi @xiasun, is this with log depth enabled or disabled?
log depth is enabled, if log depth is disabled then multiple frustums are used, and depth distribution becomes more complicated