具有真实高度图的地形生成
Terrain Generation with Realistic Height Map
我找不到为地形生成器添加真实感的最佳方法。在这一点上,我有一个可以完美工作的洪水填充,但是如果我想添加任何类型的真实感,我将需要添加高度变量。我已经看到以下尝试制作高度图的方法:
- 构造板块https://experilous.com/1/blog/post/procedural-planet-generation
- Simplex/Perlin噪音
- 菱形平方算法
现在我正在通过我的洪水填充生成板块,但我不确定从那里去哪里。
我不确定是否要使用噪声函数,因为我需要在大陆内生成生物群落以使其看起来逼真(只有山脉的大陆是不现实的)。菱形方形算法可能无法满足我的需求,因为我想灵活调整大小。
如果我有方形瓷砖以提供一些真实感,而不是非常耗费资源,并且保留我拥有的代码,那么生成高度图的最佳选择是什么?
这里是生成的图片,生成代码在Github项目中:
https://github.com/Hunterb9101/TileWorkspace/blob/59fe1f28f019d7128c970772d1ef6bd30d63072c/Generation.png
tldr: 我会使用 perlin 噪声生成,并在生物群系上附加一些。
本文 article/tutorial 介绍了代码片段及其实现方法。为您的任务建议 最佳 算法完全取决于您的技能和最终结果目标。
然而,对柏林噪音的简要描述以及使用它时要牢记现实目标...
As with most terrain generation, noise functions are your friend -
Perlin and/or simplex noise in particular. I've implemented some
planetary terrain generation algorithms and although they are in 2d,
the resulting height / "texture" map could be projected to a sphere
rather easily. I assume conversion to hex format is not an issue
either.
My technique has been creating multiple noise layers, e.g. temperature
and humidity. Temperature is fused with a latitude coordinate, in
order to make the equator more hot and poles cold, while the noise
makes sure it's not a simple gradient. The final terrain type is
selected by rules like "if hot and not humid then pick desert". You
can see my JavaScript implementation of this here:
https://github.com/tapio/infiniverse/blob/master/js/universe/planet-aerial.js
As for the water percentage, you can just adjust the water level
height as noise functions tend to have a constant average. Another
option is to apply an exponent filter (useful also when generating
clouds, see my implementation here).
Another way to generate spherical terrain that came into mind (haven't
tested) is to use 3d noise and sample it from a surface of a sphere,
using the resulting value as the ground height at that point. You can
then weight that according to amount of water on planet and the
latitude coordinate.
I'll end with a link to one practical implementation of 3d planetary
terrain generation:
http://libnoise.sourceforge.net/tutorials/tutorial8.html
要生成任何随机样式的逼真地形,您将不得不使用某种噪声。在过去的项目中,我自己使用了菱形方块算法。然而,那只是简单地生成高度图。
如果需要更多轻松阅读,我会查看 this 有关真实地形技术的文章。
我找不到为地形生成器添加真实感的最佳方法。在这一点上,我有一个可以完美工作的洪水填充,但是如果我想添加任何类型的真实感,我将需要添加高度变量。我已经看到以下尝试制作高度图的方法:
- 构造板块https://experilous.com/1/blog/post/procedural-planet-generation
- Simplex/Perlin噪音
- 菱形平方算法
现在我正在通过我的洪水填充生成板块,但我不确定从那里去哪里。
我不确定是否要使用噪声函数,因为我需要在大陆内生成生物群落以使其看起来逼真(只有山脉的大陆是不现实的)。菱形方形算法可能无法满足我的需求,因为我想灵活调整大小。
如果我有方形瓷砖以提供一些真实感,而不是非常耗费资源,并且保留我拥有的代码,那么生成高度图的最佳选择是什么?
这里是生成的图片,生成代码在Github项目中: https://github.com/Hunterb9101/TileWorkspace/blob/59fe1f28f019d7128c970772d1ef6bd30d63072c/Generation.png
tldr: 我会使用 perlin 噪声生成,并在生物群系上附加一些。
本文 article/tutorial 介绍了代码片段及其实现方法。为您的任务建议 最佳 算法完全取决于您的技能和最终结果目标。
然而,对柏林噪音的简要描述以及使用它时要牢记现实目标...
As with most terrain generation, noise functions are your friend - Perlin and/or simplex noise in particular. I've implemented some planetary terrain generation algorithms and although they are in 2d, the resulting height / "texture" map could be projected to a sphere rather easily. I assume conversion to hex format is not an issue either.
My technique has been creating multiple noise layers, e.g. temperature and humidity. Temperature is fused with a latitude coordinate, in order to make the equator more hot and poles cold, while the noise makes sure it's not a simple gradient. The final terrain type is selected by rules like "if hot and not humid then pick desert". You can see my JavaScript implementation of this here: https://github.com/tapio/infiniverse/blob/master/js/universe/planet-aerial.js
As for the water percentage, you can just adjust the water level height as noise functions tend to have a constant average. Another option is to apply an exponent filter (useful also when generating clouds, see my implementation here).
Another way to generate spherical terrain that came into mind (haven't tested) is to use 3d noise and sample it from a surface of a sphere, using the resulting value as the ground height at that point. You can then weight that according to amount of water on planet and the latitude coordinate.
I'll end with a link to one practical implementation of 3d planetary terrain generation: http://libnoise.sourceforge.net/tutorials/tutorial8.html
要生成任何随机样式的逼真地形,您将不得不使用某种噪声。在过去的项目中,我自己使用了菱形方块算法。然而,那只是简单地生成高度图。
如果需要更多轻松阅读,我会查看 this 有关真实地形技术的文章。