x


[C#] Implementing 3DPerlin/Simplex Noise

Ok. I have some idea of how Perlin noise works and how Simplex noise is faster. I also get how you implement 2D noise. (You give x,y coords and receive float between -1.0 and 1.0 which you can use for z coords) But I can't grasp the idea of implementing 3D Noise algorithm. I tried:

 if(SimplexNoise.Generate(xWorldp, yWorldp, zWorldp)>0){
      ChunkHolder = 1; // Then i have another code that converts this into blocks.
 }else{
      ChunkHolder = 0;
 }

But it works just like normal Random generator. Help?

more ▼

asked Dec 02, 2012 at 12:13 PM

avatar image

Atrus_Madhatter
5 4 5 6

(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

A while ago I started on a Minecraft-clone project in my sparetime just for the interest in doing so, so I've worked a lot with procedural generation of terrain (which now works really great!), and while I'm still new to the area, hopefully I can help out a bit here :)

First of all, I also started out trying to implement my own Perlin Noise methods, but in the end I actually ended up going with quite an awesome free Unity library which does an awesome job of offering a whole host of different noise functions. You can find it on the asset store here: CoherentNoise for Unity3D

The library uses 3D perlin noise but can be used for 1D and 2D as well.

And in any case you should really refer to it's manual for pure learning purposes, it has some great clear and basic explanations of the theory behind it all: CoherentNoise manual

Now I don't know if you are interested in implementing the perlin noise function purely for learning reasons. If you simply need to use the functionality but are not interested in how it is calculated please use the above library, no reason to do anything else :)

Now if you want to implement it to learn how it's actually done, there's a few great articles that shows the actual implementation. The first one is: Perlin Noise Article

The other one that I've found great is the documentation for the C++ perlin noise library LibNoise: LibNoise documentation

Is this what you are asking from your question? Or are you more concerned about how to actually use perlin noise in your application? In that case you would have to give me more specific examples of what you are trying to achieve :)

more ▼

answered Dec 02, 2012 at 05:33 PM

avatar image

PastryGood
961 39 35 38

If only I knew of your package sometime ago... Thanks for sharing.

Dec 07, 2012 at 06:56 PM Saitodepaula

The library you linked is no longer available. Any suggested alternatives?

Dec 20, 2014 at 08:42 PM Simon O
(comments are locked)
10|3000 characters needed characters left

Sounds like you're trying to figure out how to get from random noise to a Minecraft-like world. The trick is to layer up multiple noise patterns at different sizes, along with rules that guide the randomness towards the ballpark result you're after.

For example...(I'll use a 2D heightmap rather than 3D voxels, because it's easier to describe)

If you're using a single noise pass to set cell heights, you'll get random spikes. If you shrink the noise lookup dimensions then you should get rolling hills instead, as the heightmap picks up the interpolation between the noise values. That will give you very curvy fake-looking mountains and valleys.

So you also do a second noise lookup at a smaller scale (ie. a scale that gives you smaller landscape features), and add it to the first. This will add small hillocks onto your mountains and valleys.

Then you do another lookup at an even smaller scale and add a layer of small bumps and divots. Three passes is about the minimum to get a reasonably natural-looking terrain. These different-scaled noise lookups are called "octaves" after music.

Then you can also apply custom rules, such as "scale height down with distance from origin" which will give you an island centered on the origin. Make sense?

Minecraft does a ton of clever stuff to create it's world, including erosion passes on the generated data. What you'll want to do depends on what you're trying to create.

more ▼

answered Dec 21, 2014 at 10:33 PM

avatar image

Winterblood
489 5 7 14

(comments are locked)
10|3000 characters needed characters left

@PastryGood covered almost everything I think, but if you want more examples, take a look here.

more ▼

answered Dec 07, 2012 at 06:52 PM

avatar image

Saitodepaula
148 19 17 18

(comments are locked)
10|3000 characters needed characters left

why is that nobody ever really gives you a solution to a problem the just bog down your code with third party's, general approach plugins take the time to learn it i will give you a link to the perlin noise creators newest pseudo noise algorythm. maybe youj can figure it out.

http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf

more ▼

answered Jul 09, 2014 at 01:54 PM

avatar image

cofcof
3 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x14609
x76
x59

asked: Dec 02, 2012 at 12:13 PM

Seen: 6457 times

Last Updated: Dec 21, 2014 at 10:33 PM