Page 1 of 1

Smooth voxel surfaces

PostPosted: Fri May 29, 2015 13:41
by MirceaKitsune
This is a feature I discussed with the Minetest team long ago, because I consider it a fantastic ability which can be easily implemented into any voxel engine. I was reminded of it a few days ago, when someone asked me to consider implementing this exact thing into Minetest, and mentioned it is something they would really enjoy. That brought the feature back to my attention, and I'm seriously considering a way to make it happen. I was also shown a video of someone who, amazingly enough, managed to do this in Minecraft through a mod:

http://www.youtube.com/watch?v=af-HNsT3RVE

Castle Story is an even better example of what I'm hoping to achieve, which uses a more complete smoothing system to create soft surfaces from voxel points (possibly the Marching Cubes algorithm). Here's a few images that show what I mean:

+ Spoiler


Patterns by Linden Lab is an example of simpler smooth voxel terrain, using only straight and diagonal surfaces. This approach might be easier for us, as we can simply add an optional subdivision system on top of it to create the smoothness.

+ Spoiler


But the general idea is simple: Some nodes would have a special flag that mark them as smooth. When used, they would no longer be rendered as blocks, and instead a simple combination of flat and diagonal surfaces is generated between the voxels. The level of subdivisions for the collision mesh and the visual mesh should be two separate settings in minetest.conf, so people can adjust them based on their computer's performance.

This might sound extremely difficult to do, but I don't actually think it is all that much. For the most part, we should only need to edit the paragraph of code that generates the surfaces for voxels. If we know the right algorithm, we should be able to create basic polygonal slopes, then add an optional subdivision counter. We might later want this to be accompanied by other features, such as gradual texture blending, but that's of course for another day.

My first question is if this feature can be accepted into mainstream Minetest. Obviously it won't affect existing mods or games and voxels will remain blocks by default, but the feature might change Minetest's position and direction (in my opinion for the better). If yes, then I'd like any hints as to where exactly in the code surfaces are generated for voxels, and any other tips you have on how this can be programmed. And of course, I also wish to know if anyone is willing to help with this, and what you all think of the idea and who else wants it to begin with.

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 14:04
by RHR
Isn't that already possible if you create a mod if you use mesh nodes? I think I have already seen some smooth terrain screenshots on this forum some weeks ago.

To answer your question:
Smooth terrain is a cool feature and I'm for it if you can turn it on and off, but I'm against it, if this feature sets the terrain always smooth, because I preffer the cubic worlds. They are simple and cool. :)

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 14:08
by MirceaKitsune
RHR wrote:Isn't that already possible if you create a mod if you use mesh nodes? I think I have already seen some smooth terrain screenshots on this forum some weeks ago.

To answer your question:
Smooth terrain is a cool feature and I'm for it if you can turn it on and off, but I'm against it, if this feature sets the terrain always smooth, because I preffer the cubic worlds. They are simple and cool. :)


Using mesh nodes can act as a workaround at best. It is however not optimal, and can offer limited results and likely much worse performance than properly coding the feature.

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 15:52
by ABJ
If if if if if if if if if if if if if
I will stay with Minetest.
If if if if if if if if if if if if if

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 17:41
by Krock
The screenshots look good but what if you want to dig a smoothed node? Does it return 1 or 0 nodes?

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 18:05
by MirceaKitsune
Krock wrote:The screenshots look good but what if you want to dig a smoothed node? Does it return 1 or 0 nodes?


Gameplay and other functionality shouldn't change. The only things that should are the visual mesh, as well as collisions and physics to represent it.

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 19:48
by prestidigitator
Terasology has the notion of a node family, which is a set of nodes that are basically considered the same, except that they can have different shapes based on how they are created/placed. In fact for your basic node, you can instance it with any defined shape in the game. Being able to load "stone" with shape "stairs" beats the hell out of explicitly having to register every combination of materials and shapes possible ("wood_stairs", "stone_stairs", "desert_stone_stairs", etc.). That could be a first step toward smoothing that doesn't require changing tons and tons about the very basic pieces of the engine such as collisions, rendering, etc.

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 20:49
by BobbyBonsaimind
Shameless plug for the ramp utility I wrote some time ago.

Yes, I know that's not what you mean, but my idea behind the ramps utility was a very similar one. However, you could use something like the marching cubes for a similar effect, using prepares meshes and positioning them accordingly.

Re: Smooth voxel surfaces

PostPosted: Fri May 29, 2015 23:09
by MirceaKitsune
BobbyBonsaimind wrote:Yes, I know that's not what you mean, but my idea behind the ramps utility was a very similar one. However, you could use something like the marching cubes for a similar effect, using prepares meshes and positioning them accordingly.


That looks very nice! But I assume it's done via mesh nodes, no changes to the rendering code?

Re: Smooth voxel surfaces

PostPosted: Sat May 30, 2015 01:38
by philipbenr
RHR wrote:Isn't that already possible if you create a mod if you use mesh nodes? I think I have already seen some smooth terrain screenshots on this forum some weeks ago.

To answer your question:
Smooth terrain is a cool feature and I'm for it if you can turn it on and off, but I'm against it, if this feature sets the terrain always smooth, because I preffer the cubic worlds. They are simple and cool. :)


No, it doesn't work with meshnodes. I tried it, and there is no smooth lighting with them. If there was, then I would be a lot more excited about them... See my most recent post in the post you screenshots thread.

Re: Smooth voxel surfaces

PostPosted: Sat May 30, 2015 08:44
by RHR
BobbyBonsaimind wrote:Shameless plug for the ramp utility I wrote some time ago.
Yes, I know that's not what you mean, but my idea behind the ramps utility was a very similar one. However, you could use something like the marching cubes for a similar effect, using prepares meshes and positioning them accordingly.

Yay this was the thread I was looking for! :)

philipbenr wrote:No, it doesn't work with meshnodes. I tried it, and there is no smooth lighting with them. If there was, then I would be a lot more excited about them... See my most recent post in the post you screenshots thread.

I know, but my idea was thought more as a workaround instead of a full working new drawing typ or whatever. ^^

Re: Smooth voxel surfaces

PostPosted: Sat May 30, 2015 09:14
by BobbyBonsaimind
MirceaKitsune wrote:That looks very nice! But I assume it's done via mesh nodes, no changes to the rendering code?


Exactly, it consists of three nodes, the ramp itself and the inner and outer corner. All three are rotated as needed, placement is rather simple, based on a mask it is decided which node needs to be placed.

I think mesh nodes are quite suitable for this. All you need is a set of pre-made meshes, like in the marching cubes or marching tetrahedras, or you could always come up with your own set. Placing them is not costly at all if you use VoxelManip object, the only part I had problems with was the rotation (I'm kinda ashamed that it took me several hours until I figured the rotation system out). There are also other systems for creating surfaces from a pre-defined set of parts, mostly they fall in the category of "creating watertight surfaces from voxel data" or some such, but for the life of me I can't remember their names.

You can always look into the worldgen-utils mod to see how I've done it, though, it isn't exactly easy to read, sorry for that. There's also the utils mod, which contains several utility classes to make certain tasks easier.

Re: Smooth voxel surfaces

PostPosted: Sat May 30, 2015 09:48
by Dopium
Great work, has potential as a sub game.