Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Fluvio - Fluid Dynamics for Unity

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

  1. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm thinking about purchasing but I'm not sure what "Shuriken world collision requires Unity 4.0+" means. I'm stuck with 3.5 for the time being and I want to do 2D water simulation like in your pictures of the grid mode where the water fills up an area. Will that work on iOS?
     
  2. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Still unable to reproduce.... Can you do a video capture with Jing or some other capture program?

    In short, yes. To elaborate:

    Unity added a feature in versions 4.0 allowing particles to collide with the world (rather than planes). Fluvio supports two types of collisions:

    1) It can collide with the world using rigidbodies. This is the normal setup and allows you to do any kind of collision and collision response.
    2) It can do no collision, and turn over collision duties to the Shuriken particle system. This offers a performance gain with lots of particles, but only works with Unity 4. It also doesn't allow reactive forces (pushing objects).

    The 2D simulation in the example scenes and pictures uses rigidbody collision and works in Unity 3.5 and Unity 4. It will also work in iOS.
     
  3. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    On another note:

    To all owners of Fluvio Professional/Standard with Unity Free

    It was brought to my attention that there are some missing shaders in the package currently on the Asset Store. I have an update coming soon (it will be versioned 2.2.2) that will fix this. Please contact me if you are having problems with Unity Free - while realtime refraction isn't supported in the free edition of Unity, I have some compatible shaders that will work and do offer full support. If you contact me with an invoice number, I can provide you with these shaders.

    Again, my sincerest apologies for the issue.

    EDIT - full changelog below. Release date unknown (it's ready, but the review process has been taking a while lately)

    Fluvio 2.2.2

    New Features

    Mobile and No GrabPass Shaders

    Some new shaders have been added, offering a wide range of compatibility. They can be found under the following categories:

    • Fluvio/No GrabPass
    • Fluvio/Mobile
    Both categories of shaders use a static texture for refraction and are fully supported with Unity Free. The mobile shaders are optimized even more. It is recommended to use these shaders on mobile platforms.

    Changes and Fixes



    Other Changes

    • (Unity 4 only) Tweaked the example project to not throw any errors in the free edition of Unity (removed extra image effects and other Pro-only scripts).
    • (Unity 4 only) Re-baked lightmaps in the example project and disabled HDR rendering
     
    Last edited: Aug 1, 2013
  4. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    It appears to be due to the solver parameter. To improve performance I set it to 1. I then set viscosity to 100. Now my pause menu sets timescale to 0 and unpause restores it back to 1. When I pause (timescale 0) the fluid jumps all over the place. If I set the solver to 2 it still does it, but no where near as bad. Compared to default the below are the parameters that I've changed and their values.

    Fluid
    Dimensions: XY
    Max Interactions: 30
    Viscosity: 100
    Velocity Limit: 0.1
    Solver Iteration Count: 1
    Collider Size Modifier: 0.3

    Emitter
    Emission: 1
    Max Particles: 150
    Min Emit Time: 0
    Initial Delay: 0
    One Shot On Max: Checked
    Particle Life: 0
    Force Multiplier: 0
    Position: 0, 0, 0
    Emitter Axes: XY
     
  5. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Still unable to reproduce, with the above settings (both solver iteration count at 1 and 2).

    I've set the time scale through two methods:

    1) Changing between a scale of 1 and 0 in the inspector

    2) Using this script:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5.  
    6. public class SetTimeScale : MonoBehaviour {
    7.  
    8.  
    9.     int f = 0;
    10.  
    11.  
    12.     void Update()
    13.     {    
    14.         if (f++ % 120 < 60)
    15.         {
    16.             Time.timeScale = 0;
    17.         }
    18.         else
    19.         {
    20.             Time.timeScale = 1;
    21.         }
    22.     }
    23. }
    24.  
    I haven't been able to reproduce with either method. Can you confirm this happens in an empty project or by setting the timescale manually (not through the pause script)? Also, when are you calling the TimeScale change in your script (as in, does the event happen/get sent in Update, FixedUpdate, OnGUI, or something else)?
     
  6. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I sent you a message through the support site. Did you see it?
     
  7. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Yep - just got to working on my inbox in fact. I've just sent a reply.
     
  8. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    2.2.1 has been released! The Asset Store package now has a minimum Unity version of 3.5.7.

    Unity 3.5 users: There is an issue with the 2.2.1 package currently on the Asset Store - I recommend not updating just yet. I will edit this post once the issues have been resolved. Feel free to contact support directly for a working package until then.
     
    Last edited: Aug 2, 2013
  9. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    So after I imported the new update I got the following error message and now my unity won't open anymore.

    type == kMetaAssetType pathName.find ("library/metadata") != 0

    The fix for me was to delete the library/metadata folder and wait for everything to reimport. I think something in your update may not be 3.5.7 compatible.

    Then on relaunch, the installer window was up and I ran the installer for standard c# and unity crashed again.

    Now I've relaunched but I'm not sure if fluvio is installed or not.
     
  10. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Eek, that sounds pretty icky. I'll test this out ASAP.

    EDIT: Okay, I got the same issue, but deleting library/metadata fixed it (the installer worked after that). I'll contact Unity and see if we can get to the bottom of the issue. It seems the problem is happening in all editions, but only in Unity 3.5.
     
    Last edited: Aug 3, 2013
  11. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm having a bit of difficulty figuring out how to make the particles bigger. Is there something obvious I'm missing?
     
  12. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    The easiest way to make particles bigger would be to adjust the render size of the particle system - this will keep the simulation the same.

    If you want to increase the size of particles in the simulation, you'll want to adjust the smoothing distance. Keep in mind that you'll probably also need to adjust the mass, density, and viscosity. I recommend increasing each slowly until you get the desired result.
     
  13. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Oh I see the option now, it's in the inspector, not the fluvio inspector.
     
  14. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hm - do you mean the particle system options, or is something missing from the Fluvio inspector and present on a Fluvio component? I can't add Unity's particle system to the Fluvio inspector, but I can see about putting a notice or shortcut button to let users know there are more properties to adjust.
     
  15. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Yeah, I was looking at if for a while going where the hell do I edit the particle, then realized that the fluvio inspector didn't show everything. Also why is everything duplicated in the fluvio inspector?
     
  16. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Also do the fluids collide with mesh colliders? Seem to be falling right through mine atm.
     
  17. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    The Fluvio Inspector is basically a shortcut window to edit Fluvio components - it can be pretty useful if you have different components on different objects and want a quick way to look at everything. For example, you can float the window on top of everything else, select multiple objects, and then view and edit everything at once.

    Make sure your fluid has a Fluid Rigidbody Particles component, or that you've enabled the collision module in Shuriken (one or the other, but not both). Also make sure that the mesh collider isn't using the same layer as the fluid.
     
  18. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Well I got it working with mesh colliders, lowering the max velocity helped a lot with that.

    As far as mobile performance goes with what settings am I going to gain the most speed?
     
  19. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    I recommend checking out this page in the documentation:
    https://support.thinksquirrel.com/docs/fluvio/reference/performance.html

    All of these performance considerations apply to mobile. Adjusting the timestep may give you the largest performance boost, but it has the side effect of altering the physics of the rest of your project.
     
  20. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    To anyone who missed the sale in July...

    Fluvio 2 Standard is on sale for 50% off! Get it today:
    http://u3d.as/2Gi
     
  21. sinoth

    sinoth

    Joined:
    Jan 15, 2013
    Posts:
    30
    I tried installing the Fluvio 2 Free Edition from the asset store but I get the following error in Unity 4.2:

    Code (csharp):
    1. Error while importing package: Package has unknown format
    2. UnityEditor.AssetDatabase:ImportPackage(String, Boolean)
    3. ASInstaller_FluvioFree:StartInstall() (at Assets/ASInstaller_FluvioFree/Editor/ASInstaller_FluvioFree.cs:152)
    4. ASInstallerWindow_FluvioFree:OnGUI() (at Assets/ASInstaller_FluvioFree/Editor/ASInstallerWindow_FluvioFree.cs:89)
    5. UnityEditor.HostView:OnGUI()
    This happens after the initial import and I select "Install for C#"
     
  22. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hey sinoth - send me an email with your invoice number to support@thinksquirrel.com and I can send a fix. There's one pending submission but it didn't quite get out there yet.

    Anyone else with ASInstaller issues can do the same.

    Sorry for the inconvenience!
     
    Last edited: Aug 14, 2013
  23. sinoth

    sinoth

    Joined:
    Jan 15, 2013
    Posts:
    30
    Ah, no invoice number. Haven't purchased anything. Just attempting to play around with the free edition to get a feel for what is offered :)
     
  24. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    In that case, I can still send an updated free version if you would like.
     
  25. Tonmeister.

    Tonmeister.

    Joined:
    Mar 30, 2013
    Posts:
    27
    ah bummer, no fluvio paint in the update. Hope it makes it into the next update tho! :)
     
  26. BES

    BES

    Joined:
    Feb 26, 2013
    Posts:
    212
    How would I add this to a planet? .. I did a mesh attractor geosphere ... and added fluid ...but im not seeing anything when going to planet ground view..

    I was trying to look in the manual in Unity 3D . ..but it didn't want to come up for some reason ...just a white box...clicked on the support forum link ..had the same problem ...
     
  27. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hey BES, just wanted to let you know that I answered your question on the support forum.

    --------------

    Also, I wanted to repost these changes on here:

    Upcoming support changes for Thinksquirrel products:

    1. I will be introducing a support ticket system in the near future. This will work with your current Thinksquirrel account. Filling out a support ticket will be similar to sending an email via the contact form today. You will need to register your product in order to receive support. You can sign up for a Thinksquirrel account at our website.
    2. The Thinksquirrel product forum will still be around, but it will be more user-to-user oriented - it's a great resource to figure out simple problems that other users may have figured out. I'll hop into a conversation from time to time, but filling a support request will be the fastest way to get your question answered by me.
    3. I will be depreciating direct email support. Thinksquirrel's community is growing and it's getting hard to track all of the replies, and responses have been delayed as a result. We'd like to have the best possible support service, so direct emails aren't ideal right now.
    4. All bugs/issues with the product itself need to go into the product's issue tracker (check here for bug tracker links). The bug trackers are already live - anyone can report a bug. I'll be integrating in-product bug reports soon, so you can report bugs straight from the software.

    For now, please use the Thinksquirrel product forum for support, until the ticket system is set up. Also - if you have any comments or suggestions about the changes, feel free to reply to this thread.

    Please use the topic on the Asset Store forum (here) for very short questions, or to showcase things you've made with the Unity community. Also, keep in mind that any responses may be significantly delayed compared to using one of the channels mentioned above.
     
  28. Collonville

    Collonville

    Joined:
    Aug 8, 2013
    Posts:
    5
    Is it possible to change a coefficient of viscosity?I want to representation like a sand.
     
  29. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Yep, you can change the viscosity at any time.
     
  30. ffei

    ffei

    Joined:
    Sep 21, 2013
    Posts:
    1
    Hello Thinksquirrel,

    Can you please tell me how I can change the size (or other properties) of each particle in Fluvio?
    I cannot find where to do this. Do you have any manual to tell this? Thank you very much.
     
  31. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hey ffei, there are two different sizes to change:

    1) Physical size and other properties are all determined by the Fluid component. Changing the smoothing distance will change the size of the fluid particles.
    2) Visual size is controlled by the Shuriken particle system.

    Some properties (not all) can be changed individually, using the API. Fluvio's API for modifying particles pretty much mirrors Unity's API for Shuriken. I've added all of the documentation pages you should take a look at below.

    Fluvio:
    http://support.thinksquirrel.com/docs/fluvio/reference/sph.html <- read this first
    http://support.thinksquirrel.com/docs/fluvio/reference/fluid.html
    http://support.thinksquirrel.com/do...l_software_1_1_fluvio_1_1_fluid_particle.html
    http://support.thinksquirrel.com/do..._fluid.html#a11c131f94ed9dd8a15b5b6e30f97aa29

    Shuriken:
    http://docs.unity3d.com/Documentation/Components/class-ParticleSystem.html
    http://docs.unity3d.com/Documentation/ScriptReference/ParticleSystem.Particle.html
    http://docs.unity3d.com/Documentation/ScriptReference/ParticleSystem.GetParticles.html
     
  32. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    How do you make fluvio ignore collision on a particular object?
     
  33. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm basically trying to make a hose like effect come out of the player but the particles are colliding with the player and moving him all around. What emitter works best with this?
     
  34. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    You can ignore collision under Edit > Project Settings > Physics - just set the layer Fluvio is using to not collide with the layer the player is on. Fluids default to using the "Water" layer, but you can change that to whatever you want by changing the layer of the GameObject with the Fluid component on it.
     
  35. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I can't get the fluid to emit with any force, seems any setting I try to change just keeps the initial emission for the same. The force multiplier doesn't seem to do anything, I'm not sure what's wrong. I'm using FluidStreamEmitter class, is this the wrong class to use?
     
  36. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Make sure the start and end position of the stream emitter aren''t the same - the force is calculated from the distance between those two points. You then want to have the force multiplier on top of that (I think the default force multiplier is around 2400).

    If you're unsure about what settings to use, check out the default fluid (GameObject > Fluvio > Create Fluid) and see where your fluid differs from the default.
     
  37. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Ok for me when I move the end position to the right the emitter position moves as well even though the position in the inspector is 0. I really have no idea why the emitter is moving when I move the end position. Yes the force does change but it also moves the emitter position.
     
  38. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    This is intentional. The stream emitter's particles emit from the end position - the placement of the start position in relation to the end position determines the force. So if you don't want to move the emitter at all, just adjust the start position only, and this will affect the force.

    If this is a bit confusing, you could use something like the ellipsoid emitter. That one works pretty much exactly like Unity's ellipsoid emitter - it only has dimensions and a global force applied.
     
    Last edited: Oct 4, 2013
  39. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    This is pretty cool!

    Can you explain some of the technicalities behind your system?
     
  40. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
  41. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Ah right good ole SPH.

    Is it GPU or CPU based?
     
  42. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    CPU based at the moment - 2 more solvers (one GPU based) in the pipeline though.
     
  43. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Nice, well I'd be interested in seeing your GPU based one when it's ready :)
     
  44. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm unable to understand the positioning system. Currently if I start the position at x = 500 and end position at x = 0 then I'm having an issue where when I increase position > 500 the particles begin to emit backwards. There's something funky going on behind the scenes which is giving me trouble, how do I fix this issue as I want to be moving position around frequently.


     
  45. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    I recommend increasing the force multiplier and decreasing start position by 1-2 orders of magnitude here. By your image, it seems that it's actually emitting backwards for particles < 500, rather than > 500. Forces travel from the start position to the end position, multiplied by the force multiplier.

    That said, I can't really tell what's going on here without also seeing what your fluid's settings are. You seem to be working with very large distances here - did you adjust the size of your broad phase tree to match?
     
  46. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I had forgotten that I was looking at my game backwards, so that explains some of the initial confusion. Even though when I set the broad phase size to something huge like 50000 there's a strange wraparound problem. For example I set force multiplier to 10,000 and position to x=5 and end position to 0. When I move the position in the inspector the stream maxes to the right at about x=10 then it begins to return to the left as x approaches 55. From there it begins to go the opposite direction up to around x = 180 then it start going back to zero again, but on this wraparound it moves the emission position. I've made a photo album http://imgur.com/a/Ibx5a so you can see better. I'm perplexed as why there's not an emission vector option.
     
  47. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    I think you're using the wrong emitter for the problem honestly - give the FluidEllipsoidEmitter a shot instead. It has a simple force vector you can set.

    So a broad phase size of 50k isn't going to work with a smoothing distance of 0.38125 (hence the wrap around issue). During simulation, particles are arranged within grid cells, with the grid size being based on the smoothing distance. It only allows a maximum of 256 grid cells in each direction for performance and memory reasons - so there is a maximum distance a fluid particle can be from the fluid's position. You can see the grid cells with the Fluid Debug component (check the docs for more info there). You can get around this by removing the broad phase, but that can seriously degrade performance with larger particle counts.

    Edit: Also, if you're working in 2D, you'll want to set your fluid's dimensions to XY (just setting the emitter alone isn't enough).
     
    Last edited: Oct 9, 2013
  48. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I've been trying to get the fluid ellipsoid emitter working and I'm having a strange problem with it. Just using the default fluid I place the emitter where I want it in the game. Then I hit F to focus on the game object while in play mode and the particles are emitting way way way far away. If you look closely the white line at the top right side is where the particle are emitting and the place they should be emitting is the bottom middle. This is about 20000 off in the x direction and 35000 off in the y direction. I imagine I might be able to use -position values but something seems broken here.



    I thought it might have something to do with my fluvio being out of date so I updated it but that didn't fix anything.
     
  49. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Hm, something seems strange there indeed. What's the position of your fluid? Also, are your fluid or emitter in a hierarchy at all?
     
  50. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I moved some stuff around and I'm still having the issue. I'm providing more screenshots here to help you debug.