welcome to my new exciting attempt at journaling my scientific experiments. Today I tried to write an "erosion simulator". First, I read and implemented a bachelor's thesis written by Beyer from Technische Universität München. I almost but couldn't quite get it to work, so I read through some C++ code by Volynskov, copied it, and was able to create a successful demo. After a bit of parameter tweaking, I was able to make some cool erosion maps but they did not really fit the scale of Pavala's world map, and didn't create good looking river valleys.
So then I had help from IRC - shimao gave me the great idea of creating a 'density map' where I keep track of how many times a water particle has visited a pixel on the map, and then use that to increase the amount of erosion. This created some interesting effects, and this new way of thinking was how I stumbled on a procedural hydrology article by Nick. He makes use of 'density maps' (he calls them stream maps) and also uses pool maps, which keeps track of where lakes are. I decided to implement the first phase of his work, "simple particle based hydraulic erosion". It seems to work better than Volynskov's code, however it's a lot slower on Python and I can't move forward with development without porting to either C# or C++. Most likely I'm going to port it to C#/Unity so that I can easily create real-time visualizations, and I'm also more comfortable with parallel programming / multithreading / shader coding in C#/Unity if I decide to try and optimize it that way. But I'll drop the code below in case anyone wants to test it out.
You can run Nick's algorithm in main.py or you can run Volynskov's algorithm in old/attempt1.py. The latter is way faster.
Erosion simulator
Erosion simulator
- Attachments
-
- central_small-out_ct.png (17.67 KiB) Viewed 6350 times
-
- gradient-out-density.png (53.03 KiB) Viewed 6350 times
-
- gradient-out_ct.png (12.46 KiB) Viewed 6351 times
-
- erosion-sim.zip
- (1.13 MiB) Downloaded 293 times
"I cannot fix on the hour, or the look, or the words, which laid the foundation. It is too long ago. I was in the middle before I knew that I had begun." - Mr. Darcy
Re: Erosion simulator
ported it to unity today, works a lot better now
more links
https://agupubs.onlinelibrary.wiley.com ... 10GC003121
https://old.cescg.org/CESCG-2011/papers ... Balazs.pdf
more links
https://agupubs.onlinelibrary.wiley.com ... 10GC003121
https://old.cescg.org/CESCG-2011/papers ... Balazs.pdf
"I cannot fix on the hour, or the look, or the words, which laid the foundation. It is too long ago. I was in the middle before I knew that I had begun." - Mr. Darcy