Solved:If cameradistance to the scene is too far,can it still render correctly

camera:fov=3, PerspectiveCamera
meshA(height=4,depth=0.5,standardMaterial),meshB(height =2,depth=0.5,standardMaterial);
MeshA should theoretically completely cover MeshB, but in reality, the render result may flicker and some fragments may render the material of MeshB.

Is it because the distance between the camera and the center of the scene is too far when I use a camera with fov=3,so the depthTest could be inaccurate.
(Because I need to render objects in the scene in the correct size even with fov=3,so the distance could be 30000 and more)

1 Like

The amount of precision you get in the depth buffer is dictated by the camera.far - camera.near

so… if you want like 30000 far draw distance… you might want a near like .1 or .5

If you need REALLY big draw distance, there is also logarithmicDepthBuffer which can render super far distances but still get good zbuffer precision.

thanks,i open logarithmicDepthBuffer,and adjust the near,it worked!

1 Like

Nice! Things to be aware of with logarithmicDepthBuffer… it can affect some shaders and special effects that expect the classical depth buffer formation, so if you see issues with new code that you add that is shader related or interacts with the depth buffer, keep this in mind. Glad you got it working! It’s pretty awesome and a lot of apps like space based games or simulations use logdepthbuffer for the same reasons you are.