- Home /
Marching cubes in Unity?
How can I implement the marching cubes algorithm in Unity? Or is there a better solution for smoothing? Any code/examples/documents are helpful, preferably JS.
Answer by Ashkan_gc · Jun 11, 2011 at 06:42 PM
as you know marching cubes is an algorithm for generating polygonal meshes. you should first implement the algorithm which i think you might not be able to find here in the community easily and then add those polygons to a vertext array and turn it into a mesh. basically you should create a mesh of type Mesh class in unity and then add the generated vertecies to it. then create a trianglestrip from them and render them easily. there are tutorials for procedural mesh generation in unity's example projects and other websites that might be helpful.
finding a code in c++ for marchingcubes is not that hard and turning the code into C# or js is easy.
i don't know the marching cubes algorithm well. i saw it on wikipedia and it doesn't seem hard to implement. let's assume that you generated all vertecies from your algorithm. each vertex has a x,y,z position which you insert into a Vector3 array and set it's reference to your mesh. it's a complex topic that you should study in tutorial. if you are new to 3d and or program$$anonymous$$g it's not the easiest thing to do.
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Flipping textures 0 Answers
How do I invert the Y axis in Penelope tutorial? 3 Answers
opening a webpage? 1 Answer