Search Unity

Fluvio - Fluid Dynamics for Unity

Discussion in 'Assets and Asset Store' started by lilymontoute, Jul 3, 2011.

  1. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    excellent support there.
     
  2. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    The hotfix is now live. If you run into missing behavior issues, opening and re-saving the problematic scenes should fix it.

    Thanks!
     
  3. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
  4. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    We've just released a hotfix for Fluvio (beta 6, hotfix 3) with the following:
    • [Fluvio Pro only] Support for compute shaders on Android devices using OpenGL ES 3.1+ and Unity 5.1+
    • Fixed a major regression where Resources.Load was getting called each frame
    We recommend this hotfix for all users.
     
    Last edited: Jun 9, 2015
  5. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    288
    It's still possible to use a Fluid rigidbody 2d? I need some water that reacts to the hole and big 2d scene colliders.
    I've tried using Fluvio, but it seems doesn't work that way.
     
  6. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi jocyf,

    2D rigidbodies are technically possible using a fluid plugin, but we don't recommend the workflow at this time. Using rigidbodies as fluid particles has performance implications and does not scale very well at all (any more than a few hundred rigidbody particles becomes prohibitively expensive to compute).

    For Fluvio 3, we've introduced the concept of boundary fluids, which can be achieved by setting sub fluids to kinemtic or static. Boundary fluids have the added bonus of being more physically accurate than particle collisions (in 2D and 3D).

    To create a static boundary:
    1. Create a new fluid and make it a child object of your main fluid (this will become a sub-fluid, meaning the simulation is shared between the two fluids)
    2. Set the sub-fluid to simulate in local space
    3. Set the sub-fluid to kinematic if the object needs to move, or static if it will remain still (for additional performance optimizations)
    4. (Optionally) Use a mesh emitter with the sub-fluid to emit in the shape of your object. Multiple primitive emitters can be used as well. For high-fidelity physical accuracy, I currently recommend making a small script that emits some particles in a regular grid (using a standard GetParticle/SetParticle or ParticleSystem.Emit calls)
    5. (Optionally) Hide the renderer of the sub-fluid, and position a visual mesh in the same area. You can combine world collision with sub-fluids (and this is recommended if your scene is in 3D).
    I highly recommend checking out the Three example in the Asset Store - it shows an effective way of using static fluids for boundaries. I also apologize for the lack of documentation here. Since release, we've recognized some issues/confusion with the workflow (our #1 support question right now is about implementing collisions properly). We're currently working on a Fluid Collider component that will automatically create boundary fluids for you, and provide a workflow a bit similar to Unity's colliders for much easier use. These can then be used in conjunction with 2D/3D colliders.
     
  7. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    Hi
    I can't make a fluid to collide with a sprite with a polygon collider. It passes through the sprite.
     
  8. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hey Grespon,

    Good news! The next beta will have support for 2D colliders. We don't support polygon colliders just yet, but box and sphere colliders will work.
     
    Last edited: Jul 17, 2015
  9. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    And beta 7 is out! Lots of updates here, including fluid colliders and a revamped waterfall. Also, some very awesome news for owners of the Free Edition :)

    Read all about it here.

     
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,362
    Super cool, waterfall looks much better now, great work :)

    Also cant wait for the fountains pack
     
  11. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Hi, the current way fluid colliders (2d) work is that you have to drag them under a parent (particle simulation) game object, right?

    I have the following case: I need to be able to move the emission point of the liquid WITHOUT moving the 2d collider. Unfortunately, since the 2d collider is attached to the particle simulation object, I can't do this.

    Is there any workaround for this?

    EDIT: In case it was unclear, what I need is to move around colliders WITHOUT affecting the spawn point of the fluid but also the other way around (move around the liquid WITHOUT affecting the colliders location)

    *** UPDATE ***

    I managed to 'almost' get it working with the use of the Fluid Group Script. But the FluidCollider2D Script just randomly stops working. Is there any way I can get this to work so I can move FluidCollider2D Objects and Fluid Particles Systems that interact with it independently?


    *** UPDATE 2 : IT'S WORKING ***

    Okay, well.. I got it working now.. I didn't realize I had to put the FluidCollider2D Script, the Particle script and the Collider all on the same object and group them with the FluidGroup Script to make it work. Works fantastic now! :)
     
    Last edited: Aug 16, 2015
  12. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Glad to hear you got it working! The Fluid Group component was created for this reason (to make groups that don't need to follow the hierarchy).
     
  13. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Hi, I have another question:

    Is it possible to select single particles and destroy them? I need this to simulate "sucking in" liquid through a tool.
    I tried the OnParticleCollision event but it only registers the GameObject with which the particle collided, not the particle itself.

    Is there any way to do this: Destroying single particles on collision (or trigger) with another Object?
     
  14. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
  15. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Thanks, this works perfectly! Unfortunately, I have another (hopefully the last one) issue:

    When I emit particles, like e.g. 500 in a burst, when they fall down and land on a FluidCollider2D (Box Collider) which I set as the ground floor, they will "leak" through the ground.. well.. some of the particles at least.

    I tried for 2-3 hours with EVERY setting and read the entire API documentation.. to no avail.. still they leak..
    I was planning on dropping liquid onto a bowl of some sort and then moving that bowl around as well.. is there any way to stop the leakage of certain particles? Any best practice or best settings to prevent particles from leaking through colliders?
     
  16. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Depending on your fluid, you'll definitely need to change collider settings. I recommend decreasing the density and increasing the gas constant for faster moving particles (this will make the actual boundary larger than it appears). If you use 3D colliders, you can pair them with Shuriken's collision functionality (which is a more explicit, but slower form of collision), which should catch everything.

    I do believe beta 7 has a bug with the solver where things can go a bit weird with filled volumes and at 0,0,0 though - you may also be running into one of these. Both have been fixed for the next beta, which is coming very soon (along with support for every collider type!)

    If you're having specific issues with your project, I recommend getting in touch via support.thinksquirrel.com. That way, we can offer more than just general advice.
     
    Last edited: Aug 19, 2015
  17. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Hey, thanks for the great support so far, much appreciated! :) I don't want to bother you any longer than necessary, but maybe it helps if I show you what "leaking" looks like with the following GIF. Notice how the pink liquid doesn't respect the green collider box:


    Here are the settings for the blocker (FluidCollider2D with Box Collider) and the pink liquid:



    My hope is that you see this and maybe realize what the issue might be..? If not, is there any ETA for the next beta, which may or may not fix things?

    Thanks again, anyways!

    EDIT:

    When I set the "Gas Constant" on the FluidCollider2D to 0, the fluid sinks completely into the Collider right away.. the behaviour I would need is basically super stick, non-bouncy liquid that doesn't randomly sink in or bounce off surfaces..
     
    Last edited: Aug 19, 2015
  18. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Yea, this is definitely due to a bug that has been fixed for beta 8 (notice the regular pattern of dips in the bottom line of the fluid). You can possibly work around this by adding a cube effector inside/under the box to destroy your leaking particles.

    No ETA just yet on beta 8, but expect it very soon (timeframe of a few days to a few weeks at the most).
     
  19. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    I see, that's kind of encouraging and I hope the next update will fix this. Which way can I access the beta 8 when it's done? Will it be released on the Asset Store or internally/via the forums?
     
  20. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    It will be available on the store (we're currently shipping public betas for Fluvio 3).
     
  21. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Alright, thanks again for your great support. Really looking forward to the fixed bugs and poly-colliders, as well :)
     
  22. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Hi, another short question:
    Using "effectors", how can I count the amount of particles that got affected by them?
    I need to register the amount of fluid that touches a certain area so that I can trigger an effect when the amount of fluid hit a certain threshold.

    Also (although not sure if at all possible) I would like to register the position of an affected particle the moment it gets affected (to spawn another object on this position).

    I know I could achieve this by using 3D-Colliders and OnParticleCollision() but I want to avoid that since I'm working on a 2D game and don't want to use two colliders on an object unless necessary.
     
  23. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi kbm,
    This is a little more involved, so I'd like to invite you to open a request by sending an email to support@thinksquirrel.com. We can definitely get you sorted out there. Thanks!
     
  24. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Beta 8 is here! Lots of performance tweaks and bugfixes. Also, support for all collider types!

    Read about it on our blog.

     
  25. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Even more updates, with beta 9! Getting very close to a final 3.0 release.

    For this release, we have:
    • Metallic PBR workflow
    • Sorting with transparent objects, other fluids, and sprites
    • GPU solver updates and updates to memory efficiency
    Check out the blog for more info! I'll leave you with a GIF, made in 30 seconds, running in realtime on a laptop, with over 16 thousand particles:



    Also, if you haven't heard - we'll be in Unite this year! Come check us out at our booth, where we'll be demoing Fluvio live.
     
  26. Xestrada

    Xestrada

    Joined:
    Jul 9, 2015
    Posts:
    4
    This seems like a very useful asset and I would eventually like to buy the standard version. Unfortunately I have not been able to get the free version to work at all. I've spent hours upon hours attempting to get it to work on multiple Pc's to no avail. Unity crashes anytime I try to do anything whether it be saving or opening another scene. The Liquid Particle Effector works only if OpenCL is used and doesn't work otherwise. I'm not sure if it's a problem only limited to my hardware or if it's the asset itself.
     
  27. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi Xestrada,

    Very sorry to hear about this issue! Can you send an email to support@thinksquirrel.com? We'd like to take a look at the problem in detail and help you get up and running.
     
  28. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Turns out this was a problem on our end for the latest build. We tracked down a critical bug that snuck through QA. We've released an emergency hotfix (available now, 3.0.0b9+h3) that should prevent freezing issues on some setups, or when hardware acceleration is disabled.

    I highly recommend that all users download the update to prevent freezing or lockup issues.
     
  29. groo79

    groo79

    Joined:
    Nov 20, 2014
    Posts:
    11
    Hi, I am a new Fluvio free user. trying to use it in a game I'm creating where I need 2D water physics. I've tried reading through the thread here, but I wasn't able to find what I was looking for. Is there a tutorial or something on getting this working. I spend several hours last night trying to get my water to stop at the floor and be able to fill a small area, but I can't seem to get the colliders to work or get the camera to even show the fluid. I'm still a bit new at this, but am not a complete newbie. I tried to reverse engineer the Three example, but was still unable to get things working.

    Any help would be appreciated as I would love to move on and start working on my other mechanics.

    **Update** it's now showing on the camera, seems to have been fixed on it's own. Still can't get it to see the collider though.
     
    Last edited: Oct 6, 2015
  30. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi groo79,

    Thanks for getting in touch, and sorry to hear about this problem! We can definitely help you get set up. Go ahead and send an email to support@thinksquirrel.com (or submit a request here) and we'd be happy to take a closer look.
     
  31. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    We've issued another hotfix for this beta release (hotfix 4) that fixes a regression with includes in the editor on Mac OS X. We recommend that all Mac users upgrade (this issue does not affect Mac builds, however).

    We did find a known issue, but decided to release as there is a reasonable workaround:

    OpenCL simulation on Intel GPUs under OS X may crash, if the index grid (under Edit > Project Settings > Fluvio) is enabled. We currently recommend using OpenCL CPU simulation for Macs without a dedicated GPU.
     
  32. groo79

    groo79

    Joined:
    Nov 20, 2014
    Posts:
    11
    OK, got it working, but I have one comment, the automatic boundaries overshoot my 2D colliders a bit. this causes a visual that the fluid is floating over the object. I worked around this for static objects by creating a secondary set of colliders for the fluid collider to work with and then adjusting it's size to smaller than the actual floor collider, but for non-static objects that I will want the water to affect then it's going to cause a bit of a visual issue. is there a work around for this? maybe create an offset variable to move the fluid colliders inside the object?
     
  33. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi groo79,

    We don't have collider offsets at this time, but they sound like a great idea, actually. I can't guarantee it, but we'll investigate and see what it will take to do something like this.
     
  34. tlutz

    tlutz

    Joined:
    Oct 14, 2013
    Posts:
    8
    Great plugin!

    I've read through here and saw that there was Windows 8 Store support, but upon building in Unity 5.2.0f3 Personal, I get this error:

    Reference Rewriter found some errors while running with command --target="Temp\StagingArea\Fluvio.Runtime.dll" --additionalreferences="Temp\StagingArea" --platform="C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd" --support="Temp\StagingArea\WinRTLegacy.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --framework="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1" --alt=System.Xml.Serialization --ignore=System.IConvertible,mscorlib.
    Error: method `System.String System.IO.Path::GetFullPath(System.String)` doesn't exist in target framework. It is referenced from Fluvio.Runtime.dll at System.Void Thinksquirrel.Fluvio.FluvioComputeShader::parseIncludePathsRecursive(System.String,System.String,System.Text.StringBuilder).

    UnityEngine.Debug:LogError(Object)
    PostProcessWinRT:RunReferenceRewriter() (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:556)
    PostProcessWinRT:process() (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:118)
    UnityEditor.HostView:OnGUI()


    And this one:

    Reference rewriter: Error: method `System.String System.IO.Path::GetFullPath(System.String)` doesn't exist in target framework. It is referenced from Fluvio.Runtime.dll at System.Void Thinksquirrel.Fluvio.FluvioComputeShader::parseIncludePathsRecursive(System.String,System.String,System.Text.StringBuilder).
    UnityEngine.Debug:LogError(Object)
    PostProcessWinRT:RunReferenceRewriter() (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:558)
    PostProcessWinRT:process() (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:118)
    UnityEditor.HostView:OnGUI()

    Is it possible I am using an old version?
     
    Last edited: Oct 20, 2015
  35. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi tlutz,

    Thanks for the heads up. This sounds like a regression and we've made a report. We should be able to fix this for the next beta.
     
  36. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    2 Part Question/Issue:

    1) I'm noticing different simulation results depending on FluvioManager HW acceleration settings. We're looking at a solution where we can achieve one simulation on CPU, and another using HW acceleration on a different platform, so this is an issue.

    If I set Desired HW Acceleration API to None, the results are dramatically different than OpenCL.

    If it's on None, it behaves nicely and looks good. If it's on OpenCL, the particles behave markedly more erratic.


    2) How accurate is fluvio to a physical simulation of how water behaves?

    For some of the values, like density, mass and viscosity, do they directly map to known physical models? For instance, does a viscosity value of 1 in fluvio map to the dynamic/kinematic viscosity of water at room temperature? The documentation isn't clear.
     
  37. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hi Ewanuk,

    I'll go ahead and reply inline:

    This is a known issue with the index grid that we're working on fixing (it's been responsible for some crashes on other platforms as well). Right now the best workaround is to disable the grid entirely under Edit > Project Settings > Fluvio, which is reasonable on the GPU if you're using less than 10,000 particles. We hope to have an update on this soon.

    For the most part, yes, but this doesn't include viscosity. For viscosity, we use a model with an artificial viscosity kernel function that is standard for SPH fluids. Actual dynamic/kinematic viscosity doesn't work well in realtime, since it involves forces at the molecular level. So no, viscosity numbers will not match measured values.

    Mass and density do correspond with real world units (Fluvio, like Unity, uses meters, kilograms, and seconds by default). The gas constant is used to determine fluid pressure.

    We're working on getting some more information about different fluid properties in the documentation. For now, if you need more information on how some of these models work and how they correspond to physical values, I highly recommend reading about smoothed-particle hydrodynamics, or SPH in general.
     
  38. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    You rock man, thanks for the fast response.
     
  39. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    I'm a bit confused about how Simulation Scale and the Scale Particle Systems editor tool work.

    Scale Particle Systems appears to only change the properties to reflect the smaller scale. I'm assuming nothing changes under the hood (Like, a meter doesn't become a millimeter in sim logic if I apply a 0.001 scale to everything). So this is meant to be a handy tool for quickly re-sizing a particle system correct?

    WRT to Simulation Scale, how does this work? Does it make the sim more accurate at smaller scales? In theory, I could use one system to simulate a tiny garden hose (at say x0.01 scale) and another to simulate building-size pipe spewing a torrent of water (assuming I had the computing power to do it) at say x10 scale. What effect does this have on mass, if my particle mass is 1kg, does it stay at 1kg for a simulation scale of x100?
     
  40. weswpc

    weswpc

    Joined:
    May 14, 2015
    Posts:
    4
    Hi. I'm on a Windows 10 machine and just started using Fluvio Pro and testing with the waterfall example scene in Unity 5. Currently, the scene is very dark. It's not a requirement that this scene works, but curious as to if anyone else is having a similar issue? Perhaps an issue with shaders in Unity 5?
     
  41. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Correct.

    Simulation scale scales all of the physical properties the best it can (not every property scales linearly). Viscosity will likely need manual adjustment to prevent an unstable fluid, as the model isn't perfect. I don't recommend simulation scales less than 0.5 or greater than 1.5, and the model is very much subject to change in a later beta build.

    Here's the current conversion that's done:

    Code (csharp):
    1. // Properties
    2. smoothing_distance_scaled = smoothing_distance * scale
    3. mass_scaled = mass * scale
    4. viscosity_scaled = viscosity * smoothing_distance_scaled * scale^5
    5. surface_tension_scaled = surface_tension * scale
    6. gas_constant_scaled = gas_constant * scale^2
    7. buoyancy_coefficient_scaled = buoyancy_coefficient_scaled * scale^2
    8. gravity = gravity * scale
    9. // Forces
    10. viscous_force_scaled = viscous_force / scale
    Unity 5.3 allows scaling of a final particle system mesh, which in many cases will work much better for scaling a particle system up or down.

    This can be fixed by setting lighting mode to Linear under Edit > Player Settings.
     
  42. weswpc

    weswpc

    Joined:
    May 14, 2015
    Posts:
    4
    Thanks. I assume you meant Player Settings -> Other Settings -> Color Space in the case of Unity 5.2?
     
  43. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    Thanks for clearing that up!
     
  44. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Fluvio 3 beta 11 is out, with a bunch of bug fixes (including a workaround for the OS X crash bug).

    @Ewanuk - some major fixes to the index grid went in with this release. The C# index grid now uses the same algorithm as the others, and I fixed a bug causing strange "density gaps" in the grid - you should be getting much more consistent results between devices and platforms.

    Finally, for those on the 5.3 release candidate, we have experimental support for a brand new surface lighting model we're working on:


    As you can see, it's a significant visual upgrade for 3D fluids. We hope to expand on that, as we really focus in on visual fidelity with subsequent releases.

    Check the blog for more info!
     
  45. kkunit

    kkunit

    Joined:
    Oct 6, 2015
    Posts:
    1
    Hi. How do you inject fluids of another colour on click and hold on an area?
     
  46. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    For this, you could make a script that just calls Unity's standard ParticleSystem.Emit function on the fluid's particle system, which you can get with FluidParticleSystem.GetParticleSystem(). If you give it the correct start color on emission, the material will pick it up.

    Relevant documentation links:
    http://docs.unity3d.com/ScriptReference/ParticleSystem.Emit.html
    https://docs.thinksquirrel.com/fluv...system.html#afc039f7c00681db295eef0871a4f2c35
     
  47. ok8596

    ok8596

    Joined:
    Feb 21, 2014
    Posts:
    40
    Hi, this is great tool for fluid effets.

    Is it possible to use alpha blend?
    It is like a glass shader with fresnel effect.
     
  48. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Yep! To do so you can either:
    * Create a new material with the fluid effect shader, and adjust the alpha on the main color
    * Use the Fluvio > Particle shaders instead of the Fluvio > Fluid Effect shaders
    * Any custom particle shader is supported as well
     
  49. ok8596

    ok8596

    Joined:
    Feb 21, 2014
    Posts:
    40
    Oh,thank you for your very fast reply!
    I'll try it soon!
     
  50. Hoop22

    Hoop22

    Joined:
    Jul 3, 2014
    Posts:
    3
    hi, I'm a new user to this amazing plugin with a simple question.

    How to keep the water flowing. It looks like in fluvio system, water just can keep flowing for a while and then disappear.

    In my game, I want the water to keep flowing in a lone pipe, how can i do that?