Realistic Terrain Generation

Realistic Terrain Generation

3M Downloads

Generate river noise with tanh(x^2) smoothing

7ERr0r opened this issue ยท 6 comments

commented

float strength = Math.tanh(Math.pow(noise2d(x/1337, z/1337), 2));

Code above gives good results and does't use veronoi magic.

How it works? Google for y=tanh(x^2)

PS: My second name is 7ERr0r

commented

@Szperak looks interesting... in which file did you use that code? Any chance you could post a screenshot?

commented

I used it in my bukkit plugin, here's the old screenshot from developement:
http://screenshot.sh/oBD0xFZKFOIMj
Rivers are intentionally larger in this generator.
Edit:
http://screenshot.sh/n9nqYMWDdP2He Water on the right is a river.
http://screenshot.sh/ofo5Zibx0Y7Oy

Description how i'm generating it:
If you have noise varying from -1 to 1, then point, where the function crosses zero will be a river.
Then you have to simply convert from regular noise to continous valleys using tanh(x^2).

commented

Lol @ 1337

commented

There are definitely a lot of nice properties to this river generation, but one of the main things is that, if you notice, all river intersections are of an even number of paths. The reason for this is that the rivers occur at values near zero in the noise, thus each river has a negative region on one side and a positive region on the other. And when rivers intersect, that's two negative regions and two positive regions coming together. There are ways to resolve this (i.e. using three noise instances and doing something that involves a triangle) but then that produces triple and quad intersections that look different from each other.

Definitely think tanh(x^2) is an interesting trick that I'll have to keep in mind though for other parts of the terrain generation, though.

commented

@Szperak I'm closing this, but it sounds like Kdot will keep this in mind for future reference, so thanks for posting ๐Ÿ‘