Closed syzdev closed 2 years ago
Z-fighting occurs when triangles overlap, or are too close together for the amount of precision in your depth buffer. The depth buffer is configured by camera.near
and camera.far
properties. This viewer sets those properties automatically based on the input model — so that .near
is as high as possible and .far
is as low as possible, without clipping the model. Usually you can choose these properties based on the scale of your scene pretty quickly.
@donmccurdy
I tried to adjust the two parameters camera.near
and camera.far
, but when the value of camera.near
is too large (e.g. from 0.1 to 10), when the camera is close to the model, the display of the model will be incomplete, and the Z-fighting problem has not been solved.
I am not sure whether there is something wrong with my code or other problems. I finally solved my Z-fighting problem by using material.polygonOffset
.
When solving the problem, I collected some information and share it below, hoping to be helpful to everyone.
camera.near
and camera.far
parameters to solve the Z-fighting problem.
For the same model, there is a Z-fighting problem in the model after I use the native GLTFLoader, but there is no such problem after using this repository. After checking the source code, I didn't get any inspiration. Could you please describe the problem in detail. Thanks.