Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Flat Plane Tutorial
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=535
Page 2 of 2

Author:  ker [ Thu Sep 12, 2013 6:24 am ]
Post subject:  Re: Flat Plane Tutorial

David Williams wrote:
As for smoothing the data in the beginning I'm not so sure... even if you have a smooth heightmap the problem is that you are making a binary decision about whether each voxel is below or above the specified height. So each voxel is being set as completely empty or completely solid (so the get the stepped artefacts).


which is easy when everything is so steep that you have at least one height unit difference to the surroundings
you get the "solid" position and a higher up "empty" position (next to the surrounding voxels) and interpolate the values between those coordinates.

it gets hard when you try to smooth a very flat slope, because then you can't just look at your neighbors, you need to do way more.

and if your heightmap isn't smooth, then this method won't work either.

Author:  David Williams [ Fri Sep 13, 2013 7:55 am ]
Post subject:  Re: Flat Plane Tutorial

Ok, yes, I see what you mean.

ker wrote:
it gets hard when you try to smooth a very flat slope, because then you can't just look at your neighbors, you need to do way more.


I can see that a gentle slope is indeed difficult here (e.g. if it's flat for 10 voxels, then goes up one voxel, then is flat for another ten, and so on). You'd need a lot of blurring and this would destroy other details in you map.

Perhaps a better approach is to consider converting the heightmap into a mesh (at least conceptually), and then voxelising that mesh. Then you can consider exactly where that mesh intersects your volume and set the voxel densities to best represent this.

Just an idea... maybe it's worth research voxelising a mesh into a density field (rather than a 'binary' field)?

Author:  Clonkex [ Fri Sep 13, 2013 12:58 pm ]
Post subject:  Re: Flat Plane Tutorial

I wonder if you had a higher resolution heightmap, whether that could be used to create smooth meshes over large flat-ish areas (slowly sloping ground).

By higher resolution, I don't mean on the standard 2D XY plane, I mean maybe using a colour heightmap instead of a greyscale one. You'd have at least 65535 "steps" rather than 255, and I wonder if you could use them to set better density values....just a thought.

Author:  ker [ Fri Sep 13, 2013 4:21 pm ]
Post subject:  Re: Flat Plane Tutorial

Clonkex wrote:
By higher resolution, I don't mean on the standard 2D XY plane, I mean maybe using a colour heightmap instead of a greyscale one. You'd have at least 65535 "steps" rather than 255, and I wonder if you could use them to set better density values....just a thought.
David Williams wrote:
Perhaps a better approach is to consider converting the heightmap into a mesh (at least conceptually), and then voxelising that mesh. Then you can consider exactly where that mesh intersects your volume and set the voxel densities to best represent this.


lets combine those two ideas:
1. convert the 8bit-heightmap to a 16bit-heightmap (simply left-bitshifting all values by 8)
2. create a boolean heightmap that has true for all pixels that have the same value as their neigbors
3. keep on smoothing all pixels marked in the bool heightmap until sufficiently satisfied
4. convert to heightmap
4.1 remember to check for very steep slopes (more than 1 voxel) and do some magic there (see my earlier post)

Author:  kklouzal [ Sat Sep 14, 2013 4:44 am ]
Post subject:  Re: Flat Plane Tutorial

Thank you guys for all the help, here's my progress so far :)

Image

Author:  David Williams [ Tue Sep 17, 2013 8:37 am ]
Post subject:  Re: Flat Plane Tutorial

Right, sorry for the slow reply, had a busy weekend!

I think there's some interesting ideas here, and maybe it's also worth converting the input heightmap to a floating-point format for better interpolation and smoothing. I find this all quite hard to visualise though, so I look forward to trying to implement it myself.

@kklouzal - Looking good!

Page 2 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/