Voxels and marching cubes (fully editable terrain)

Although the answer will probably be “impossible” I still wanted to know; Is there a way to do voxels with marching cubes in BGE? Cube meshes or empties can be used as voxels, but can you generate a smooth surface between them in realtime?

What I’m trying to achieve is fully editable smooth terrain, like this:

I’d also want collisions to update in realtime, although I heard BGE can do this with the proper scripts. What’s the closest I can get in the latest version of 2.6? Note that I can’t script, so if anyone else did the coding please post a link.

Real time sculpting eh? Pretty neat - I wish you luck on your journey. :wink:

Marching Cubes uses voxel data to construct a mesh.

Since the python mesh proxy cannot add or remove vertexes, this is not possible in the BGE.

If it was only height that you wanted adjusted, that could be done by changing the vertex height and reinstanceing the physics.

i would be the happiest blender user if this was possible as far as ideas of how to get it to work i have no clue i really hope someone can figure this out cause i think it will benifite everyone greatly.

Reviving the topic: I’ve been thinking about this last night, and thought of a way in which it could be possible with the current limitations (given someone’s willing to make a very complex script).

You would create a single flat plane and subdivide it multiple times. Then create an empty and give it the needed logics and properties. On another scene / layer, place multiple references of that empty wherever you want. A script would then contain information that would detect those empties, and map the subdivided plane so it stretches every 4 empties, each empty representing a corner (or map it every one empty and have it represent the center).

When someone would dig a hole in the terrain (or place a lump), a new instance of that empty would be added / removed. The script setup (however it would be done) would spawn a copy of the subdivided plane with the proper position and rotation, and offset the vertices so they transition between the gaps. If done properly, this could allow a minecraft-like environment with smooth terrain.

Even better, this could all be done with a subdivided cube, each of the 6 faces being a separate object (so they can be removed by the script). Each cube would be spawned at an equal distance from the other, but the visible sides would be smoothed by the script, while sides hidden under the terrain would not be rendered to avoid performance loss. Whenever a cube is added / remove, the nearby ones would be recalculated to smooth around the hole / lump.

Anyone tried this so far or is willing to try it? I’m barely learning scripting in BGE, so no chance for me to achieve something this complex. Might be an interesting test for BGE.

It would be possible,but the performance would be a problem though.

Sadly yeah, unless the camera clipping distance is set low enough to not render a lot. With the cube method, I’m thinking of about 4-6 subdivision cuts.

Nice. Just realized that Blender already has this feature. You can use Shift + A and add Metaballs, which will automatically merge with each other when getting close, and it’s how such terrains seem to be done. Unfortunately the game engine does not support this in realtime :frowning: If only there was some addon or script that would change this…

+1 for real time meta objects. It would make some really cool water effects.

I have no idea what real time collision would be like though.