Unity Procedural Mesh HD
Showcasing procedural mesh generation and editing, updating both mesh and collider. The mesh points are recalculated using compute shader where supported (DX11/ OpenGL ES 3.0+), otherwise the job is divided in 4 threads achieving similar performance. The mesh is generated first as a cylinder and then modified using a height map from Perlin noise Cylindrical Mesh Point Generation: for z = 0 to depth for Theta = 0 to 2*Pi with stepSize vertex.x = radius * cos Theta vertex.y = radius * sin Theta vertex.z = z normal = dot vertex with 0,0,z and normalise uv.x = theta / 2Pi uv.y = z/depth Height application: OutputPos = InputPos + HeightMap * Normals * noiseIntensity Updating Mesh and collider: Simply reassign every time you recompute mesh.vertices = computedVertices; meshCollider.sharedMesh = meshFilter.sharedMesh; Useful Links: Procedural Mesh Generation and Noise among other: https://www.youtube.com/watch?v=wbpMiKiSKm8&list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3 Threading: http://answers.unity3d.com/questions/357033/unity3d-and-c-coroutines-vs-threading.html