It is currently Sat Aug 22, 2020 3:41 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Smooth terrain using 2D noise
PostPosted: Thu Oct 13, 2016 9:09 am 

Joined: Thu Sep 29, 2016 3:21 pm
Posts: 5
It's me again :roll:

I was trying to generate volumes through code, and I made it through creating a colored cubes island like this:


But now I would like to try convert it to a terrain so it could be smooth and nice.
The problem is that I can't wrap my head around the concept of the MaterialSet weight and I only find in the imported packages examples that uses 3D simplex noise to make it smooth... As soon as I try to convert that 3D noise generation to a 2D one I get something like this (ignore all the warning, those are for another thing :oops: ) :


What should I do to smooth it nicely like the 3D noise ones?

Thanks for the support <3

EDIT: To clarify further, now the "smoothing" is basically drawing 45° planes between cubes... I was aiming to get different smooth curves like the ones in the examples with 3D noise

Offline Profile  
Reply with quote  
 Post subject: Re: Smooth terrain using 2D noise
PostPosted: Thu Oct 13, 2016 7:42 pm 
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
As part of Cubiquity's ProcessVDB tool I actually wrote a heightmap converter, and was amazed at just how difficult it was. Converting a heightmap to a smooth volume seemed trivial but I spent a long time thinking about it.

Firstly, forget about different materials for now and just use one. That way you only have to think in terms of a single density per voxel. Now the problem is that you have height at each point and a voxel is either above or below it - this is a binary decision which means you end up setting each voxel to be either solid or empty.

As I recall, I tried instead setting the density of the voxel relative to the distance between the voxel and the top of the column. I then scaled it by some factor(s) which I found by trial-and-error. You can see the code here: ... ap.cpp-135

I think you can ignore this part of the code (it's just stuff for materials?):

if ( > 135)
{ <<= 8;

though I'm a little hazy to be honest. Most usefully, I found it was helpful to scale the image down from a higher-resolution version of the heightmap. You might be able to avoid this, because your procedural data is effectively infinite resolution anyway. Also I had to start with ints, where as you will be starting with floats which should be easier.

To be honest, this was one of the problems which made me realise just how difficult and unintuitive density fields were, and why I decided to just focus on tiny cubes for Cubiquity 2!

Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created