Hello, I’m using the panda3d perlin noise function to make a heightfield map for my game and I was wondering how I would make it so that all the maps fit in with each other. My code looks like:
This makes an image which works fine for my heightfield but I’m stuck on where to go from there to make another which carries it on I saw some topics that explained stuff about offsets or something but I have no idea what to do.
I don’t think Panda’s Perlin Noise classes support tiling like this. I guess one option is to generate your entire world in a single really big PerlinNoise object, and subdivide it for each heightfield as you create it. This of course puts a specific upper limit on the size of the world.
If you want to have infinite connectivity, you will need to find a different noise generator. You can implement something like this in Python, but you’ll have to Google for a suitable algorithm.
Thanks for the response. I think subdividing it would be the best way to go about it. Sorry if this is a dumb question but how do I know the size of the PerlinNoise object? At the moment I just use the .perlinNoiseFill() method for a PNMImage and I run into problems if I make it too big.
Is there a better way of making a heightfield that can be divided into parts? I don’t have a problem with it not being infinite, having one built in is really useful.
The PerlinNoise object doesn’t have a size; it’s continuous. The PNMImage you create has a size, though, and the PerlinNoise object automatically scales to fit that size. If you want more pixels, create a larger PNMImage. You can easily subdivide from a really big PNMImage into a smaller piece for your heightfield with PNMImage.copySubImage().
I couldn’t say whether this is a particularly good way to create a large heightfield. It seems like it should work, though.