15

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?

MrLore
  • 3,759
  • 2
  • 28
  • 36
Xavier
  • 8,828
  • 13
  • 64
  • 98

2 Answers2

44

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.

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
13

Well, Minecraft is about Mines. So, what Notch tried to solve was: "How do I get holes / overhangs in my world?"

Since 2D perlin noise generates nice/smooth looking hills, 3d perlin noise will generate nice/smooth hills and nice holes in your 3D voxel grid.

An implementation can be found here (while that is an N-dimensional solution).

In other use-cases the Z component of a 3D perlin noise is set to the current time. This way you will get a smooth transition between different 2d perlin noises and that can be used as groundwork for fluid textures.

jpaugh
  • 6,634
  • 4
  • 38
  • 90
Marcel Jackwerth
  • 53,948
  • 9
  • 74
  • 88
  • 1
    The link is broken, archive.org thankfully has one snapshot from 2008: http://web.archive.org/web/20081118194515/http://peter.grumpykitty.biz/perlin.html – Tyron Oct 20 '15 at 12:31
  • @Tyron Thanks! Added it to the answer text – jpaugh Dec 02 '15 at 22:28