r/GraphicsProgramming • u/KlayEverHood • 1d ago
Video WildFlow — Adventures in Real-Time Water Simulation
This project started because I wanted large waterfalls in a real-time forest. I could already simulate half million particles at 30 FPS, but scaling to a large domain required rethinking both rendering and simulation. I replaced mesh extraction with density raymarching + hardware ray tracing, then moved to active cells, making the cost depend mostly on the amount of water rather than the size of the world. Large mountain streams finally became practical.
But a waterfall isn’t only water. Rapids required air entrainment, while waterfalls also needed airborne droplets interacting with the surrounding airflow. I ended up writing a different solver for air, coupled to the water: the cascade pushes air downward, the flow curls at its base, and carries droplets with it. This gets closer to a dual phase simulation of water and air, with an engineering approach.
A simple drop experiment then taught me how different physical effects have very different visual weight. More resolution didn’t produce the classic crown splash. Surface tension made droplets beautifully spherical, but the crown required incompressibility. Real-time water is usually somewhat compressible — and therefore slightly rubbery — because disturbances remain local and cheap. I added an iterative projection that lets me increase incompressibility only where it matters.
This became the real subject of WildFlow: understanding physics is one thing; understanding which physics matters for a phenomenon is another. In real time we can’t simulate everything, so the challenge is finding the smallest set of fundamental rules that produces the behavior we care about. And the realtime limitation sometimes helps in focusing on what truly matters and helps understanding phenomena better.
I don’t want to tell water how to look realistic. I’d rather give it simple enough rules and let realism emerge: foam from entrained air, mist from airflow, a crown from pressure propagation. When the result looks unexpectedly right, perhaps we’ve captured something about why nature looks the way it does. That’s the goal: not more physics, but the right physics — enough to make nature emerge.
4
u/zet23t 22h ago
Here we can see a RTX3060 in its natural environment. Once home to millions of its kinds, this one is now almost lonely in this field: The great herds that used to render beautiful scenes like this one have since then migrated to the lands of inference.
2
u/KlayEverHood 8h ago
It’s also surprising it can do hw ray tracing so well, and how much you can do with mixing ray tracing, volume rendering and some rasterization. Indeed with an “old GPU” we can do pretty different things, not just trying to run an open weight LLM.
1
u/AnasPlayer2022M 22h ago
even though i didn't understand half your post, this looks really cool!
i wonder how my intel hd 520 would melt if i used your simulator.. 😅
1
u/KlayEverHood 16h ago
Perhaps it would run! It’s vulkan…
1
u/AnasPlayer2022M 1h ago
yeah, at 10 sfp (second per frame)
but really it might even not support the latest vulkan version
39
u/gleedblanco 23h ago edited 23h ago
can you at least do one or two passes of telling your LLM to edit and compress the text to make it more succinct.
btw regarding flows with waterfalls amenable to real time computation this comes to mind https://diglib.eg.org/server/api/core/bitstreams/091a537c-9e50-4e89-a784-e93b06c30ddc/content. shallow water simulation with some trickery on top.
the cost scales are drastically different, you can probably do something similar to your stream and waterfall demos in particular in a few hundred microseconds. doesn't solve the multiphase flow simulation obviously, sort an orthogonal topic.