Search Unity

FLOW ️➖ Fast Fluids

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

  1. darthpewder

    darthpewder

    Joined:
    Feb 27, 2013
    Posts:
    10
    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:
    2,709
    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:
    2,709
    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 :)
     
  4. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    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:
    2,709
    Yes, the surface material now has the 'Sink' setting, which can control this :)
     
    khos likes this.
  6. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,159
    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:
    2,709
    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:
    2,709
    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:
    2,709
    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:
    8
    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:
    2,709
     
  14. drumminhands

    drumminhands

    Joined:
    Apr 4, 2020
    Posts:
    8
    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:
    2,709
    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:
    8
    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:
    2,709
    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?
     
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,709
    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,159
    Hope you don't mind to share, I'm making some of my vehicles float :) pretty cool feature.

     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,709
    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:
    2,709
    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:
    30
    can you share android build?
     
  25. tcymtz

    tcymtz

    Joined:
    Oct 7, 2019
    Posts:
    1
    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:
    2,709
    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:
    274
    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:
    2,709
    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:
    127
    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:
    2,709
    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:
    127
    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:
    2,709
    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 :)
     
unityunity