- Home /
Real quad-based mesh
I am trying to create some REAL Quad-based (don't ask me why.. terrible story..) I set the mesh to be quad-based using the following line
mesh.SetIndices(quadVertices, MeshTopology.Quads, 0);
However, in the wireframe view, I can still see that Unity triangulated my mesh. Anything I can do to prevent that from happening?
$$anonymous$$eshes can't be "quad-based", it's simply impossible. A quad is simply two polygons, and when you see a quad i'ts often because the diving line has been hidden for easier viewing, and quads are in some cases preferred by modelers because they aid in the edge flow of organic models which in turn helps with uv-mapping them.
tl;dr: $$anonymous$$eshes will always be made up of triangles, no matter the game engine. The most you could do is hide the line indicating the diagonel edges of the two triangles, but this would require a ccustom solution as the Unity editor is not capable of doing so.
Just some more information on this topic, from the Unity Scripting API documentation regarding "$$anonymous$$eshTopology.Quads" (https://docs.unity3d.com/ScriptReference/$$anonymous$$eshTopology.Quads.html):
$$anonymous$$esh is made from quads.
Each four indices in the mesh index buffer form a quadrangular face. Note that quad topology is emulated on many platforms, so it's more efficient to use a triangular mesh. Unless you really need quads, for example if using DirectX 11 tessellation shaders that operate on quad patches.
Answer by hrgchris · Feb 24, 2017 at 12:05 PM
Unity (as far as I know) doesn't support genuine quad based meshes. This is presumably for simplicity and probably compatibility (as many simpler GPUs don't actually support quads natively).
When you perform a SetIndices as in your example, unity uses your request to calculate triangles from your quads.
So short answer, you can't really. I won't ask you why as it sounds like a terrible story, but if its a visualisation thing then you could look into a wire frame shader that explicitly hides centre lines of quads through some means.