Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is a 3d perlin noise function used to generate terrain?

I can wrap my head around using a 2D Perlin noise function to generate the height value but I don't understand why a 3D Perlin noise function would be used. In Notch's blog, he mentioned using a 3D Perlin noise function for the terrain generation on Minecraft. Does anyone know how that would be done and why it would be useful? If you are passing x, y, and z values doesn't that imply you already have the height?

like image 856
Xavier Avatar asked May 22 '11 23:05

Xavier


People also ask

What can Perlin noise be used for?

Perlin noise is a popular procedural generation algorithm invented by Ken Perlin. It can be used to generate things like textures and terrain procedurally, meaning without them being manually made by an artist or designer. The algorithm can have 1 or more dimensions, which is basically the number of inputs it gets.

What does Perlin noise return?

PerlinNoise returns a “float Value between 0.0 and 1.0” yet warns that “it is possible for the return value to slightly exceed 1.0f”.


1 Answers

The article says exactly why he used 3D noise:

I used a 2D Perlin noise heightmap... ...but the disadvantage of being rather dull. Specifically, there’s no way for this method to generate any overhangs.

So I switched the system over into a similar system based off 3D Perlin noise. Instead of sampling the “ground height”, I treated the noise value as the “density”, where anything lower than 0 would be air, and anything higher than or equal to 0 would be ground.

like image 102
Oliver Charlesworth Avatar answered Sep 21 '22 08:09

Oliver Charlesworth