Lines mesh rendered over other meshes

I am rendering three lines as coordinate axis.

While moving the camera i notice those lines being rendered in front of the meshes in the scene.

In the next image you can see the red line, as well as the green line are occluded by the wall mesh. The blue line is overlapping the mesh for like 1 meter.


Maybe this bug only occurrs when one face is in between the lines mesh and the camera? Is this even a bug? Have you experienced similar when using the lines mesh? ( I am instanciating lines from BABYLON.LinesBuilder.CreateLines)

Greetings,
Mamu

Hey Mamu, do you mind providing a repro?

I did here and whilst doing so i discovered something kind of answering my question.

It seems to depend on the dimensions of the line. To create the illusion of infinite axis i set their values -100000 to +100000, which is 200000 units in length.

Still i am interested in why that happens. Any idea @Deltakosh?

When you use that large values, the precision is reduced and then depth buffer is not precise enough :frowning:

2 Likes