It is currently Tue Feb 25, 2020 5:22 am

 All times are UTC

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Smooth terrain using 2D noisePosted: Thu Oct 13, 2016 9:09 am

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

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 ) :

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

Top

 Post subject: Re: Smooth terrain using 2D noisePosted: Thu Oct 13, 2016 7:42 pm
 Developer

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:

https://bitbucket.org/volumesoffun/cubi ... ap.cpp-135

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

Code:
if (materialSet.data > 135)
{
materialSet.data <<= 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!

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for:
 Jump to:  Select a forum ------------------ General Discussion Forums    General Discussion PolyVox Forums    PolyVox Discussion    PolyVox Bugs    Showcase Cubiquity Forums    Cubiquity Discussion Voxeliens Forums    Voxeliens Discussion    Voxeliens Support