MeshHelper

Description
This is a utility class that contains some functions to manipulate a Mesh:

- void Subdivide4(Mesh mesh); Subdivides all triangles in the Mesh. Each triangle get replaced by 4 triangles. A quad(2 tris) get effectively divided into 2x2 quads (8 tris) - void Subdivide9(Mesh mesh); Subdivides all triangles in the Mesh. Each triangle gets replaced by 9 triangles. A quad(2 tris) get effectively divided into 3x3 quads (18 tris) - void Subdivide(Mesh mesh, int level); Uses the above mentioned functions multiple times to get a higher resolution. level should be a number that's made of 2a * 3b where a and b are whole numbers between 0 and +inv [2,3,4,6,8,9,12,16,18,24,27,32,36,48,64, ...] - Mesh DuplicateMesh(Mesh mesh); Uses Unitys Instantiate function to clone the Mesh.

Note: The Subdivide functions just do a linear subdivide, but keep shared vertices / edges. The actual shape of the mesh will stay exactly the same.

ps. couldn't find a robust way to round the level value down to the nearest number that could be made of the factors 2 and 3. If someone knows a way without much try and error, feel free to add it or post it on the discussion page.

Install
Place the script either somewhere in your assets folder or in "Assets/plugins/" if you don't use C#.