Categories
Advanced Tutorials

Creating Voxel Meshes using Volume Select

Preface

Crayta provides a powerful voxel building system allowing you to create big and varied game worlds. You can quickly create your game level surfaces to start testing your gameplay and later go back and add cosmetic details easily.

In this tutorial we will explore how Volume Select, a Voxel tool available, works to edit and extract parts of a Voxel Mesh. Which you can later reuse in other parts of your Crayta world.

What is Volume Select?

When creating a new Crayta project you will find a single Voxel Mesh, in the form of a ground floor, already placed in the world for you. If you start drawing voxels on this surface, the voxels created will be automatically added to that original Voxel Mesh.

This stone door that we created is nice but what if our game requires moving it to a different location? Volume Select allows us to select a number of voxels from a Voxel Mesh to execute a number of methods on them:

Clicking Volume Select on the Voxel Tools toolbar allows us to create a selection volume in the 3D view to include our voxels. You can add a selection volume and further edit it using the gizmo to precisely select the required voxels.

Then you can execute one of the following methods:

  • Extract, creates a new Voxel Mesh from the selection containing the selected voxels. This will also have the voxels selected removed from the current Voxel Mesh.
  • Move, allows you to move the current voxels in the world, inside the current Voxel Mesh.
  • Duplicate, allows you to create a copy of the current voxels, inside the current Voxel Mesh.
  • Clear, will delete the selected voxels from the Voxel Mesh.

Let’s take a look at how each method works.

Moving Voxels

Using Volume Select to select a number of voxels and pressing Move will render the move gizmo at the center of the selected volume.

Using the gizmo you can move the voxels around and when finished pressing Apply on the toolbar will complete the action.

Duplicating Voxels

Duplicating Voxels is very similar to moving Voxels, with the only difference when finished moving the voxels around a new copy will be created.

Clearing Voxels

Clearing Voxels is even simpler: selecting Voxels with the Volume Select tool and pressing Clear will automatically remove those voxels from the Voxel Mesh.

Extracting Voxels

Extracting Voxels is a powerful tool that allows us to easily reuse voxels to enhance our game level.

When selecting Voxels using Volume Select and pressing Extract the output will be a new Voxel Mesh and Entity added to your project.

The new Voxel Mesh created will automatically be named based on the name of the original Voxel Mesh. A good practise is to remember to name the new extract to something sensible, helps a lot when starting having a lot of Voxel Meshes in the same level.

You can now easily reuse this new Voxel Mesh to make copies of the stone door in your level.

At any point you can merge back this new Voxels to a parent Voxel Mesh entity.

To do that move the Voxel Mesh entities, to be merged, as children to the parent Voxel Mesh entity. Right click on each entity and select Merge To Parent.

Each merged entity will be removed from the Entities Tree and the Voxels merged to the parent Voxel Mesh.

This is a powerful system to easily create levels and interesting worlds for your game.