Jump to content
  • Advertisement
Sign in to follow this  
WhoCarrot

Unity Voxel terrain smoothing

This topic is 1123 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys,

 

I recently started developing a game in unity. I have some questions and unclear areas in the department of terrain generation.

What I want to accomplish is a procedurally generated destructible world with smooth voxels.

It would be nice to have the possibility to have calm and flat areas in the starting zone but as you wander out the terrain would get some more interesting.

 

In the game you can control units, if you send them into a (yet) ungenerated chunk, they will start walking there and there would be enough time to generate the terrain in the background.

 

The step process that seems logic to me would be to;

 

Generate noise based on seed and coordinates

I've read about the different kinds of noise you can use and what the pro's and cons are, but I wanted to get something straight, the result after noise generation should be an array with values between (-1..1) or (0..1) if normalized, right?

 

Generate voxels based on the noise and map them in chunks

How does this actually work, I understand the big picture but when I'm working with an array of numbers between (-1..1) I kind of lose track of how to implement it code-wise.

 

Smooth the terrain out

This is the point that I find hardest because it gets really mathematical.

I have found some sources but most of them are really outdated, I was wondering if there are some recent and optimized terrain smoothing algorithms.

 

I've looked a lot at this article:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html

The terrain is too rough though, would it be possible to implement the smoothing with my own noise and voxels?

 

TL;DR: I'm developing a game which needs a procedurally generated destructible word with smooth voxels, I could use some pointers, recent articles and source codes in C# (preferred) with that.

 

Thanks a lot for helping me out, I'm looking forward to your replies!

 

Greetings,

WhoCarrot

Share this post


Link to post
Share on other sites
Advertisement

It is unclear if you want to smooth the terrain or the voxel presentation of the terrain.

For smoothing terrain look up gaussian blur. For smoothing voxels look up marching cubes.

 

 

 


I've looked a lot at this article:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html

The terrain is too rough though,

If this is too rought, then you have some really demanding goals. Voxel worlds are notoriously memory hungry. For more memory efficient implementation look up sparse voxel/octtrees.

Edited by Ashaman73

Share this post


Link to post
Share on other sites

Thank you for replying and trying to help me.

 

 

It is unclear if you want to smooth the terrain or the voxel presentation of the terrain.

 

I would like to smooth out the voxels, like marching cubes indeed.

 

I found this implementation:

http://paulbourke.net/geometry/polygonise/

 

So if I understand correctly, you provide the algorithm with an array of the isolevels of 8 corners of your voxels.

Furthermore you provide the isolevel, and the array in which the triangles will be stored.

 

I am wondering what the isolevel is exactly and where it comes from (do you generate it with the noise per voxel?).

 

For further reference, the desired result looks something like this:

YeH6CXN.png

 

Thank you again for your help!

 

Greetings,

WhoCarrot

Share this post


Link to post
Share on other sites

Check out marching squares (2d) first to get an understand of the approach.

 

Your screenshot:

This looks like standard (hi-resolution) height-mapped terrain. You will have a hard time to get this hi-resolution look for large terrain with voxels. A naive comparision is, that a terrain with 16bit height of the size of 4k x 4k would be roughly 32MB. The same in a voxel world with just one bit for each voxel would consume roughly 4 GB.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!