Recently when creating a new mesh with a script, I found I could use SetIndices to choose quads or tris for my mesh. If I were to use Topology.Quads, does unity do anything else behind the scenes and convert it to tris anyways? If so, which way does it split, and add the new edge? Fixed / common method of verts 1 2 3 3 4 1? or does look more indepth at the shape to decide? etc
I know unity likes tris, and the usual import methods for models just convert to tris anyways, as a GPU is happier rendering tris. Not sure about what happens when choosing quads.
Ha, me neither… but let me tell you that of all the people on the forum, it would appear that you are the most well-equipped to make the first empirical observation of what Unity actually does, by using your own little codelet.
Give it a run, switch on wireframe mode and let us all know what you find. Maybe by then someone with insight into how the inner workings work can add their own two bits.
Keep in mind though, if it’s not documented and outward facing explicitly, the behavior is subject to future change, or even different behavior on different targets/hardware.
Wireframe looked like tris. After I called SetIndices, I looked at mesh.triangles and mesh.GetTriangles(), both cases were indices for 2x as many triangles as quads I had loaded. So I guess SetIndices is setting them to triangles for me. I can’t say 100% which way it splits, as I can only compare what I have, which all quads were split to {1 2 3}{1 3 4} tris, which is slightly disappointing if it doesn’t take shape into account.
set 16556 verts
set 65472 indices for 16368 quads
have 16556 verts mesh.vertices
have 65472 indices mesh.GetIndices() ( /4 = 16368 quads)
have 98208 indices Mesh.GetTriangles() (/3 = 32736 tris /2 = 16386 quads)
have 98208 indices mesh.Triangles
So this shows us the indices for the quads are still stored, for GetIndices() to return the originals, did not expect that after seeing it did the conversion to triangles. So I guess this is solved.