Voxel Terrain (32307)

I’m asking this question because for my next project I need to implement a voxel terrain engine similar to that used in CryEngine 2. Because I need to make caves, no I have a mental system for how this could possibly work but if it does not could you suggest a work around?

My system is where the editor has an editing tool where I can instantiate low poly balls on top of each other without depleting to much memory. The way I found around that would be to use some sort of occlusion where it destroys certain balls on the inside

For example if I had three balls but you could not see the third then destroy the third ball since it is not needed.

Sorry, I read this post and all I could see was "I need to write CryEngine 2"...

1 Answer

1

If you want to do it yourself, look for Marching Cubes algorithm. It may take a day or two to wrap your head around, depending on your skill level. I managed to get this going the first day, and this going the second day. Third day I got bored and discontinued development of it.

Your idea of balls should be pretty simple to implement with marching cubes. Imagine each vertex has to sample a value (usually between 0 and 1) and that value is used to extend/retract the vertex for that point in space. Your balls would then interpolate from 1 to 0 where value 1 is in the center, and 0 is in the ball crust. Basically, you just have to check the magnitude.

I solved texturing by using a triplanar shader, requiring no UV coordinates. It just take the world position and project 3 textures on it, and interpolate between the textures depending on the normal.

Would you consider posting the code? That might help those who still strive :)

Statement. That Clayful thing you made is fantastic Honestly! You must create a tutorial On how to do it! Ive been looking for Unity voxel tutorials that arent like Minecraft blocks.