- Home /
Does a Mesh Vertices/Triangles/etc Have to be Compact
If I generate a Mesh procedurally, do the colors/triangles/vertices/normals arrays that I create have to be compact? Can I have sections in the array that are null, provided all the arrays match up? Is there any significant performance penalty to doing this?
My meshes can change frequently and I am trying to avoid generating a bunch of complete arrays from scratch each time,but, if I can't determine where the vertices I want to change are in the array, that's what I have to do. I figure if I can put in bulls I can structure the arrays for arbitrary access.
Answer by Eric5h5 · Jul 03, 2012 at 06:10 PM
You can't have actual null entries (it's impossible to use null for structs), but the graphics card will skip over degenerate triangles (multiple points in a row set to Vector3(0, 0, 0) or whatever).
that could work as I could derive the structure of the others arrays from that... any idea about performance?
As I mentioned the graphics card skips over degenerate triangles. Although it's still slower having 50 triangles of which 25 are degenerate rather than having just 25 triangles to begin with, since all the vertices have to be uploaded regardless. But it's generally better than creating the mesh from scratch every time.
Your answer
![](https://koobas.hobune.stream/wayback/20220613073630im_/https://answers.unity.com/themes/thub/images/avi.jpg)