Questions on Noise

Started by
10 comments, last by JTippetts 12 years, 5 months ago
Hi guys!
I've just started working on a terrain generation algorithm (inspired by Minecraft), and I've come to the point where I have 2D noise for overall terrain height and 3D noise for cave systems. However, I've noticed how Minecraft, even in the early stages, had quite varying terrain styles. An example would be flat plains and then large mountain ranges.

Heres where I get confused, how does one cause such variations, and in specific areas? An example would be a flat plain with little/no variation, and then a sudden mountain range? I had the idea of creating a layer of noise for mountainous regions and then adding it to the pre-existing overall landscape noise, but this causes sudden 'walls' where the added noise has caused an increase in height.

How would I merge layers of noise smoothly to achieve different types of terrain? Also, does anyone know of a better way to vary terrain other than layering noise?

Thanks,
Matt.
Advertisement
You can make your terrain be the product of two noise functions: One low-frequency noise function determines whether we are in a flat region or a mountain region (with smooth transitions between them), and the other one has the usual shape to generate mountains. I believe some people refer to this as a "multifractal".

You can make your terrain be the product of two noise functions: One low-frequency noise function determines whether we are in a flat region or a mountain region (with smooth transitions between them), and the other one has the usual shape to generate mountains. I believe some people refer to this as a "multifractal".


Hmm.. I think I get where you mean. but how would I tell which area was where I should put mountains? Would I just do a check to see whether it reaches the height boundary for mountains, and then apply the second layer of noise?

Also, I just noticed a post on a blog regarding terrain generation, that states that Minecraft "scales along the y-axis". Do you know what he means by scaling the noise? I'm assuming he multiplies the co-ordinates by the scale factor, but this gives me odd results when I try it out :S

Thanks for the help,
Matt.
JTippetts here at gamedev wrote some stuff about this that I found while browsing around a little while ago:

http://accidentalnoise.sourceforge.net/minecraftworlds.html
http://www.gamedev.net/blog/33/entry-2227887-more-on-minecraft-type-world-gen/

I haven't played with Perlin noise a whole lot until recently so I'm not really an expert, but from what I gather from those articles, the scaling means to scale the domain in one coordinate direction. For example, if you call a 2D Perlin noise function with an (X,Y) coordinate, but you scale the Y coordinate by 0, you end up with basically a 1D function (which is what JTippetts is doing in the first linked article for 2D terrains). You can use small-but-non-0 scalings of Y to get a function that has some Y-axis variation, but by using a small scale this variation is limited and thus less likely to result in floating geometry.

JTippetts here at gamedev wrote some stuff about this that I found while browsing around a little while ago:

http://accidentalnoi...raftworlds.html
http://www.gamedev.n...type-world-gen/

I haven't played with Perlin noise a whole lot until recently so I'm not really an expert, but from what I gather from those articles, the scaling means to scale the domain in one coordinate direction. For example, if you call a 2D Perlin noise function with an (X,Y) coordinate, but you scale the Y coordinate by 0, you end up with basically a 1D function (which is what JTippetts is doing in the first linked article for 2D terrains). You can use small-but-non-0 scalings of Y to get a function that has some Y-axis variation, but by using a small scale this variation is limited and thus less likely to result in floating geometry.


Thanks for those links!! Yeah, I think you're right, it seems to have the same effect on the world! The only problem is, his document only describes how to apply it for a 2-dimensional noise function.. how would I apply it for a 3-Dimensional one? Setting y to 0 causes just a huge, tall chunk to be made.

Also, just to ask, how would I go about merging different noise functions? Above, his library already supports merging different layers of noise and doesn't really give an explanation as to how I should do it. I'm assuming I could take the value of two noise functions, interpolating at 0.5 (basically getting the average of both) and then setting that as the new value?

Thanks for the help guys,
Matt.

[quote name='FLeBlanc' timestamp='1319751157' post='4877688']
JTippetts here at gamedev wrote some stuff about this that I found while browsing around a little while ago:

http://accidentalnoi...raftworlds.html
http://www.gamedev.n...type-world-gen/

I haven't played with Perlin noise a whole lot until recently so I'm not really an expert, but from what I gather from those articles, the scaling means to scale the domain in one coordinate direction. For example, if you call a 2D Perlin noise function with an (X,Y) coordinate, but you scale the Y coordinate by 0, you end up with basically a 1D function (which is what JTippetts is doing in the first linked article for 2D terrains). You can use small-but-non-0 scalings of Y to get a function that has some Y-axis variation, but by using a small scale this variation is limited and thus less likely to result in floating geometry.


Thanks for those links!! Yeah, I think you're right, it seems to have the same effect on the world! The only problem is, his document only describes how to apply it for a 2-dimensional noise function.. how would I apply it for a 3-Dimensional one? Setting y to 0 causes just a huge, tall chunk to be made.

