Procedural terrain generation - "stitching" noise together

Started by
4 comments, last by Norman Barrows 10 years, 9 months ago

I'm sure I'm coming at this from the wrong angle, but I wanted to know, if you use a chunked rendering scheme and Simplex or Perlin 2D or 3D noise, what's the best way to create a continuous map without ever building the entire world map? Should I offset the base seed by adding the chunk's position (x,y) to the seed and build a new map for that chunk? If I do that, the two neighboring maps won't blend with each other.

I thought about blending the two maps using another pass that takes map A's edge values and seeds the neighbor's edge map with the same ones, but I think I just don't know how to use noise maps properly.

In my mind, I have a limited amount of space to store one complete 2D perlin noise map. I use that for the entire world, but clearly that's not going to get me to "infinite"..

Any help is appreciated!

Advertisement

You don't really need to do anything weird or tricky like you imagine if you are using Perlin noise. Perlin noise is continuous across the entire range of float/double (whatever you use) and while it does have a period due to the underlying implementation, you can use hashing tricks to make the period so large that it might as well be infinite as far as the player is concerned. If you use double precision coordinates, your world will be continuous and effectively infinite. At that point it's a simple matter of mapping out sub-regions to a discrete map chunk to get your geography.

You don't really need to do anything weird or tricky like you imagine if you are using Perlin noise. Perlin noise is continuous across the entire range of float/double (whatever you use) and while it does have a period due to the underlying implementation, you can use hashing tricks to make the period so large that it might as well be infinite as far as the player is concerned. If you use double precision coordinates, your world will be continuous and effectively infinite. At that point it's a simple matter of mapping out sub-regions to a discrete map chunk to get your geography.

Thanks! Looks like I was overcomplicating things.. The perlin noise algorithm I was using was designed to generate the entire map in one go. I'm now trying to hijack https://code.google.com/p/mikeralib/source/browse/trunk/Mikera/src/main/java/mikera/math/PerlinNoise.java for this purpose, but it seems highly optimized code and difficult to interpret the algorithm. I'll keep plugging away on it until it works.

As mentioned above, noise generated by a mathematical function will extend continuously no matter how large the region, so if the only input into your noise algorithm is the x,y position in the world, you can generate it in chunks the same way that you'd generate the whole world - just ensure that the x,y positions that get used are offset based on the chunk location.

But if you use different seed values for different areas - eg. to implement biomes or some sort of designer-specified input - then you essentially have separate regions that will be discontinuous. I solved this by using bilinear blending so that every point is actually a mix of the 4 nearest regions.

(That sort of thing seems to come up a lot - in this thread here http://www.gamedev.net/topic/643213-procedural-terrain-and-biomes/ and in my thread here http://www.gamedev.net/topic/639342-infinite-terrain-generation-in-chunks-need-hints-on-handling-chunk-edges/ )

As mentioned above, noise generated by a mathematical function will extend continuously no matter how large the region, so if the only input into your noise algorithm is the x,y position in the world, you can generate it in chunks the same way that you'd generate the whole world - just ensure that the x,y positions that get used are offset based on the chunk location.

But if you use different seed values for different areas - eg. to implement biomes or some sort of designer-specified input - then you essentially have separate regions that will be discontinuous. I solved this by using bilinear blending so that every point is actually a mix of the 4 nearest regions.

(That sort of thing seems to come up a lot - in this thread here http://www.gamedev.net/topic/643213-procedural-terrain-and-biomes/ and in my thread here http://www.gamedev.net/topic/639342-infinite-terrain-generation-in-chunks-need-hints-on-handling-chunk-edges/ )

Awesome. This was my next logical question and it's good to know that blending nearest regions is a legitimate way to go about it - when needed.

you can also use a two pass seam fixing algo (north-south averaging , the results of which are then fed into east-west averaging) to average seams together from heightmaps of any type, even from different sources such as 2d bitmap and procedural perlin.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

This topic is closed to new replies.

Advertisement