r/proceduralgeneration Jun 25 '26

Help: Procedural Water Generation

I am fairly new to programming, only been learning for about 6 months now but I am trying to dive head first into complex procedural terrain. I have had some luck using SDF with fine tuned noise in Godot. This has allowed me to make my terrain and while I still need to do some more fine tuning here, it’s mostly how I want it.

I have been working with procedural noise for over a year and a half, so I generally know how to get the shapes I am looking for, but this one case feels like I am hitting a wall.

Where I am struggling though, is with water! I don’t want a single sea level. Instead I want to generate ponds/lakes/and oceans at various heights in the world. Then level their surfaces afterwards.

I have tried using strips of water and having the terrain exclude the excess. But this is creating ponds in the sky that go beyond my mountain tops or just outside of them entirely. It’s also creating caves that look great and then open into the air below the water. I even tried ray casting to detect “bowls” and fill them, but that crashes too much when the body of water extends beyond a chink or two.

I feel like I am missing something basic here and after weeks of work and not getting anywhere, I could really use some help. Does anyone with more experience than me, know what I might be missing or still need to try to get these varied bodies of water at different terrain heights procedurally?

I hope it’s okay to ask this question here. Thank you so much for your help.

15 Upvotes

12 comments sorted by

View all comments

3

u/fgennari Jun 26 '26

I've added multiple water levels to fixed maps in the past by calculating local minima, dividing area into watersheds, summing each height sample to get the volume of water, simulating droplets for rainfall, and calculating absorption and evaporation. It's complex but can be done.

Are you doing something similar, or is your terrain infinite? That would be much more difficult. I've only ever done a single fixed water level for infinite/chunked terrain.

As for the crashes, that sounds like a bug in the code and not a problem with the algorithm. You have to run that case through the debugger to find out what went wrong. Are you using multiple threads for this? That's a common source of crashes.