User Tools

Site Tools


marching_cubes

This is an old revision of the document!


Marching Cubes


Generally speaking, Marching Cubes is an algorithm that can be used to generate a mesh from voxel data. In the context of RPG in a Box, it's an alternate mesh option that smooths the corners of your model into a more rounded, low polygon look, as opposed to the default option which keeps the squared shape of each voxel. When Marching Cubes is used, the resulting shape at each voxel position is determined by the 26 neighboring voxels around it, so it's recommended to experiment with their placement to get a feel for the various shapes that each configuration creates! The image below shows what a few example models will look like when using Marching Cubes compared to the default mesh option.

Marching Cubes can be selected from the “Mesh” dropdown on the Model Tools panel. Whenever the mesh type is changed, the model must be saved in order for the mesh to be generated again. To preview the appearance of a model using Marching Cubes, you can click the “Preview Game Mesh” button on the Voxel Editor toolbar.

Grouping

In some cases, a model may look better when certain areas are grouped together and handled separately from the rest of the model. For example, a character's head could be handled this way to keep it fully rounded and more distinct instead of being blended into the neck or body. To create a group in the Voxel Editor, select the desired voxels with the selection tool and then press “G”. A popup dialog will appear to prompt for the name of the group. When the model is saved, each group will be handled separately when generating the mesh.

In the example images below, you can see the resulting difference when groups are used. On the left side, no voxels are grouped, and on the right side the pillow and blanket of the bed and the character's head have each been grouped together. You can see how these parts of the model, most noticeably the pillow, are blended into the rest of the model when not grouped, but are kept more distinct when they are grouped.

Excluding Edges

When using Marching Cubes, you may not want the edges of a model to become rounded in certain scenarios, for example with a wall or ground tile that needs to remain seamless along the boundaries. For this, you can uncheck the “Apply Marching Cubes at grid boundaries” checkbox to prevent the Marching Cubes algorithm from being applied to any voxel faces along the boundaries of the model's grid.

As seen below, the edges of the wall tile on the left become rounded when Marching Cubes is used and will cause issues when placing it adjacent to other walls. The wall tile on the right shows what will happen when the mesh is generated with the “Apply Marching Cubes at grid boundaries” checkbox disabled. The edges of the wall remain squared, while the inner structure will still have Marching Cubes applied.

marching_cubes.1618813590.txt.gz · Last modified: 2021/04/18 23:26 by justin