Skip to content
Emma Parsley edited this page Jul 13, 2023 · 4 revisions

Marching Cubes but good this time

In theory, I have done this before and therefore this time I will do it better.

Goals

  • No holes. Last time there was the occasional hole in my skin.
  • Fast generation. It took far too long to generate the skin last time, this time I will optimise it, or at least have it runing in coroutines with a loading bar so it doesn't feel like the software has stalled.
  • Smoother mesh. My previous effort was too blocky, I want the mesh to look smooth and seamless

Process

My previous attempt.

To test this initially I shall start with two points and use marching squares to hopefully draw the peanut shape of them intersecting. In my project report from doing this before I started by creating a grid of points encompassing the creature then using these to generate the skin.

There are 15 possible forms a cube can take in marching cubes not including. I shall be storing the points for all these and how to render their mesh and making a script (MarchingCubes.cs) that will take a set of points and return data needed for the mesh. Source

Rather than futz around with working out how these cubes are rotated I've decided after having a long hard read of this website page: http://paulbourke.net/geometry/polygonise/ that I shall have a look up table of all 256 possible combinations.

I will need to write a function to cut down the vertices list to only the used vertices while also keeping the references to the vertices in the triangles in check. This could be done by making a new list of vertices and only adding to it when a new vertices is being used. Whenever a triangle index is added it can check if it's vertex is already in the list, if it is update it's index to be for that, otherwise add it to the list and update its index to be the new one.

The Grid creating the grid is an important part of marching cubes, and I'm wondering if I can generate less of it that I did last time. if I can work out to only make the cubes I think I'll need perhaps I can do them in parallel and also only check radius' I expect to be near it (ones connected in the hierarchy) so I can have not all mesh parts merging together. I'm sure I can explain this better but that will do for now

Clone this wiki locally