Skip to content Skip to footer

Simulating Water over Terrain by ibobev

9 Comments

  • Post Author
    FrustratedMonky
    Posted February 6, 2025 at 5:29 pm

    Guess this explains why water effects in Minecraft are bit kludgy. It isn't so simple.

  • Post Author
    joproulx
    Posted February 6, 2025 at 5:36 pm

    Another take on fluid simulation (Coding Adventure):

    Rendering Fluids: https://www.youtube.com/watch?v=kOkfC5fLfgE

    I Tried Putting my Fluid Simulation on a Planet: https://www.youtube.com/watch?v=8nIB7e_eds4&t=817s

    GitHub: https://github.com/SebLague/Fluid-Sim?tab=readme-ov-file

  • Post Author
    h1fra
    Posted February 6, 2025 at 5:37 pm

    Game developers are truly on an other level

  • Post Author
    bodge5000
    Posted February 6, 2025 at 6:47 pm

    Off topic, but the post mentions needing terrain manipulation for resource gathering.

    I always thought animal crossing had a clever and efficient approach to this without any terrain manipulation. You can chop a tree, and it'll dispense logs, but only so many before it essentially has a cooldown. You get the feedback and the finite resources, without expensive terrain manipulation.

    Of course that doesn't work for every game, and really works better on smaller maps, but something worth considering. Terrain manipulation is pretty expensive, if your game doesn't need it it's probably better to do without (again, a generalisation)

  • Post Author
    elliotbnvl
    Posted February 6, 2025 at 7:05 pm

    This is super, super cool!

    I was experimenting with a similar idea recently with the help of o3-mini-high. I talked it through my idea for an algorithm, and it implemented and rendered it in 3D with no manual intervention (although I did prompt it a number of times):

    https://3d-water-sim.netlify.app/

    It's not perfect yet because I stopped playing with it, but it was improving significantly with each iteration.

    Fun fact, it implemented a working version of perlin noise correctly from scratch instead of pulling it from a CDN or something as part of this, for the terrain generation.

  • Post Author
    matheist
    Posted February 6, 2025 at 7:13 pm

    The waves when the water is first entering the area is called numeric dispersion, it's a consequence of discretizing. It can be mitigated somewhat by smoothing the entering wall of water so that there's not a sharp discontinuity.

  • Post Author
    pornel
    Posted February 6, 2025 at 7:43 pm

    Storing values at the edges of cells makes the math simpler, but unfortunately makes a GPU implementation harder.

    In this setup one edge update affects two cells, so the cells are no longer trivially independent. It's still possible to update cells in parallel, but it requires splitting the update into two checkerboard-like passes.

  • Post Author
    hgomersall
    Posted February 6, 2025 at 8:27 pm

    It's nothing like that complicated. They just need to retuculate the splines.

  • Post Author
    TheGRS
    Posted February 6, 2025 at 8:31 pm

    Neat dive on this topic, and I appreciate calling out Timberborn! I'm obsessed with that game currently, big big big recommendation if you haven't checked it out yet. The water physics are like another character in the game and figuring out how to dam up a bunch of water to use in your engines and to water your fields is an essential part of the gameplay loop.

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.