|
okelly4408
|
 |
« on: October 16, 2012, 04:08:58 PM » |
|
Hello, I am currently messing around with procedurally generated planets and I have a problem when it comes to making accurate continent shapes. I have tried using noise and saying where noise>0 make ocean but this leads to very scattered land masses. I tried to use noise but take all of the positive values with in 4 spaces in an array and put them close to each other but this just results in very blobby un-realistic continents. I was wondering if anyone knew of a good way to define the shapes of realistic land masses. Any help is appreciated thanks!
|
|
|
|
|
Logged
|
|
|
|
|
Evan Balster
|
 |
« Reply #1 on: October 16, 2012, 07:00:30 PM » |
|
Perlin noise with a threshold has worked reasonably for me in the past; I'd look into the broader class of algorithms commonly used in the generation of heightmaps as a starting point.
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #2 on: October 16, 2012, 07:47:53 PM » |
|
Hmm when I tried that by setting all values above a certain point to land using a simplex noise function the following was returned: Which is far too heterogeneous to be acceptable...
|
|
|
|
« Last Edit: October 17, 2012, 12:11:39 PM by okelly4408 »
|
Logged
|
|
|
|
|
Grungi_Ankhfire
|
 |
« Reply #3 on: October 17, 2012, 12:01:55 AM » |
|
Have you tried using multiple scales of noise? I had a code that did that, just cannot find it at the moment, but you started by generating a low-frequency noise, which gave you 'blobby' shapes, then added details by layering higher frequency noises maps. Hope that helps! Edit: Also take a look at that article, great stuff on good-looking land mass generation http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/
|
|
|
|
« Last Edit: October 17, 2012, 12:08:11 AM by Grungi_Ankhfire »
|
Logged
|
|
|
|
|
Evan Balster
|
 |
« Reply #4 on: October 17, 2012, 08:25:35 AM » |
|
^ what he said.
If you use perlin noise you can add a weighting factor to each octave of noise; experimenting with these should give you some settings that create more "blobby" masses. You may also want to play with non-linear interpolation between samples if you do this, though. Linearly interpolated perlin noise tends to produce some cross-hatching artifacts aligned with the axes, which will be worse if you are giving more weight to higher octaves.
(Oh, and I notice you chose simplex noise -- if you are using a fixed number of octaves then computational complexity really isn't a problem! Unless you're generating a massive image the time taken by the algorithm shouldn't exceed a fraction of a second.)
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #5 on: October 17, 2012, 12:08:34 PM » |
|
Thanks a lot for the help, I tried what you were talking about (adding noise values with different frequencies) but the result is still very unrealistic... Here is the code, perhaps I am doing this incorrectly?: float map1 = (float) NoiseTest.noise((vertices[i].z/radius)/2, (vertices[i].z/radius)/2, (vertices[i].z/radius)/2); float map2 = (float) NoiseTest.noise((vertices[i].x/radius), (vertices[i].y/radius), (vertices[i].z/radius)); float map3 = (float) NoiseTest.noise((vertices[i].x/radius)*2, (vertices[i].y/radius)*2, (vertices[i].z/radius)*2); float mapFinal = map1 + map2 + map3 ; and then all positive values for mapFinal are set to land and all values 0 and below are set to ocean... Here is a picture of the returned "world" for explanations sake: 
|
|
|
|
|
Logged
|
|
|
|
|
Fallsburg
|
 |
« Reply #6 on: October 17, 2012, 12:19:22 PM » |
|
So, I don't know where your noise function is from, but typically Perlin noise is calculated by something like: function PerlinNoise_1D(float x)
total = 0 p = persistence n = Number_Of_Octaves - 1
loop i from 0 to n
frequency = 2^i amplitude = p^i
total = total + Noise(x * frequency) * amplitude
end of i loop
return total
end function
Where Noise is a deterministic function that returns a random value for a given input. The problem you are encountering, is that your noise function isn't decaying fast enough (i.e. the persistence value is too high). This leads to higher frequency noise, which doesn't look like continents.
|
|
|
|
|
Logged
|
|
|
|
|
Evan Balster
|
 |
« Reply #7 on: October 17, 2012, 01:31:58 PM » |
|
By the way -- keep your noise value around, and make the world sandy where it's over the water threshold but not by very much. Voila! Instant beaches. You can do similar checks to snow-cap mountains.
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #8 on: October 17, 2012, 02:14:50 PM » |
|
Evan Balster: Oh yea that's a good idea..I have to figure out how to deform the coasts downward still so there aren't (as many) cliffs. I was just using the raw noise values but after using that snippet for calculation "perlin" noise I tried this: //octaves,persistence float noise1 = NoiseTest.calculateNoise(vertices[i].x/radius, vertices[i].y/radius, vertices[i].z/radius, 10, (float) .08, seed); float noise2 = NoiseTest.calculateNoise(vertices[i].x/radius, vertices[i].y/radius, vertices[i].z/radius, 10, (float) 1, seed); float noise = noise1 + noise2; if(noise > 0){ //apply land algorithm }else{ //keep constant }
And the following was returned, which I suppose is slightly better than the other attempt since you can start to actually see continent shapes: 
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #9 on: October 17, 2012, 04:15:51 PM » |
|
So just as a little update after tweaking the noise function I got this:  which is pretty good. Now for generating good coast lines would it be best just to interpolate between the land and the sea?
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #10 on: October 17, 2012, 05:26:04 PM » |
|
So I did what you suggested in terms of making the beaches:  I just need to make the coast lines smoother, interpolating between two coastlines yields strange results... Any suggestions?
|
|
|
|
|
Logged
|
|
|
|
|
Evan Balster
|
 |
« Reply #11 on: October 17, 2012, 05:52:39 PM » |
|
If you don't want cliffs, just base the height of the land on the output of the perlin noise, man. (Naturally it should bottom out at sea level) The reason perlin noise with a threshold is used is it simulates a heightmap flooded with water.  With regard to smoothing coastlines, two things that will help would be making some more inbetween levels for land/water in a narrow band of values near the threshold -- land, beach sand, watery sand, shallow sandy water (light blue?), deep water. You can also get rid of some of the "spininess" you see on the coastlines by de-weighting or removing the lowest (grainiest) octaves of noise and/or using a non-linear interpolation function, like this one. Also, please post that spiny world from earlier in the stickied "beautiful fails" thread. It's neat-looking.
|
|
|
|
|
Logged
|
|
|
|
|
Fallsburg
|
 |
« Reply #12 on: October 18, 2012, 02:26:04 AM » |
|
Just a note:
Not sure what you are using these planets for, but your terrain is very severe compared to what an actual planet would be. The Earth is smooth on the scale of the planet, smoother than a pool ball. So, if you are going for something quasi-realisitic, you are going to want to reduce your amplitude. Otherwise, keep doing what you're doing.
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #13 on: October 18, 2012, 04:25:28 PM » |
|
Fallsburg: You are right. The fractal terrain algorithm I wrote needs a lot of tweaking to make it realistic. Evan Balster: I will probably try out making more space between land and water and then slope it downward somehow...
Thanks for the advice, it is greatly appreciated.
|
|
|
|
|
Logged
|
|
|
|
|
okelly4408
|
 |
« Reply #14 on: October 18, 2012, 06:04:52 PM » |
|
Quick question: What do you think the best way is to apply the altitude generation algorithm to the continents as to avoid mountains cutting off at the coast and such?
|
|
|
|
|
Logged
|
|
|
|
|