Generate river noise with tanh(x^2) smoothing
7ERr0r opened this issue ยท 6 comments
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
@Szperak looks interesting... in which file did you use that code? Any chance you could post a screenshot?
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).
Okay, I see, what's the problem.
http://screenshot.sh/mMbFM4D2PVyCe
http://screenshot.sh/mKLpLMNlPfQfE
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.
@Szperak I'm closing this, but it sounds like Kdot will keep this in mind for future reference, so thanks for posting ๐