Search Unity

Best Way To Fake A Liquid's Flow

Discussion in 'Scripting' started by Nigey, Mar 19, 2019.

  1. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Hi Guys,

    I'm trying to find the optimal way to create a visual of water flowing dynamically from a container in different scenes. So the liquid will need to flow in the pathway water normally would. Only to a pseudo realistic degree. Mainly it needs to look right, and I need to be able to emit vapours from the liquid (particles).

    I've tried NVidia Flex Beta, which uses too much CPU when rendering liquids. I've tried mass raycasting from a source, and procedural generating a mesh from that, then attaching a substance designer liquid material with a slider for how many puddles there are, but it seems unrealistic from a practical perspective and doesn't take into account the height of terrain at all. I'm at a slight loss for ideas, and would appreciate any thoughts from you guys.

    Thanks!
     
  2. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
  3. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Hey asd, I tried using particles, but not animated textures. I'm with you on using multiple effects to get it looking right is a good idea. Like my trail of thought is first figure out how to dynamically place a water source somewhere, and then have it match the geometry around it, like buildings, terrain, all that stuff. I mean it doesn't need to be super accurate, but it will need to know there's a wall there type of thing, which would change the flow of the liquid. What you've said is definitely helping in some of the steps in making it look right, it's just making that dynamic somehow. Especially when it comes to the dynamic meshes directional flow.
     
  4. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
     
    Nigey likes this.
  5. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,129
    Yeah I was thinking about this. You could technically create a true liquid simulation in Blender/Max/Maya type thing and import it via this. The problem being that it won't react to any kind of geometry in the game. The only option I could think of with that would be to bundle Blender 2.79 in streaming Assets and literally ask it to do a low poly simulation at runtime, passing in what objects there are around with python, but even then it sounds a bit messy.
     
  6. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    If you want to simulate, you can also use houdini export
     
  7. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,432
    so your terrain is fully editable, and water sources can be placed anywhere?

    i'd maybe look into something similar like minecraft water, but using higher resolution 3d grid..
    so your scene would be voxelized, each cell is either 0 or 1 (blocked), then find some 3d simulation similar to this 2d version (so water flows to neighbor cells, if not blocked)


    others,
    this system had editable terrain and fluids https://forum.unity.com/threads/ter...hexagonal-infinite-procedural-terrain.174595/
    fluvio used to have some fluids, https://github.com/thinksquirrel/fluviofx
    probably too heavy https://github.com/Scrawk/PBD-Fluid-in-Unity
    dont know https://github.com/MangoSister/SPHFluid
     
    IgorPanchenko and lordofduct like this.
  8. ZibraAI

    ZibraAI

    Joined:
    Aug 3, 2021
    Posts:
    10
    Hey!

    Sure, there are a few ways you can create visuals of water flowing dynamically. Some of them are already mentioned in this thread.

    But we at Zibra AI have made a plugin that can do exactly what you want. And it doesn't even need baking. You just configure it straight in Unity in your scene, and it is simulated in real-time with little performance impact.



    The simulation itself runs on the GPU, so it takes almost no CPU time. And so, to measure performance impact, you want to profile GPU instead.

    Give it a try and join our Discord! We would love to see you there if you have some questions regarding our plugin or want to chat.