Again, this all looks like typical Z-fighting to me… and there’s really not much you can do about it, other than force specific triangles to land at slightly different depths…which I don’t think can be done in Common. You could probably try nudging things closer to the camera by changing the model transform ever so slightly in Z prior to drawing each tape, but I assure you that figuring out what “ever so slightly” should be can be a lesson in futility…since the depth buffer is not linear in OpenGL, and depths can/will vary drastically based on camera/target position and overall scene contents…basically anything that changes the near and far clipping planes will immediately cause different depth values to fall from frame to frame…so what once seemed like a good “nudge factor” may be way too much or way too little as the camera and scene change.
Rhino suffers from this (as do all 3D graphics engines) as well…Three coplanar objects will fight with each other:
But in this very specific case (specific types of planar objects), Rhino provides BringForward and MoveBack features that can be assigned per-object to get them display in the desired order…
But this only really works well because the objects are planar… However, curving, turning, bending surfaces that all fall on different depth values are always going to fight with other triangles that fall on those same depth values, and there’s currently no way to forcefully determine “who wins”
That being said… Your example above, where the wires are disappearing is probably because you’re drawing the wires first and then the meshes…and with depth writing OFF, the meshes are probably overwriting the wires where they intersect inside another mesh. If this is even possible (@dale can answer this), you could try flushing the pipeline after each specific draw and after each specific tape.
DrawMeshes();
FlushPipeline();
DrawWires();
FlushPipeline();
If that’s doable in Common, then it will force the meshes to get output before the wires, always (note: The order in which Rhino decides to output and flush things is based on cache size and cache overflow, so there’s no guarantee that just because you put a DrawA() before a DrawB(), that A goes out before B…which is why you need to flush things yourself if you want that type of guarantee…but again, I’m not sure if this can be done in Common.
And if you absolutely want all wires to show over all meshes, then I would draw all meshes first…then draw all wires.
for (int i = 0; i < count; i++)
{
DrawMesh(i);
FlushPipeline();
}
for (int i = 0; i < count; i++)
{
DrawWires(i);
FlushPipeline();
}
If FlushPipeline()
has no equivalent in Common, I’m pretty sure @dale can easily provide you something.
-Jeff