You are viewing a single comment's thread from:

RE: Infinite Terrain Generator Demonstration

in #mathematics8 years ago

Very cool man, I can't see your code on my phone screen but I'm guessing Perlin Noise for the height map with something to colour it based on height. I made something like this for my current game project but only in 2d as I'm going for a top down look. You should try wrapping your map around a sphere, that would look awesome. :)

Sort:  

So I intend to do a full write eventually, but I'll add some detail here. The height map is determined by 3 noise channels with different settings blended together. A baseline Simplex Noise channel handles the gradual, continent spanning changes in elevation that produces a smooth slightly wavy landscape. A second Perlin Noise channel handles mountains and hills, and left to its own devices just gives an infinite mountain landscape. A third Simplex Noise channel just goes from 0 to 1, and controls "how much mountain" to add to the baseline noise. So it goes:

Height = GetBaseNoise() + (GetMountainNoise() * GetTransitionNoise());

This gives a smooth transition between noise types while allowing a lot of variation.

Color is handled by old school vertex colors for each triangle, informed by which biome the triangle falls into. It does this by two more noise channels that measure temperature and moisture (hot + dry = desert, hot + wet = jungle, etc). Each biome has its own color associated, and that color gets applied to the triangle. Triangles that have a steep slope are shaded for rock, and triangles just above the water line are shaded for beach.

Very cool man, you should definitely do a full write up. :)