Search Unity

FLOW ️➖ Fast Fluids

Discussion in 'Assets and Asset Store' started by Darkcoder, Jul 10, 2021.

  1. JuniorLongfellow

    JuniorLongfellow

    Joined:
    Feb 27, 2013
    Posts:
    19
    I own this and Planar Reflections 4. Any reason why they couldn't work together?
    PR4 includes a water shader. Thoughts?
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The water shader that comes with FLOW includes the water surface deformation required to show the fluid, therefore it's not compatible with any other water shader. To make other water shaders compatible you have to manually combine them (incredibly difficult). If the other water shader was developed using Better Shaders then combining them would be trivial though, but I don't think any other water shaders use this system yet.
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Hey everyone,

    Version 1.0.3 of FLOW is now out!
    • Fixed FLOW / Surface shader transparency breaking at far camera distances with low camera clip distance.
    • Added Blood Pooling demo scene.
    • Added Sink setting to FLOW / Surface shader.
    • Added WAVE / Strength Min setting to FLOW / Surface shader.
    • Added WAVE / Strength Max setting to FLOW / Surface shader.
    • Added WAVE / Strength Scale setting to FLOW / Surface shader.
    • Added TRANSPARENCY / Mode setting to FLOW / Surface shader.
    • Added TRANSPARENCY / Step setting to FLOW / Surface shader.
    • Added TRANSPARENCY / Max Steps setting to FLOW / Surface shader.
    • Added TRANSPARENCY / Depth Scale setting to FLOW / Surface shader.
    • Added TRANSPARENCY / Mode setting to FLOW / Underwater shader.
    • Added TRANSPARENCY / Step setting to FLOW / Underwater shader.
    • Added TRANSPARENCY / Max Steps setting to FLOW / Underwater shader.
    • Improved the smoothness of viscous fluid flow.
    • Improved fluid particle radius calculation.
    Lots of nice improvements to the fluid shader and sim in this version. The new StrengthMin/Max settings in particular allow the fluid surface to settle down to a smooth look, rather than constantly looking turbulent. I've also added the new Mode setting to the TRANSPARENCY section, so you can choose between performance and quality with different optical depth calculation techniques.

    More to come soon! Enjoy :)
     
    PutridEx likes this.
  4. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,487
    Congrats on the update :)
    Question if I may ask, is there an option to control the edges to act more normal, I find the edges are less "fluid", not sure if I explain it very well, here is a screenshot:

    The water should be flat all the way to terrain.
    Capture.PNG
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yes, the surface material now has the 'Sink' setting, which can control this :)
     
    Auraion and khos like this.
  6. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,487
    Hi, is there a description or tutorial of what each option is used for, I am interested mostly in the transparency ones. How to use them to control transparency? Thanks.
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yep, in this version I added all surface shader properties to the documentation HERE.
     
    khos likes this.
  8. yehiaserag

    yehiaserag

    Joined:
    Mar 8, 2018
    Posts:
    6
    Extremely impressed with the asset (didn't buy yet but checked store page), but does it have 2d support? and if not are there any plans to support 2d?
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You could render the 3D fluid side-on to make it render in a 2D scene, but there would be no 2D physics interaction, and it wouldn't look as good as a dedicated 2D version would. I don't think there's enough interest in 2D games in Unity to make developing a 2D specific version worth it.
     
  10. yehiaserag

    yehiaserag

    Joined:
    Mar 8, 2018
    Posts:
    6
    Do you think if I tried porting it to 2D it would take much effort?
     
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    It depends on what you want it to look like. Overall, it would be a similar amount of work as implementing the whole of the 3D version though. One advantage of 2D is that there are far fewer fluid columns required, so you could do it all on the CPU and get good enough performance.
     
  12. drumminhands

    drumminhands

    Joined:
    Apr 4, 2020
    Posts:
    9
    I could use some help getting started. I have the 2D buoyancy demo open. I moved the cubes up so it takes longer for them to drop. I hit play, and begin filling the water on the left before the cubes hit the surface. When I turn off the water, I get a really nice water ripple from the bottom left corner where the water is coming in. But, the cubes do not make a similar ripple.

    How do I make the cubes ripple the water as they enter the water.

    And how do I make it so my mouse click will ripple the water, similar to the video here at 0:17.


    Thank you.
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
     
  14. drumminhands

    drumminhands

    Joined:
    Apr 4, 2020
    Posts:
    9
    Thank you, but I'm still pretty new to the plugin. I'm not sure where to put the items you are suggesting. Anyway you can quickly make some screengrabs or a video of the setup? I really appreciate it. Thank you.
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Sure, open the "Island" demo scene, and check the PirateShip GameObject. It has a child called "Add Force", you can copy+paste this onto your own object as a child and it should work. Just make sure your pasted child has a Transform with a position of 0,0,0, Rotation 0,0,0, Scale 1,1,1. You can also see in the Scene view if it looks right, and maybe adjust the FlowModifier component's Size and FlowModifierSpeed component's Strength settings until it looks good.
     
  16. drumminhands

    drumminhands

    Joined:
    Apr 4, 2020
    Posts:
    9
    Thank you. I've been quite successful playing with different values to get different types of ripples. I found that adding fluid resulting in better looks than adding force. However, if I trigger two ripples, they don't seem to interact with each other. Is there a way to control that? I'd like when they connect, their momentum is changed.
     
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Do you have a video example of what you expect this to look like?
     
  18. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    95
    Any chance this asset could create breaking waves for surfing game one day?
     
    Haxel0rd likes this.
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    There’s no possibility for this kind of fluid simulation to make breaking waves that would be high enough quality for a surfing game.

    At best the waves could be made to curl a little bit at the front of the wave, but it wouldn’t look that good up close.

    The best way to make waves for a surfing game is to pre-render a really good particle based fluid sim into a mesh, and with some magic you blend it with the main ocean. This would give you very good visuals with very good performance, but it would be difficult to author and you would have limited interactivity.
     
    zeb33 likes this.
  20. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,487
    Hope you don't mind to share, I'm making some of my vehicles float :) pretty cool feature.

     
    Fibonaccov and ml785 like this.
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yeah please keep posting any and all progress! Looks really fun :)
     
    khos likes this.
  22. lessthanthreewizard

    lessthanthreewizard

    Joined:
    Oct 27, 2019
    Posts:
    16
    Hello. Any chance we can get a Windows build demo? WebGL demos don't play well on my laptop sadly. Thank you.
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Try THIS. WebGL tends to run slower than desktops builds though, so I think it's a better way to showcase my assets. Keep in mind this build is just a one-off, and I don't plan to maintain any standalone demo builds. I plan to redo the WebGL demo soon so it shows off more features.
     
  24. shahzaib

    shahzaib

    Joined:
    Dec 14, 2013
    Posts:
    32
    can you share android build?
     
  25. tcymtz

    tcymtz

    Joined:
    Oct 7, 2019
    Posts:
    2
    I noticed that you said it can cover kilometers. I am making a really large voxel world the size of Skyrim (approximately 37 square kilometers). I thought it would not be possible to do realistic flowing fluids and would have to resort to a solid water level like in Valheim. But when I saw this I thought it might be possible. Would this work for a really large voxel world?
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    No, FLOW only works with heightmap based scenes (e.g. terrain). Voxels can have multiple levels, caves, etc, none of which can be represented with a heightmap and therefore would not work at all with this asset.
     
  27. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    321
    I haven't purchased the asset yet, but I was wonder if I could use the shader/material with GeNa Rivers... you know, to blend river and sea.
    Can I use the two assets together in some way? :)

    Anyway, looks amazing and perfectly fit with my low-poly style game.
     
    Last edited: Oct 14, 2021
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You could probably use both assets at the same time, but there would be no possibility of blending them together or any cross interaction or anything like that. FLOW comes with a very complex shader that turns a basic flat grid water mesh into one that deforms and gets colored based on the underlying fluid data, so you cannot swap it out with another shader from a different asset that doesn't do any of these things.


    I'll consider it for a future version, I still want to improve the main demo scene a lot first.
     
    MaximilianPs likes this.
  29. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Hi there, is there any way that this could be networked by running the simulation on a server and syncing its values to the clients to keep in sync decently?
     
  30. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You could have the server send out information about FlowModifier components and other things that cause the simulation to change, then each client would see more or less the same thing. However, the fluid simulation is not deterministic, so over a long enough time span what each client sees may diverge. The only way to resolve this would be to periodically sync the data, but depending on your simulation size this could be many megabytes.

    I'm currently working on an update that allows for save/load of the fluid data, so you could use these methods once it's out.
     
  31. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Awesome, sounds good thanks! My simulation isn't massive in scale so that could work. I look forward to your update.
     
    Darkcoder likes this.
  32. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Hey everyone,

    Version 1.0.4 of FLOW is now out!
    • Fixed particles disappearing if they fall outside of simulation boundary.
    • Added Save Load demo scene.
    • Added Save Load / To File demo scene.

    The new FlowSnapshot component used for save/load should be useful for many games. The lower level FlowSnapshotData class can also be used for more complex things like networking.

    Enjoy :)
     
  33. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,487
    Hi, just a question, how can I achieve water/fluid splashes e.g. if an object enters/leaves the fluid? Can particles etc from the simulation be used to create that effect? E.g. there are foam / flow modifiers, how about splash modifier ? :) Any tips/advice would be welcome.

    And / or water running down/over on object.
     
  34. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,487
    Just a little video to share if ok, enjoying how I can make amphibious vehicles, although I plan to add some more flow modifiers for the wind effect on the water.. hovercraft:
     
    Fibonaccov and Darkcoder like this.
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The AddForce modifier can be used to do this. However, it's a little difficult to configure for freely rotating objects. I'll see experiment with some kind of system that works separately, and I'll send you a test build.



    Looking great! The more videos the better :)
     
    khos likes this.
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412


    Nailed it.
     
  37. Overlogical

    Overlogical

    Joined:
    Sep 12, 2020
    Posts:
    12
    Hi, do you think I could use Flow to create a working hourglas (sand as fluid)? Thx, Jan
     
  38. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,487
    A splash effect would be awesome.
     
    Darkcoder likes this.
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    No. An hourglass shape cannot be represented using a heightmap, therefore the fluid cannot flow over it.


    I sent you a new build!
     
  40. Overlogical

    Overlogical

    Joined:
    Sep 12, 2020
    Posts:
    12
    Thanks for your reply. Seems to be more complicated than on first sight.:confused:
     
  41. NestorVG

    NestorVG

    Joined:
    Feb 12, 2019
    Posts:
    34
    Hi, I have purchased the asset because it's just so cool, I want to try to use this on a physics-based low poly VR open-world survival game.
    -What is the easiest way to use this on multiplayer? I am going to use Mirror through Steamworks.
    -Would it be possible to have the simulation sectioned in cubic chunks for infinite worlds? For example, the same way that Minecraft works, in such a way that only the chunks that are close to the player are active and running the simulation, I would go as far as saying that it would be optimal to have a (spherical) radius of chunks that would be active, and then another radius of chunks with the simulation paused but rendering (I intend to use this with uTerrains, that is about to release a new version that uses marching cubes and has an infinite world procedurally generated)
     
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The easiest way to implement multiplayer is to sync the FlowModifier component settings and orientation you use to modify the fluid. If you do this then everyone is emitting/removing/etc fluids at the same time and location. However, this is guaranteed to go out of sync very quickly, so it's not a good idea to make the fluids such an important part of the gameplay where these kinds of differences would be game-breaking.

    To sync the fluid data you can use the FlowSnapshotData class, which can read/write all of the simulation data. However, if your simulation is large/detailed then this can be a LOT of data, so it may not be so practical to do. You might have to sync it in sections, and then everything will still keep going out of sync, etc.

    There's currently no way for simulations to interact with each other, therefore there is no way to do chunking. This is very difficult to implement, and will have performance overhead. You can kind of manually do chunking with the aforementioned FlowSnapshotData class.

    There will never be the possibility of using this system with voxel terrains.
     
  43. ml785

    ml785

    Joined:
    Dec 20, 2018
    Posts:
    119
    Hi, is it currently possible for a player to swim in FLOW water? Thanks!
     
    Haxel0rd likes this.
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yes. If your player uses a Rigidbody then you can add the FlowFloat + FlowSample component to it and it will have buoyancy. You can read the FlowSample component's Submersion value to see how far the player is inside the water if you need to change the animation or something.
     
    ml785 likes this.
  45. ght1875

    ght1875

    Joined:
    Jul 29, 2016
    Posts:
    32
    Does the shader support reflection probe and screen sapce reflection?
    Can I use shader graph to edit the shader?
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
  47. ght1875

    ght1875

    Joined:
    Jul 29, 2016
    Posts:
    32
    Is it possible to add a opaque fluid shader in future release? Dynamic object reflection can only rely on SSR. For mud like fluid, it does not need to be transparent.
     
    Last edited: Dec 5, 2021
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    This will be added in the next version.

    Also, I've improved the ship wake as it travels through the water.

    Here's a sneak peak of both in the standard pipeline:

     
  49. ght1875

    ght1875

    Joined:
    Jul 29, 2016
    Posts:
    32
    Awesome
     
    Darkcoder likes this.
  50. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    280
    Hello, i'm looking in the asset rn. Can you clear provide me some more info ?
    • Since it says add colliders to object and flow will work, does this mean you can rain water on an animated character ( with setup like character have colliders all over their body ) ? and for smaller surface like character's hair, we also have to setup colliders for them ? Or for subtle effect like this we'll have to look into other small-scale water sim ?
    • Can we have a workflow that let user add your water shader's functionalities into a custom shader, say shader graph so user can add their own thing ?
    Thank you
     
    Last edited: Dec 14, 2021