top of page
Search

Voxel Project: Improving Performance Part 2

  • Writer: Kyle W
    Kyle W
  • Jun 23, 2022
  • 2 min read

Ouch

This week... didn't go well. I had 2 main goal entering this week: 1. Reduce the poly count of the voxel mesh collider, and 2. Reduce the complexity of the marching cubes algorithm. I attempted both of these with lackluster results.


In an attempt to further simplify the mesh used for the mesh collider, I tried to concatenate the quads along the X axis the same way I have done along the Z axis. I tried several methods, from caching quads to omitting non-concatenated quads to generate later, but it has proved rather difficult to do so because the collision mesh is generated simultaneously to the visual mesh.

ree
Current collider

Currently, I am attempting to remove and overwrite certain vertices after the collision mesh is generated, but have not been able to complete it.

ree
Current logic for editing the vertices

Additionally, I started work on reducing how complex the current cube marching algorithm is, as currently it is not only a chain of switch and if statements, but each combination of adjacent blocks needs to be addressed in a case by case basis.

ree
Part of the logic

As a first step, I created an actual voxel class for storing two variables: the shape of the voxel, and the vertices that are occupied for each side.

ree

By combining all of the sides into a single bitmask, I can compactly keep track of the how much of each side is covered, and use that to determine if certain faces need to generated to fill gaps. This more general solution allows me to future proof against new shapes, and does not require me to address each shape individualy, aside from creating a bitmask for each shape.

Next Week

While I would like to continue working on improving the collider and other minor aspects, I also think it's about time to work on the features of the voxel grid. In particular, I'd like to start working on being able to subdivide the voxel grid into separate grids, as well as potentially combining grids together.


 
 
 

Recent Posts

See All
Voxel Project: Summary

When I started this project, I wanted to get a better understanding of how voxels are implemented, and the different potential...

 
 
 

Comments


bottom of page