How can I sove the render anomaly?(two obejct could interfere each other when camera move)

I make a 3d model which have two objects.I find that they interfere each other , I think the problem is about render depth,but I can slove this.


3d model file : door.fbx (422.1 KB)

How can I sove this problem?
which key world should I sreach in google to find the Solution?

Hi !

Why do you want to render two objects overlapping ?
Is is because you want the outer part to be another material ?

Hi, thank at first.
Actally, two object has a few distance ,they also interface each other:

Does the front object have a depth ? Or is it just a plane ?
If this is a box with a very short depth, your issue is probably that the two opposite faces of the box are interfering, try to increase the depth.

They have a depth. If I increase the depth , they don’t interfere each other until camera move very far.
I make two new box,and they will interfere each other if camera move very far.

I think that object depth,scale , camera position are the influence factor.
I want to find the principle or the keyword to study it , and try to slove or avoiding such problem.

I can’t help you more sorry…
I don’t know why the faces interfere again when the camera is farther. I guess it comes from how the renderer sorts the faces, it looks like depth sorting becomes imprecise with the distance.
I will let a more experienced user answer.

What you see is so called z-fighting which is a precision related issue of the depth buffer. The following fiddle demonstrates this effect very noticeable (just move the camera around):

https://jsfiddle.net/5s7evdgk/

A 3D engine can’t solve such issue automatically for you. You can try the following things to mitigate it:

  • Avoid overlapping faces which can be achieved during the design phase
  • Keep your view frustum as tight as possible (avoid large deltas between near and far)
  • Try to disable depthWrite for certain materials like in this fiddle: https://jsfiddle.net/5s7evdgk/1/
  • Usage of logarithmic depth buffer might also help
4 Likes

Thank you very much.

@Mugen87 Why within the same scene with the same camera frustum, z-fighting occurs only when the mesh is far from the camera ? ( as shown in OP’s last video )

The precision in the depth buffer is higher at the near plane and worse towards the far plane. One can also say the precision is non-linear due to the perspective projection.

1 Like