Overlapping triangles affecting indices? [SOLVED]

Hello!

I’ve been working on some Mesh Utilities for the past couple days and I’ve been encountering a certain issue that I can’t seem to make any sense of. The following screencap shows a quad whose front face is on the left-side (game view) and back face on the right (scene view).

NegativeMiserableDipper

Notice I have implemented something that alters the triangle index ordering in the screencap above (so, the index ordering for each triangle retains a clockwise order).

However, even with the indices being reordered to retain a clockwise sequence the reoriented triangle seems to render incorrectly on the backside of the quad, which appears to be rendering a set of vertices in a counter-clockwise fashion.

So, my question is: how can the same mesh render one triangle using indexes in a clockwise order and another in an counter-clockwise order? Is this something at Unity’s level or lower?

Any and all information would be greatly appreciated! Thanks a lot!

I can assure you this isn’t the case. Use Debug.Log() or some other mechanism to study the coordinates and I am confident you will find the order of the verts is wound incorrectly from the view where it disappears yet should be present.

It might be hard to see, but the coordinates and the triangle indices are displayed in the upper-left corner and this does appear to be the case. I’m using GUI labels to render these using the exact values I’d be printing out via Debug.Log/LogFormat.

Any other ideas?

Well, regardless of my screen shot – it looks like all my time spent on the debug output I realized I never assigned the re-oriented triangle indices to the mesh. So, the GUI debug output was correct, but I hadn’t assigned the triangles after changing the indices.

Once I did that it rendered as expected. Two triangles overlapping all on the frontside.

CrispMajorFlycatcher

Thanks for making me take another careful look through everything, @Kurt-Dekker !! Sometimes that’s all it takes.

1 Like