Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Cocuy - Fluid Simulation for Unity

Discussion in 'Assets and Asset Store' started by Musiu-Bar, Apr 6, 2015.

  1. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    349
    Ok, so we fixed the turn off / turn on problem. Required some major editing of the Cocuy source (brought in a specialist who found a lot of bugs in there). So that's fixed, though not sure I could post the fix here as it would require posting modifications to lots of the main source file.

    Also discovered that Cocuy does NOT properly sort with particle effects (it clips them away). To fix that, just add ZWrite Off to the Cocuy/Material Renderer shader.
     
    FunkyFancy and hopeful like this.
  2. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,806
    Would be great if you could submit your modified files to the plugin devs.
     
  3. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    349
    We absolutely will if we can get a hold of them.
     
    FunkyFancy and hopeful like this.
  4. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey all,

    Sorry for the abscence in the last couple of weeks. I am looking at all those issues reported. @RedVonix was kind enough to provide some really good feedback and has even sent me some fixes! Will try to integrate them soon.
     
    idavida, FunkyFancy and hopeful like this.
  5. noroaspe

    noroaspe

    Joined:
    Jan 2, 2018
    Posts:
    1
    Hi

    I would like some information about this asset.
    - I plan on using the asset for my research and would like to know if I may have permission to do so or if it would be possible for a small fee.
    - What kind of mechanism is used in your fluid simulation? (ex. Navier-Stokes equations)
    I’m not very familiar with the fluid simulation.
    So if you’d like, could you please tell me about references of the implementation (methods or papers, and so on).

    Regards.
     
  6. hawk-hawk-studio

    hawk-hawk-studio

    Joined:
    Mar 9, 2016
    Posts:
    6
    Hi! I am quite interested in this asset. But I have some doubts about it. Is it compatible with any Android device? And if not, is there any way to make it compatible.

    Thank you very much!
     
  7. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi @noroaspe

    You can definitely use Cocuy for your research! As long as your research doesn't requiere to open source any tools you use, you may use Cocuy for it. If you want, email me at: info@musiubar.com and we can talk a bit more in detail about it.

    As for the simulation, Cocuy indeed uses an aproximation to the Navier-Stokes equations. The solver used is based of Jos Stam's work on real-time fluid simulation:

    Stable Fluids [http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/ns.pdf]
    Real-Time Fluid Dynamics for Games [http://www.intpowertechcorp.com/GDC03.pdf]

    Those papers are based on a CPU bound solution which I then parallelized for the GPU.

    As reference, this solution is similar and also a good read:

    Fast Fluid Dynamics Simulations on the GPU [http://developer.download.nvidia.com/books/HTML/gpugems/gpugems_ch38.html]

    Hope that helps!
     
  8. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey @hawk-hawk-studio

    Cocuy does run on Android devices. It uses compute shaders so you'd have to make sure your device is capable of running it. In general any good phone from the last couple of years should do, but make sure first, you can have a look at general Unity Compute Shaders support here: https://docs.unity3d.com/Manual/ComputeShaders.html

    Let me know if you have any other questions!
     
  9. FuzzyMeloxKhora

    FuzzyMeloxKhora

    Joined:
    Jul 13, 2017
    Posts:
    1
    Looking great! I'm having some trouble when i rotate my fluid plane tho, i want to use it in a 3D env on a floor - anyway to make it work?
     
  10. hawk-hawk-studio

    hawk-hawk-studio

    Joined:
    Mar 9, 2016
    Posts:
    6
    Thank you!!! And do you know if there is any way to replace the ComputeShader by any other element to use it in a mobile device? Could I substitute it by a normal Shader?
     
  11. idavida

    idavida

    Joined:
    Nov 12, 2012
    Posts:
    26
    Hi! So this asset looks good but I can't use in current project if I can't toggle enable gameobjects. Any progress on this?

    Also, if I could request dynamic fluid simulations with the field parented to a moving entity to have a smaller field in a very large environment? Ie, parent the area to Mario and thus using a 10x10 units large area instead of covering the whole mario 1-1 level in a super large field.
     
  12. Francking

    Francking

    Joined:
    Feb 12, 2014
    Posts:
    2
    djarcas said:
    I've got a similar question; all of the pictures show a single-colour fluid - is it possible to support multiple-coloured fluids that mix and fade together with this?

    Hello Musiu-Bar!

    I also want to blend different colors in the same Particles Area. What I envision is to move the Color Gradient ramp from the Particles Area to the Particles Area Manipulator.

    Did you provide guidelines to djarcas to achieve the feature? Do you have any updates on the feature (or if anyone had done it on their side) ?
     
    Last edited: Mar 14, 2018
  13. DoMath

    DoMath

    Joined:
    Oct 20, 2016
    Posts:
    1
    Hi

    could you explain how to configure and setting the editor in unity and cocuy in the best way to be able to compile for Android.
    The example of apk that you put in this forum works very well in my device , but when I try to compile the same from the code, I have a low performance on the same device.
    So I understand that there should be an optimal way to configure Unity settings and Cocuy for Android.

    Another thing, if unity editor set to compile for Android and press play, can not see the simulation, but if it is set on PC and press play, it work fine.

    Thank you

    Renzo
     
    Last edited: Apr 24, 2018
  14. johnle

    johnle

    Joined:
    Mar 14, 2013
    Posts:
    2
    Are you working on Super Starfish?


    Hope you're still supporting this package. Would be nice to have these:
    1. XZ plane support as well.
    2. Moving the camera certain distance from Fluid area will break fluid rendering due to maxDistance param too small:
    m_fluid.GetComponent<Collider>().Raycast(ray, out hitInfo, MAX_DISTANCE). I changed the value and all worked well. Had to tinker with the fluid area size but still ok.
     
    Lars-Steenhoff likes this.
  15. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,617
    Love the fluid simulated visuals on that.
     
  16. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,324
    Hi,

    Is it possible to get this effect with water fluid ?



    Thanks
     
  17. chdrvn

    chdrvn

    Joined:
    Dec 4, 2013
    Posts:
    22
    Hey just got your asset, loving the groovy fluidity. I'd just like to second the motion on the 'particle area follows camera' functionality. Itd be immensely helpful. cheers
     
  18. adriaanwormgoor

    adriaanwormgoor

    Joined:
    Nov 14, 2013
    Posts:
    7
    That's a lot of beautiful fluid sim, hope this was indeed made with Cocuy Fluid Sim. At 0:12 in de video I see a kind of two-pronged laser beam aiming and firing. On the moment of firing it has an instant effect on the fluid sim. How does one achieve something like this with Cocuy Fluid Sim? I'm looking for instant momentary effects like a raindrop splash or something following the contour of a given mesh. I've played around with this for a bit but didn't get pleasing results, it seemed like you'd need to already have an emitter actively feeding into the system in order to create a fluid 'puff'. Am I wrong?
     
  19. lhthai2010x

    lhthai2010x

    Joined:
    May 28, 2015
    Posts:
    3
    Hi Musiu-Bar!
    i import package and i build on android only Basic scene demo on project, i make FPS too low about 10 - 15 FPS.
    i just import and i do nothing on this scene. Am o wrong?
    and I Switch platform to android i received this message

    <CocuyError> It seems your target Hardware does not support Compute Shaders. Cocuy needs support for Compute Shaders to work

    when i play in editor.
    Thanks you!
     
  20. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    262
    is there way to apply offset to whole simulation? so i can move everything relative to player without having insane hude canvas.
     
  21. antharesx

    antharesx

    Joined:
    Sep 7, 2018
    Posts:
    3
    Does this plugin still works on Unity 2018.2 ? I would like to use it for IOS, Android and WebGL, it looks great but I´m a bit scared because of the feedbacks..
     
  22. kalamtech

    kalamtech

    Joined:
    Oct 27, 2017
    Posts:
    7
    Guys what was the final settings you tweaked to manage it working with Metal? I've been trying to change the threads(Cocuy_Common.compute) to all values from 8 to 32 but on 32 it freezes the game playing a frame every 20 sec and bellow that I have:

    2019-03-18 15:44:59.397034+0000 hhcurie[1874:1077827] Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)

    2019-03-18 15:44:59.397238+0000 hhcurie[1874:1077827] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)

    2019-03-18 15:44:59.433008+0000 hhcurie[1874:1077809] Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)

    2019-03-18 15:44:59.433219+0000 hhcurie[1874:1077809] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)

    2019-03-18 15:44:59.439547+0000 hhcurie[1874:1077809] Execution of the command buffer was aborted due to an error during execution. Ignored (for causing prior/excessive GPU errors) (IOAF code 4)

    then repeats the code 4 forever...
     
    Last edited: Mar 19, 2019
  23. B0b

    B0b

    Joined:
    Sep 26, 2014
    Posts:
    5
    Hello are you willing to update this asset as I see there are plenty of bugs in it So I am afraid to buy it
     
  24. kalamtech

    kalamtech

    Joined:
    Oct 27, 2017
    Posts:
    7
    Hi Musiu-Bar,

    I have a bug fix for you! I finally got Cocuy working on iOS in the latest version of Metal.

    The error message we were seeing (mentioned above) was caused by the compute shader function "ClearBuffer" in Cocuy_Simulation.compute.

    It seems that the function was being called after the "_Buffer" had been populated with a ComputeBuffer containing a float array rather than a float2 array. When the array element was accessed and the ".x" property was supposed to be populated, it threw an error. Presumably because a float doesn't have a ".x" property? One of those cases where I wonder how it ever worked to begin with!

    Seems like older versions of Metal were ok with this, the current version... not so much.

    My fix was to duplicate the"ClearBuffer" function in the compute shader making one for a float array and one for a float2 array then using them as appropriate in FluidSimulator.cs.

    Let me know if you want to see my amended code. It would be great for people to be able to use Cocuy out of the box again on iOS. It's a great bit of code :)
     
    JoshuaVaughan1978 and hopeful like this.
  25. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,418
    Just a heads-up:
    Musiu-Bar was last seen: Feb 18, 2018
    here. From the looks of it, this Asset seems discontinued.

    There's an email address on their Asset Store publisher profile - in case someone wants to try getting in touch with them: https://assetstore.unity.com/publishers/12305
     
  26. kalamtech

    kalamtech

    Joined:
    Oct 27, 2017
    Posts:
    7
    Fair point Mauri!

    I'll send them an email :)
     
  27. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    15
    Hello Guys is this asset support on android?
    Thanks
     
  28. HEJlbCOH

    HEJlbCOH

    Joined:
    Jan 8, 2018
    Posts:
    2
    How can I change the shape of the particles? (for example, not a circle but a square, a triangle, etc.)
     
  29. JoshuaVaughan1978

    JoshuaVaughan1978

    Joined:
    Jul 30, 2018
    Posts:
    1
    I've hit the exact same error as you, if you could PM the code change it will probably save me a couple hours!