Search Unity

[WIP] SimWa - Dynamic Water Simulation

Discussion in 'Works In Progress - Archive' started by Rotary-Heart, Sep 18, 2015.

  1. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    SimWa is a water simulation plugin that creates the simulation based on a height map. The goal of SimWa is to facilitate 3D water simulation on non-plane objects. SimWa can generate rivers and lakes. The plugin follows the height map data to generate realistic water flow depending on water input amount, water displacement equation, and water input coordinates. It's all calculated by the shaders, so there's almost no CPU usage. It only uses the Update function to call the different shaders to calculate the water flow and set the water input information.

    Currently SimWa generates water flow on a 2D environment only.



    WebPlayer Demo available!

    To do list
    1. Option to chose water area instead of using full height map.
    2. First 3D implementation
    Current features
    1. Heightmap recalculation, can be used when rebuilding terrain on play mode
    2. Full water simulation based on height map.
    3. Water input coordinates can be adjusted.
    4. Shader code, no CPU heavy algorithms.
    SimWa started as a project to understand Unity shader programming. The first phase of the project was to calculate color displacement of a bunch of red pixels at the middle of a plane.
     
    Last edited: Sep 30, 2015
  2. Omplay.net

    Omplay.net

    Joined:
    Apr 4, 2014
    Posts:
    15
  3. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Yes, it could be used for that game, but IMHO (at least for what I could see with the screenshots) you are better using a normal water plane since your water surface is flat. This plugin goal is to generate water flow in not flat surface, like a terrain.
     
    theANMATOR2b likes this.
  4. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
  5. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    That's some interesting project. I'm definitely going to check it out.

    The main goal is to model the water flow so that any game can easily have rivers running around the terrains/models. But after seeing that project, including water erosion could be an interesting thing to do. This could be added to a future todo list. I first need to study how good that could be for a game and how much GPU/CPU demanding it could be.
     
  6. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Well I already fixed the water restarting on heightmap changed! This means that you could modify the terrain in play mode, call the function to update the water field and it will update the water field without restarting the water.

    I also made my first 3D implementation and it works well. I will create a video and update the demo web player this week.
     
  7. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Demo updated. Now the water doesn't recalculate when the height map is changed. I also uploaded a video of the first 3D test. Here's how its working so far.

     
    moure likes this.
  8. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Second video showing the water flow in a bigger terrain:
     
    protopop likes this.
  9. Plum3r

    Plum3r

    Joined:
    Sep 21, 2015
    Posts:
    1
    is this somewhere available?
     
  10. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    No, I had to abandon this project
     
  11. AnipGames

    AnipGames

    Joined:
    Nov 27, 2018
    Posts:
    34
    Since you had to abandon this project, would it be possible for you to share the source code of what you created so far? I've been looking for a solution as good as this and it would be great if I could work on this and continue developing it.
    Thanks!
     
  12. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    I cannot since it is being heavily used for non game simulations, so currently is not viable for any real time game, but you can follow the posted solution above https://github.com/Scrawk/Interactive-Erosion it's a really good solution and probably faster than what I ended up doing.
     
  13. AnipGames

    AnipGames

    Joined:
    Nov 27, 2018
    Posts:
    34
    Ah ok, I'll go check it out. Thanks for the help!
     
    Rotary-Heart likes this.