rapidobj
rapidobj copied to clipboard
Triangulate causing missing triangles?
Hi,
Trianglulate used on this file appears to be causing triangles to go missing:
https://murena.io/s/Z6MSrKkCf2Mr72Y
Screenshot showing some of the missing triangles outlined in red here:
If I skip the triangulate step and do my own simple triangulate while loading (which effectively just treats all faces like a triangle fan), everything loads correctly.
[edit] Ok, it looks like triangulate is flipping some triangles. If I force the material to be double sided, the missing triangles re-appear.
Changing lines 6983-ish to this (which basically just duplicates my loader code) fixes the problem with this model:
dst->indices[idst + 0] = index0;
dst->indices[idst + 1] = index1;
dst->indices[idst + 2] = index2; // d02_is_less ? index2 : index3;
dst->indices[idst + 3] = index0; // d02_is_less ? index0 : index1;
dst->indices[idst + 4] = index2;
dst->indices[idst + 5] = index3;
Not sure what d02_is_less is supposed to do though so probably not that simple. [/edit]
Bye, Mark
Thanks for the report and investigation. I will take a closer look, probably this weekend.