Hi there,
I created two cubes with EdgesGeometry and LineBasicMaterial.
When the cubes overlap they both show the lines even when one cube is on top of the other.
It seems setting renderOrder does not do anything.
Any help is much appreciated!
Hi there,
I created two cubes with EdgesGeometry and LineBasicMaterial.
When the cubes overlap they both show the lines even when one cube is on top of the other.
It seems setting renderOrder does not do anything.
Any help is much appreciated!
Please see this codepen:
Note that both cubes have a color fill.
Just a remark: they have colour fill because you use r99 and incorrect value for vertexColors
in materials, this parameter became boolean in r114. If you use the latest release of the framework, you’ll get two black cubes.
Thanks! I adjusted THREE version to r152 and removed vertexColors. Issue remains. Any idea’s?
I’m not quite sure you can solve this without moving one of the objects slightly forward or backward, like this:
cube2.position.z = -0.0001;
or this:
cube2.position.z = 0.0001;
The reason is that PolygonOffset
only affects polygons (filled areas), but not lines. You can offset the faces of one of the cubes to overlap the edges of the orher, but it will also overlap its own edges.
If you absolutely need to have exactly matching positions, then make the edge as a texture, and apply PolygonOffset
to one of the cubes.
Oke thanks. I’m creating a particle like system with many cubes, so keeping track of all z positions is quit a hassle. I’m now recreating the border lines with plane geometry for each line. Not super efficient, but it does the job.