Search Unity

Fluidity - NextGen Fluid Dynamics - [ RELEASED ]

Discussion in 'Assets and Asset Store' started by smb02dunnal, Oct 22, 2013.

  1. RocketAlien

    RocketAlien

    Joined:
    Jul 18, 2013
    Posts:
    3
    Hi, thanks for the great asset! It works well when using Gamma color space with either Forward or Deferred rendering, but it doesn't seem to work in Linear, the colors are all blown out. Is there a way to adjust so it works correctly in Linear color space?
     
  2. HR0THVITNIR

    HR0THVITNIR

    Joined:
    Nov 21, 2013
    Posts:
    24
    [edit] ... I was really looking forward to using the flamethrower effect, but there are errors I can't fix myself (included demo scenes, dx11, Unity 5.3.1):

    Shader error in 'Hidden/Fluidity/Render1': failed to open source file: 'Fluidity.cginc' at line 29 (on d3d11)

    Compiling Vertex program with FLUIDITY_ENABLE_SELF_SHADOWING FLUIDITY_USE_MASK FLUIDITY_ALPHA_BLEND FLUIDITY_DISABLE_HEAT_HAZE FLUIDITY_DISABLE_NOISE_PETURBATION
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_TEXTURE_ALPHASPLIT_ALLOWED

    and many more like this:

    3D RenderTexture cannot be set as active render target
    UnityEngine.RenderTexture:set_active(RenderTexture)
    Fluidity.Physics.Simulation:Inject() (at Assets/FX/Fluidity/Scripts/Simulation/Simulation.cs:441)
    Fluidity.Physics.Simulation:Evolve() (at Assets/FX/Fluidity/Scripts/Simulation/Simulation.cs:596)
    Fluidity.Controller:EvolveSimulations() (at Assets/FX/Fluidity/Scripts/Simulation/Controller.cs:409)
    Fluidity.Controller:Update() (at Assets/FX/Fluidity/Scripts/Simulation/Controller.cs:358)

    Please update soon!
     
    Last edited: Jan 9, 2016
  3. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Hi HR0THVITNIR!

    I'm sorry to hear you're having issues. I can assure you that fluidity is working with the latest version of Unity (5.4.0b1, see attached).

    If you have an issue, I'd be more than happy to help! Lets use a more appropriate channel though. Please drop me an email with a simple repro project and any other information you think I might need. You should have my details from the documentation supplied with Fluidity.

    Not to worry folks, Fluidity is working, and has definitely NOT been abandoned!
     

    Attached Files:

  4. HR0THVITNIR

    HR0THVITNIR

    Joined:
    Nov 21, 2013
    Posts:
    24
    Okay, well good to see this isn't abandoned. I'll be waiting till 5.4 is out of beta at least before I upgrade my project, so I guess I'll have to take your word for it until then.
     
  5. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Just because he has demonstrated it works in the first beta of 5.4 doesn't mean you have to wait till 5.4 is released before getting your stuff working. It should work in 5.3 too so contact them by email as suggested.
     
  6. HR0THVITNIR

    HR0THVITNIR

    Joined:
    Nov 21, 2013
    Posts:
    24
    Yeah, just saw 5.4 is not due till March - assuming it arrives on time. I have a million other things to do so I'm used to being patient (though I might be carrying some past trauma regarding abandoned assets lol). I'll send an email, if only to confirm I'm an actual license holder I guess.

    One thing while I'm here, I don't think I saw the angrybots flamethrower demo in the examples. Would it be possible to get that (not the whole angrybots maybe, just the player/scripts/effect prefabs or whatever else I need to study)?
     
  7. smnerat

    smnerat

    Joined:
    Sep 23, 2012
    Posts:
    35
    Has anyone worked much with the effectors in Fluidity? I've been trying to modify the temporary emitter effector to emit normal to the surface in addition to a defined direction. It works well straight on in the z direction like in the first image that I attached. The problem is any sort of defined direction that is not head on makes everything "squished" like in the second image. Does anyone know where I could be going wrong? I've tried quite a few things now but I can't seem to make any improvements.

    I've tried modifying my code several times now without any effect. I eventually tried keeping everything in the z direction that I got to work and then actually rotated the transform rather than the change the direction and still get the same results.

    Here is the small code modification that I made in the compute shader. The first and second lines are what was originally used, then I just added the last part. The relative position is the position from the center of the effector and I am taking the dot product so that the emission is done in a hemisphere rather than a sphere.

    Code (CSharp):
    1. float3 direction = (UnpackUintIntoFloat4(a.pk_direction).xyz * 2 - 1);
    2. //force += (magnitude + IsInside(idx, a, kTurbulenceMask, kTurbulenceShift) * a.power * 0.016f) * direction;
    3.  
    4. float dp = dot(relativePos, direction);
    5. if(dp >= 0) {
    6.     force += (magnitude + IsInside(idx, a, kTurbulenceMask, kTurbulenceShift) * a.power * 0.016f) * relativePos * direction;
    7. }
     

    Attached Files:

    • Good.png
      Good.png
      File size:
      314 KB
      Views:
      985
    • Bad.png
      Bad.png
      File size:
      338.9 KB
      Views:
      973
  8. smnerat

    smnerat

    Joined:
    Sep 23, 2012
    Posts:
    35
    As usual, once I post a question I figure it out. I fixed the problem by normalizing the relative position and the direction and then adding them together before multiplying the rest of line 6 above.
     
  9. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    I haven't recieved an email yet :( Did you send one?

    Also, have you seen the angrybots flamethrower video?

    It's a tutorial! I included all the scripts necessary in Fluidity. HAPPY FLAMING
     
  10. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Is this really bound to DX11 or is it a shader model requirement? I have SM4, but can't use DX11. Also, does this use Unity's particle system or something else?
     
  11. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    DX11 is SM5.0.

    The effect requires DX11 features.
     
  12. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Bummer. This would have been nice. What about the second question, though. Does it use the Unity particle system or something else?
     
  13. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    It doesn't use particles at all. A 3D texture (or a compute buffer, I haven't checked recently to see) is raymarched and the results are added to the camera render. Different strengths and weaknesses compared to particle systems.

    I did mess around hacking together a particle version instead but it still didn't use Unity's own particles, because a GPU-based particle system made far more sense for performance, and because the velocity info generated by the fluid simulation is already on the GPU.

    In theory the techniques used in Fluidity are not limited to DX11 only, they are limited to systems where Unity has Compute Shader support. Which in the past meant only DX11, but with the new GL backend that Unity did last year this list should now also include Linux and if memory serves me correctly GLES3.1. But I've not actually tried with Fluidity, and please note I am nothing to do with the creation of Fluidity, just a keen user of it.
     
  14. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @elbows, thanks for the information. I'm glad it doesn't use Unity particles. They are horribly slow. Not sure if 5.4 particles will be any better, but 5.2 is just bad. Yeah, compute buffers require shader model 5 and Wii U only has shader model 4. Too bad because this would be a great effect for a fire breathing dragon.
     
  15. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Thanks for your response elbows, you're dead on.

    > I did mess around hacking together a particle version instead but it still didn't use Unity's own particles, because a GPU-based particle system made far more sense for performance

    Yeah, this could be more performant, but not always particle systems have drawbacks too (overdraw). As always, profile and stay vigilant.

    (PS, one of the nice things about using particles here is IQ, when particles move out of the fluid volumes boundaries, you can revert their motion to a standard kinematic model, with raymarching you cannot do this :))
     
  16. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Compute Shaders are taking their time in actually getting used a lot, at least the most exciting ones, for a multitude of reasons. They were certainly part of the hype of what used to be called 'next gen' consoles, i.e. the ones that are now current gen. I'm not exactly a console expert but I think in theory even the Wii U supports them on some level, because I found older articles online where devs were expressing hope that they could use GPGPU/Compute Shader stuff to compensate for limited CPU power.

    The most obvious example of the hype I saw relates very much to the technique that Fluidity uses, and the fire breathing dragon you mention! CapCom showed off the engine they'd been developing for PS4, via a demo that had the working title Deep Down. The effect isn't cheap but its very dramatic and could certainly be justified if it was central to the actual gameplay of the game. And yet I don't know what happened, they showed off further engine developments on the same front, and spoke of expanding Deep Down into a much fuller game, but so far I think its missing in action.Here are some demos:



     
  17. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    would you be interested in ogles 3.1 support? is it possible?
     
  18. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Out of interest, what sort of hardware would you be targeting initially?

    I'm pretty sure that a 2D version of this same fluid sim technique, by a different asset store developer, was featured in a Unity blogpost when they first expanded Unity compute shader support beyond DX11. So in theory it could be done. But in addition to working with far less simulation grid locations by virtue of using 2D rather than 3D textures (or equivalent buffers), 2D versions also don't need to do the somewhat expensive ray marching. So for a 3D version I'd have performance concerns on a lot of hardware.

    Anyways I'm revisiting my particle experiments soon so if I discover anything interesting as it pertains to performance and wider compatibility I'll be sure to post here about it.
     
  19. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Im looking at samsung s6+ for gear vr, vr has high demands just for user experience but where this effect would occur it would be more or less the only thing on screen. Gear VR has a very limited range of compatible phones, all of which are high performance and optimised for VR use, and something like Fluidity on the platform would be pretty amazing. Would appreciate your findings/insight
     
  20. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Does Fluidity actually work in the latest Unity(s)? I thought it was abandoned...
    Thanks!

    Edit: I scrolled up, its working! great to read, trying it soon.
     
    Last edited: Mar 6, 2016
  21. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    It's definitely not been abandoned!

    I've stopped adding new features (for now) but continue to bug fix and improve performance!

    It's definitely working in the latest version of unity [5.3.4f1] - DX11 and OpenGL.
     
    TooManySugar and Arkade like this.
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Wait. I thought this only worked in DX11. When did it get OpenGL support?
     
    TooManySugar likes this.
  23. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Yes - it was a nice surprise to get an email from Unity saying they had been using Fluidity to test their DX11 to OpenGL 4.3 automagic support.

    So it works - but it's new and likely to be issues. Which I'm happy to fix if reported (business as usual)...
     
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Awesome. I might have to get this at some point and give it a try.
     
  25. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Oh that is good news. I've dabbled with the OpenGL compute shader stuff since it first came out in experimental form, and Fluidity tended to trip up the compiler or otherwise fail in the past. So things have come a long way since the start, cool.
     
  26. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    I tried Fluidity today, I'm having a major issue in VR (Rift). Fluidity isn't correctly in world space, looks likes it's at a fixed distance. It's of coarse beautiful in 2D, just wow. Any ideas for VR? It used to work.
    I'm in Deffered,Linear, DX11, Unity 5.3p1
    Thanks! Hope there's a way, its amazing.
     
  27. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Could you send me a repro project HeadTrip please?
     
  28. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I got round to trying Fluidity with the OpenGL stuff yesterday. I was just trying it under windows, by manually changing the priority of the graphics API's. Oh yes it worked indeed :) I didn't do any benchmarks but it sounded like my computer was struggling compared to DX11, but this isn't really too surprising I suppose.

    Back to DX mode talk now. I do seem to get some different behaviour/looks of the effect if I switch to Linear Lighting. e.g. open the affector demo scene and switch to linear - stuff looks obviously different/wrong. Let me know if you can't reproduce this and I'll provide more detail, cheers.

    Also just heard about Nvidia Flow - mmmm is that anything to do with you? o_O;) Not sure if we'll ever get that in Unity but being able to escape the bounds of the grid sounds superb!
     
  29. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    So does this mean Fluidity now works on the Mac, given 5.3's support of OpenGL?
     
  30. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    No, OS X doesn't support the right version of OpenGL to allow that. Gotta wait for Unity Compute Shaders on Metal on OS X support or for Apple to update OpenGL or switch to Vulkan - no clues about those latter two yet so Compute Shaders on Metal looks more likely.

    Linux is the main beneficiary of Compute Shaders on OpenGL right now, plus certain mobile systems but this effect is likely too heavy for practical mobile use for some time to come.
     
    PeterB likes this.
  31. ScruffyNinja

    ScruffyNinja

    Joined:
    Nov 13, 2012
    Posts:
    13
    Ha — I feel like a dope — should have asked that very question myself. Half price was just too tempting and seeing it mentioned (in this very forum) that it works with Open GL 4.3 prompted me to hit buy before doing some due diligence. It didn't help that I've had my eye on this asset for ages with only the DX11 requirement keeping me at bay. Still not the devs fault — it would appear that Apple is still lagging behind the times and only supports Open GL 4.1 ... bloody Apple.
     
    PeterB likes this.
  32. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    I just picked up the asset today, and I'm having issues similar to an older post where when I go to run any of the demo scenes I get an error complaining about 3D RenderTexture cannot be set as active render target (posted January 5th, 2016).

    Was there ever a solution to this?
     
  33. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    I remember I saw this long time ago, and it looks seriously impressive years ago, but I didn't buy it back then because of the limitation of only supporting DX11. And years later it still looks seriously impressive. Now that it seems OpenGL 4.3 is optionally supported, it looks like it is finally worth getting.

    I have only a few suggestions - I know this is probably asked before and probably unfair to ask since fluid simulation is fairly CPU/GPU intensive but can Fluidity expand its API support to OpenGL ES or maybe even Metal? Make it so that it can work on all platforms, not just limited to Windows. Performance wise would love to see it working on OSX and maybe mobile.
     
    Last edited: Apr 8, 2016
    TooManySugar likes this.
  34. sanuvin

    sanuvin

    Joined:
    Feb 11, 2014
    Posts:
    61
    Where is this volumetricrenderer.cs script?
     
  35. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    So following up to my own question from before and what was also mentioned in some older post, I went ahead and installed Unity 5.4 Beta and the asset now works.

    To the asset creator though, is there going to be a fix in the meantime to run it on the current stable build?

    [EDIT] I also noticed it doesn't like linear colour space. Is there going to be support for that in the future?
     
  36. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Hi local306,

    A number of people gave been hitting this - it has come down to not having the latest version of Fluidity installed. I'm not sure how there could be a version mismatch.

    Please send me a minimal repro project and tell me which version of unity you're using.
     
  37. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    Thanks for the reply.

    I was running whatever the latest stable 5.3.x Unity build with whatever version of the asset is currently on the store with no success other than one demo scene where you can throw balls through the spherical plume.

    I did end up getting the asset to work with the 5.4 beta build though as suggested in the forums. It looks so great! I'm pretty sure my brain melted while watching the self shadowing plume. Super awesome job on the asset! I can't wait to play around with it some more.

    Is there going to be support for linear colour space in the future?
     
  38. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Bought this while in sale and it's looking fantastic, great work!
    However for some reason I'm getting errors regarding a 3d RenderTexture that cannot be set:
    Fluidity.Controller:Update() (at Assets/Fluidity/Scripts/Simulation/Controller.cs:358)Fluidity.Controller:EvolveSimulations() (at Assets/Fluidity/Scripts/Simulation/Controller.cs:409)Fluidity.Physics.Simulation:Evolve() (at Assets/Fluidity/Scripts/Simulation/Simulation.cs:618)Fluidity.Physics.Simulation:Jaccobian() (at Assets/Fluidity/Scripts/Simulation/Simulation.cs:479)UnityEngine.RenderTexture:set_active(RenderTexture)3D RenderTexture cannot be set as active render target
    I'm on Unity 5.3.4f1 Pro, Windows 10 Pro
     
  39. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Sorry again! I'm not sure why you're hitting this - I think there's been a version screwup somewhere...

    You can get rid of the errors by simply removing the offending lines of code! I will post a hotFix, but in the mean time I hope this is good enough for you!

    Sorry one more time :)
     
  40. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Yeah no pressure from me as I'm still evaluating the asset before introducing it into the actual project, removed those lines and the errors are gone.
    However I noticed somethings with the _Ruins Demo scene:
    1. when executing the scene the Animated Edge Fade Fluid following the pointlight isn't visible.
    2. My main project is using Linear Color space (required to use Alloy) but it looks like Fluidity isn't supporting this right? Should this be the case it would have been better advertised within the asset store.
     
  41. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    It does work in colour space, it's just I don't think I've accounted for this in the demo scenes.

    At one point it worked, looks like I've introduced a bug somewhere along the line - will include in the next hot fix.

    Please email me your invoice ID and I will send the new project asap.
     
  42. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Thanks Alex, I mailed my invoice ID to the account mentioned on the asset store as support e-mail.
     
  43. asemenov

    asemenov

    Joined:
    Jan 13, 2014
    Posts:
    11
    Really good and unique asset! Great work!
    But as it said above, it can't be used in usual PBR workflow right now.
    It would be great if you add linear colorspace support and high dynamic range of intensity, so it can properly work with cinematic image effects.

    Right now in unity 5.3.4f1 in gamma colorspace everything looks fine:
    upload_2016-4-12_13-20-27.png

    In linear colorspace:
    upload_2016-4-12_13-21-42.png

    There is also error with 3d RenderTexture mentioned above http://forum.unity3d.com/threads/fl...dynamics-released.206438/page-10#post-2589120
    By the way In early unity 5.2.1f1 version this error does not exist, that looks like latest unity graphics api changes. Hope it helps.
     
  44. Mariusz92

    Mariusz92

    Joined:
    Apr 22, 2016
    Posts:
    2
    Hello
    I've started using Fluidity and stumbled upon problems and errors.

    Something like this happens in every sample and new scene.
    Can you guide me how to fix this?
     

    Attached Files:

  45. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Finally getting round to trying this but, on import into a relatively clean 5.3.4 project, trying to run any example scenes, I'm getting 5 copies of the same error:

    [Error] Bilinear floating-point blitter is only supported for RGBA float formats
    0. UnityEngine.Texture2D.Apply()
    1. Fluidity.Volume.BaseVolume.UpdateColourGradientTexture() at Assets/Fluidity/Scripts/Volumes/BaseVolume.cs:780
    2. Fluidity.Volume.BaseVolume.Update() at Assets/Fluidity/Scripts/Volumes/BaseVolume.cs:655
    3. Fluidity.Volume.FluidVolume.Update() at Assets/Fluidity/Scripts/Volumes/FluidVolume.cs:253

    Sorry if I've missed an obvious step!
     
  46. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Do you still have that problem? I'm not the asset author but I'm going to take a look and see if I can recreate that problem.
     
  47. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    I recently tried out the new update, and I as well have the same problem with the 5 errors reporting the same as @Arkade above
     
  48. smb02dunnal

    smb02dunnal

    Joined:
    May 5, 2012
    Posts:
    439
    Hey guys!

    The new update fixes a number of issues that have been mentioned on this thread - and includes some performance optimisations.

    The error about the blitter is one which puzzles me, and I'm almost 100% certain it's due to an internal issue in Unity. I'll be raising it today with them to see what can be done.

    This error is benign it would seem. Unless anyone is reporting visual corruption?
     
  49. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Tried it last night and yeah, I dont actually seem to suffer any consequences from those console errors :)

    Got some show-stopping errors when I try it with recent 5.4 unity betas but I think its probably a bit early to start hassling you about 5.4 compatibility!
     
  50. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Hey guys,

    I'm also getting this :

    3D RenderTexture cannot be set as active render target
    UnityEngine.RenderTexture:set_active(RenderTexture)

    I'm on DX11, with Unity 5.3.2, anyone knows a solution for it ?
    I can't upgrade to a bigger Unity version, so upgrading is not a solution.

    Thanks :)
    Bruno