Water simulation in Arcane Worlds

I’ve finally decided on the name for my Magic-Carpet-like game. It’s called Arcane Worlds now.

This week I improved old water simulation and implemented water rendering with flowing foam. It still needs some work on shallow water (make it transparent) and improvements where it touches the coast.

This entry was posted in Arcane Worlds and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

7 Comments

  1. Reload
    Posted February 27, 2012 at 18:39 | Permalink

    Hi!

    I am very impressed by your technical demo and very interested by your technical posts…

    I am working on a similar pet project and have wanted to implement a water simulation like yours. So I’ll be very interested by a post on your water simulation implementation. Please ! :-)

    Is it based on the technique you described in your erosion post? Is it GPU based? (I don’t think so, by the way the CPU usage evolves when adding water in the demo). Anything you might say regarding the technique you developped would be great to read!

    Oh, I forgot : Well done!

    • Posted February 27, 2012 at 20:09 | Permalink

      It’s CPU-based grid processing algorithm.
      Each grid cell has water amount (height), flow speeds (x/z) and foam amount.
      Amount of water is defined in the cell center, while flows are on the (positive direction) edges.
      So each cell has 4 flows for each edge, but 2 of them are shared with neighbors.

      Basically, the flows are accelerated with gravity, and then water is transferred out of the cell to neighbors based on the flows.

      • Reload
        Posted February 28, 2012 at 13:22 | Permalink

        Hi,

        Thanks for the info!

        May I ask what’s the size of your grid?
        And what the foam amount is based on and used for? I’d say that the amount of foam is proportionnal to the flow speed and used to help visualize the direction and speed of the flow, but it’s pure speculation!

        How are you mapping the foam texture? Are you just offsetting the UV coordinates by the flow speed x delta time?

        • Posted February 28, 2012 at 16:09 | Permalink

          The grid is 256×256, just like land heightmap.
          It’s rather small, yeah. But it allows to run complex procedural generation methods in short time, and water simulation doesn’t consume too much CPU too.
          I might increase it to 512 later if performance tests will show it’s OK for most people.

          The foam amount is increased when gravity acceleration is applied, and in special cases like “hitting a wall”. It then fades out with time.
          Yeah, the foam is there to give a feeling of flow. The mapping is randomly shifted and rotated and then advected by flows for a short time. There are two mappings actually, cross-fading continuously because with long advection time a mapping becomes too distorted.

          • Reload
            Posted February 29, 2012 at 14:02 | Permalink

            Thanks for the reply!

            I’m on my way trying to implement this myself!

            Thanks again for sharing!

          • Posted April 22, 2012 at 11:46 | Permalink

            The expertise shines through. Thanks for taking the time to asnewr.

  2. Reload
    Posted April 23, 2012 at 13:01 | Permalink

    Hi,

    thanks to you I did this last month : http://www.youtube.com/watch?v=1hti5VgKZ6s

    Thanks again!

One Trackback

  1. By Water simulation on the GPU | Reload's Blog on March 22, 2012 at 15:56

    [...] by this anf this, I implemented a water simlation on the GPU. It still a WIP, but here are the first showable [...]