How would you optimize a voxel building system?

Was questioning my self today how would I optimize a voxel system (This includes generating terrain and also having the ability to edit it in real time.), as currently you cannot make custom meshes using scripts.

Situation 1: We can use parts and scale them, when it has to branch out we have to use another part.

  • downside, after many branches it would start to lag and be inefficient, cannot be split into chunks without further separation of the parts.

Situation 2: Use a skeletal skinned mesh, same problem the deformation is a lot cleaner.

Situation 3: Use 1x1 planes to create the voxels and scaling them if there’s 2 planes that are touching.

  • downside, creating a cube would take 6 planes, meaning a lot of objects for a scene.

Both of the systems could use splits to render out the far away objects. (example of splits would be chunks)

I’d love to hear what how you would make this efficient, and also being able to handle a ton of game objects at once.

1 Like

You can also try implementing something called greedy meshing:

2 Likes

You can implement Greedy meshing & only generate “surface” voxels.

Imagine this scenario;
A player digs down, the voxel generation system loops through to search for any neighbors and if it does, the system will create a physical voxel who were the neighbors of that destroyed voxel. This can be tricky when you have Greedy Meshing in the system too, you will probably have to run through the Greedy mesh operation again each time you destroy a voxel.

1 Like

Already went over this way, still a lot of parts, appreciate it tho!

Correct if you have a greedy meshing system you would have to run it again every time that a voxel is placed or destroyed, optimization would be splitting the world into chunks.