Jump to content

  • Log In with Google      Sign In   
  • Create Account

Procedural terrain generation - "stitching" noise together


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 voodoodrul   Members   -  Reputation: 130

Like
0Likes
Like

Posted 14 July 2013 - 11:04 AM

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!


Edited by voodoodrul, 14 July 2013 - 11:05 AM.


Sponsor:

#2 JTippetts   Moderators   -  Reputation: 8649

Like
1Likes
Like

Posted 14 July 2013 - 12:01 PM

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.



#3 voodoodrul   Members   -  Reputation: 130

Like
0Likes
Like

Posted 14 July 2013 - 01:16 PM

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. 



#4 Kylotan   Moderators   -  Reputation: 3338

Like
0Likes
Like

Posted 14 July 2013 - 02:19 PM

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/ )



#5 voodoodrul   Members   -  Reputation: 130

Like
0Likes
Like

Posted 14 July 2013 - 10:36 PM

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. 



#6 Norman Barrows   Crossbones+   -  Reputation: 2308

Like
0Likes
Like

Posted 15 July 2013 - 09:02 AM

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

 

 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS