I myself am creating a terrain generation algorithm and would be interested in knowing why others have chosen midpoint displacement over perlin noise. Minecraft is an example where midpoint displacement was preferred. If anyone knows why I would be glad to hear it.
-
2\$\begingroup\$ No one knows except Notch and/or other developers of Mojang. \$\endgroup\$– thedaianFeb 29, 2012 at 20:52
-
1\$\begingroup\$ If the decision wasn't completely random, and I doubt it was, then there must be a logical reason. I believe that the reason will be obvious to at least some people here. \$\endgroup\$– jcoraFeb 29, 2012 at 20:54
-
2\$\begingroup\$ The reason may just be to meet some internal design goal - it doesn't necessarily have to be for some technical reason that outsiders can deduce. \$\endgroup\$– KylotanFeb 29, 2012 at 21:10
-
2\$\begingroup\$ @Kylotan The way the question was worded before was unanswerable and off-topic for this website. See the FAQ, and see also: meta.gamedev.stackexchange.com/questions/626/… If you have a better edit for question, the link is above. \$\endgroup\$– John McDonaldFeb 29, 2012 at 21:19
-
2\$\begingroup\$ Currious where you read that Minecraft was using midpoint. Notch spoke differently: notch.tumblr.com/post/3746989361/terrain-generation-part-1 Granted that was ages ago and may have changed. \$\endgroup\$– LeniencyFeb 29, 2012 at 23:22
3 Answers
Different methods of fractal generation tend to produce terrain with different characteristics. The reason for their use could be stylistic rather than for any technical performance reason. Different algorithms also allow you to change different parameters to give the final result. I have no direct answer re: MD vs Perlin though, sorry..
Notch posted about this on his blog:
I used a 2D Perlin noise heightmap to set the shape of the world. Or, rather, I used quite a few of them. One for overall elevation, one for terrain roughness, and one for local detail. [..] But [it had] 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.
Here's some reasons to prefer midpoint displacement:
Midpoint displacement noise is meaningfully faster to calculate (in my experience).
And, Perlin noise has some biases; it only approximates full spectrum white noise but is closer to Gaussian; midpoint displacement may be generated with a uniform (or any) distribution.
But, as another answer said, it's my understanding that Minecraft does use Perlin noise; I don't see how you could efficiently implement midpoint displacement noise for Minecraft, where the map goes on forever. The advantage of Perlin noise here is that you can calculate it at any point without calculating any other points around it. For midpoint displacement, you have to generate it all at once, since you need the boundaries of each chunk to match.
(EDIT: Removed mention that midpoint displacement can produce wrapping heightmaps - Perlin can do this just as easily.)
-
\$\begingroup\$ you can also make wraps like this using any noise function \$\endgroup\$– SopelJan 23, 2017 at 21:03
-
\$\begingroup\$ @Sopel True, but isn't necessarily straightforward to do so e.g. with Perlin noise. \$\endgroup\$– GrumdrigJan 23, 2017 at 22:08
-
1\$\begingroup\$ it involves just modulo operation when calculating coordinates to use for gradient function. It can't get much easier than that. \$\endgroup\$– SopelJan 23, 2017 at 22:33
-
\$\begingroup\$ "Seamless" is a strong word for that, because that literally means it doesn't have seams. Midpoint displacement's edges are clearly visible, they are the same height, while you can't tell where perlin noise's are. \$\endgroup\$– BálintJan 23, 2017 at 22:39
-
\$\begingroup\$ @Sopel You are quite right. I hadn't done that before. I'll edit that point out of my answer. \$\endgroup\$– GrumdrigJan 25, 2017 at 3:23