Javier-Garzo / Marching-cubes-on-Unity-3D

Terrain voxel engine with the use of Marching Cubes implemented in Unity 2020.3.17f1 (LTS).
MIT License
332 stars 43 forks source link

How to prevent interpolation? #13

Closed emre-sahinn closed 2 years ago

emre-sahinn commented 2 years ago

Hi @Javier-Garzo, I am building a voxel game and I managed to make cubes but I couldn't find a way to prevent interpolation between ground and placed cube. image I want to combine Minecraft-looking blocky voxels combined with a marching cube but this ugly-looking interpolation prevents me, how can I solve this?

emre-sahinn commented 2 years ago

image

Javier-Garzo commented 2 years ago

Achieve a result of a minecraft style need the correct use of interpolation for generate that type of cube style.

The interpolation allow to hide that slope that you post in your images. Just check this image to get the idea: image

Check the difference with no interpolation in the marching cubes. Interpolation: image

No interpolation: image

You can see that the interpolation and the correct weight of the vertex is necessary to achieve the cube style.

I have been trying a write code for generate the correct type of terrain modification for this problem unsuccessfully. I am researching for the problem/bug/bad implementation that now allow me to generate this type of terrain.

emre-sahinn commented 2 years ago

Achieve a result of a minecraft style need the correct use of interpolation for generate that type of cube style.

The interpolation allow to hide that slope that you post in your images. Just check this image to get the idea: image

Check the difference with no interpolation in the marching cubes. Interpolation: image

No interpolation: image

You can see that the interpolation and the correct weight of the vertex is necessary to achieve the cube style.

I have been trying a write code for generate the correct type of terrain modification for this problem unsuccessfully. I am researching for the problem/bug/bad implementation that now allow me to generate this type of terrain.

I think we need a custom triangulation table to prevent those slope areas, I don't need slopes I just need the flexibility of marching cubes but with a Minecraft look. Do you have any idea to remove all of the slopes? I just need sharp edges.

Javier-Garzo commented 2 years ago

But you want a cube terrain like minecraft, because if you want a minecraft looking game, you need a voxel terrain, that type of terrain have a flexibility similar to the marching cubes, so maybe it's a better solution.