weigert / SimpleHydrology

Procedural Hydrology / River / Lake Simulation
611 stars 43 forks source link

Clarification for updates on the flood algorithm #7

Closed mazeyu closed 2 years ago

mazeyu commented 2 years ago

Hi, Great work. I am curious what do you mean in the last update by "flooding is activated but the spill number is set to zero (effectively off - not fully satisfied with the water table computation system)"? Thanks!

weigert commented 2 years ago

Hi. I'm happy to elaborate.

Basically the current flooding system has a number of limitations, most importantly that it is quite slow because of its globality. Also getting it to behave correctly at drainage points is super difficult, because of small height fluctuations in flat areas causing slow processing.

I currently flood by trying to fit a plane with sufficient volume underneath. But if I find a drainage point, I move the remaining water there. The problem is: What if I try to flood somewhere that isn't a local minimum? Also, if it is only a weak local minimum, then the drop will go through a number of spilling steps and possibly fail to find a plane. Generally this makes it slow.

So I want to come up with a different solution where I don't try to enforce a globally stable flood with a plane, but allow for water which doesn't necessarily exist in a pit. The solution is to do something like a water automata. This also allows for things like floodwaves. I am implementing the new flooding system here currently, but might port it back to SimpleHydrology when its done.

mazeyu commented 2 years ago

Thanks for your reply! (though I haven't understood every detail) Looking forward to your new version!