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

心不动则不痛 提交于 2019-12-03 23:41:40
Marcel Jackwerth

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.

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.

harrison partch

You should look at the Minetest source, specifically at the files noise.cpp and map.cpp.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!