Also, just to ask, how would I go about merging different noise functions? Above, his library already supports merging different layers of noise and doesn't really give an explanation as to how I should do it. I'm assuming I could take the value of two noise functions, interpolating at 0.5 (basically getting the average of both) and then setting that as the new value?

Thanks for the help guys,
Matt.
[/quote]

If you read the second link, or the very end of the first one, it's purely about the 3D case. In the journal post, I didn't do Y-scaling and some of the terrain I generated reflected that fact, with lots of floating chunks. When dealing with noise, though, 3D is always just an extension of the 2D case, so I wrote that article from a 2D-case point of view in order to more easily demonstrate the concepts, and the 3D case just adds a dimension.

As far as merging and combining functions, I tried to write my library and the text articles using names as clear as I could. Layers can be combined using a wide variety of techniques including arithmetic operators (add, multiply, etc..), select/blend operations (very useful) and so forth. The docs page for the library describes the function of all the various functions, so reading those descriptions could be useful.

If you read the second link, or the very end of the first one, it's purely about the 3D case. In the journal post, I didn't do Y-scaling and some of the terrain I generated reflected that fact, with lots of floating chunks. When dealing with noise, though, 3D is always just an extension of the 2D case, so I wrote that article from a 2D-case point of view in order to more easily demonstrate the concepts, and the 3D case just adds a dimension.

As far as merging and combining functions, I tried to write my library and the text articles using names as clear as I could. Layers can be combined using a wide variety of techniques including arithmetic operators (add, multiply, etc..), select/blend operations (very useful) and so forth. The docs page for the library describes the function of all the various functions, so reading those descriptions could be useful.


Yeah, the second link was the one I was mostly focusing on.. so what would I have to do to 'scale' the noise along the axes? I noticed your ScaleDomain function allows the application of scaling along the different axes ("[font=Arial]domain scaling to the coordinates input to the function"), what does this actually do? Does it multiply the input co-ordinates by the scale factor? Sorry if I'm sounding stupid.. I've not really found a large amount of documentation online regarding 'scaling' the noise[/font].

Just one final question, I notice in you're library and documents you're using FBM noise, will the functions you're applying also work with perlin noise? I've not read much into FBM noise (I've only just managed to figure out what Perlin Noise is doing, so I'd rather stick with what I can use at the moment biggrin.gif).

Thanks for you're help,
Matt.
Yes, scale domain simply scales the input coordinates.

fBm (fractional Brownian motion) is just another fancy-pants term for standard Perlin noise built up as an additive fractal; when you see a stereo-typical Perlin noise fractal somewhere on the internets, you are likely seeing fBm. Perlin noise is actually one of two noise-generation methods, both of which are supported by my library: Gradient and Simplex noise. fBm is a type of fractal that can be used to combine layers of Perlin noise (or any other type of noise supported by the library) together. Other variants of fractal combinations researched by Perlin, Musgrave, etc... such as Ridged Multifractal and Billow are included as well.

Yes, scale domain simply scales the input coordinates.

fBm (fractional Brownian motion) is just another fancy-pants term for standard Perlin noise built up as an additive fractal; when you see a stereo-typical Perlin noise fractal somewhere on the internets, you are likely seeing fBm. Perlin noise is actually one of two noise-generation methods, both of which are supported by my library: Gradient and Simplex noise. fBm is a type of fractal that can be used to combine layers of Perlin noise (or any other type of noise supported by the library) together. Other variants of fractal combinations researched by Perlin, Musgrave, etc... such as Ridged Multifractal and Billow are included as well.


Aaaah, so in effect it's just another way to merge different noise functions? Wouldn't just adding the layers together produce the same output? Or does fBm do something different?

Also, just one more question about the scale function (promise!), I still don't understand how scaling by 0 causes the removal of floating islands.. wouldn't that effectively input the same values? E.g. a scale factor of one, with the input of 1, 14, 12 would produce (1x1) = 1, (1x14) = 14, (1x12) = 12?

Thanks again :D,
Matt.
All of the fractals in ANL operate mostly the same by summing layers together. However, there are differences. fBm scales each layer by a layer coefficient. Ridged Multi takes the absolute value of a layer before multiplying it by the layer coefficient and adding it in, for example. Simply adding several fractals together without the coefficient scaling will only tend to approach white noise.

As for the scaling of coordinates: since my algorithm perturbs a 3D membrane by a unique value per-cell, it can sometimes happen that cell A gets perturbed by one amount, making it open, while cell B directly above it gets perturbed by a different amount that keeps it solid. Voila, cell A is now a floating island above cell B. Scaling the Y coordinate means that cell A and cell B, and every other cell in the column of cells, are pertubed by the same amount, meaning that no cells will be made solid while cells under them are made open.

This topic is closed to new replies.

Advertisement