Search Unity

Cocuy - Fluid Simulation for Unity

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

  1. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58

    Hello Community!

    We want to present to you Cocuy, the new Fluid Simulation system for Unity!


    Cocuy is a real time 2D fluid simulation system that uses the GPU to simulate smoke, fire, ink or any other fluid you can think of. It is super simple to use and comes with full source access so you can edit and extend it. It also has several demo scenes that showcase the different functionalities we provide. And now also available for MOBILE!

    We are very excited about this, and we want to hear back from the community so let us know if you have any questions, suggestions or comments! We'd be thrilled to hear your thoughts!

    UPDATES
    2.1 (August 2017)

    • iOS support! (plus bug fixes)
    2.0
    • Android and Linux support!
    1.2
    • Support for blocking the fluid using a PolygonCollider2D
    • Access to particle data in the CPU
    • Bug fixes and optimizations
    1.1
    • Cocuy is Unity 5 Ready now!

    Have a look at our release trailer and some "in-game" screenshots:













    Enjoy your simulation!
    www.musiubar.com
     
    Last edited: Nov 27, 2017
    Mauri, Mister-D, Pulov and 5 others like this.
  2. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Wow, this looks amazing! Great job!
     
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Looks delicious. I was wondering how it will interact with a typical 2d environment because I think that's what most people would use it for... like a bunch of water flowing or whatever.
     
  4. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Wow, guys, thanks for the kind works, means a lot :)

    imaginaryhuman, the idea is that you define an area where you want the simulation to happen and start adding particles and modifying the velocity of the fluid inside it. To interact with your 2D environment you can define exclusion areas where the fluid doesn't go and just collides. So if you have some sort of stream you could potentially define obstacles to "route" it's path.
     
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    and is this just a single-screen simulation, or would it work in a larger area in a scrolling game?
     
  6. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi imaginaryhuman,
    Yes, the simulation area is independent from the screen so it can be bigger (or smaller). I made a quick .gif of a simple scene showing a bigger simulation and a camera moving around to show how it'd work. Have a look here (it's 12MB so might be a bit slow at the beginning).

    Having said that, by increasing the simulation area size you do lose some definition (since you're "zooming in" the simulation to put it one way). Potentially you could then increase the resolution of the simulation but might cost you a bit more performance.
     
    dogzerx2 likes this.
  7. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    So it's limited basically to the whole simulation has to fit into one texture?
     
  8. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Exactly, it's technically a Compute Buffer underneath but yes, you get the idea :)
     
  9. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Could you use it to create flowmaps?
     
  10. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi lazyguun, what exactly do you mean by flow maps?.

    Do you mean having the simulation move game objects? You definitely do that (sort of like this demo). You can also *not* have a Particle Area so you wouldn't have any visible fluid on the screen, just the simulation moving your game objects.
     
    hopeful likes this.
  11. wilberolive

    wilberolive

    Joined:
    Apr 17, 2015
    Posts:
    1
    Since this requires DX11, does that mean this only runs on Windows and nothing else? Have you tried any other platforms?
     
  12. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi wilberolive,
    The current version uses Compute Shaders for the simulation which as far as I know are still Windows only in Unity. We are however looking into adding a version that uses Render Textures instead which should be supported by most platforms, is that something you could be interested in?.
     
    hopeful likes this.
  13. Musiu-Bar

    Musiu-Bar

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

    Wanted to announce that Cocuy is out now on the Asset Store! <Link>

    If you have any questions, suggestions or issues let us know :)
     
  14. adventurefan

    adventurefan

    Joined:
    Jan 17, 2014
    Posts:
    230
    Looks pretty cool. I'd be interested if you could expand it to a 3D space particle system, if it's even possible.
     
  15. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey adventurefan,
    At the moment we are focusing on 2D, but extending the system to 3D would be possible so we might consider it in the near future. Also, we ship Cocuy with full source code so anyone could extend it if they wanted it now (we would be glad to lend a hand).
     
  16. overthere

    overthere

    Joined:
    Jun 28, 2013
    Posts:
    110
    Looks great, is this Unity 4.5 only for now not unity 5?
     
  17. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    633
    I would be interested if cocuy went 3d, it looks awesome so far though! :D
     
  18. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Yes, right now it's Unity 4.5, but I'm upgrading to Unity 5 as we speak! If you watch this thread I'll inform you all when it's done.

    Thanks! We might go for a 3D version in the near future as there seems to be some interest for it. In the mean time, depending on what you want to do with it you can still use the 2D version in a 3D scene and have it as a billboard or something like that.
     
    overthere likes this.
  19. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey!

    We just updated Cocuy and it's now Unity 5 Ready! Check it out in the asset store.
    As usual, any comments or feedback are most welcome.
     
    blueivy and overthere like this.
  20. overthere

    overthere

    Joined:
    Jun 28, 2013
    Posts:
    110
    Have had fun playing around with it in Unity 5 this afternoon :)
    Has been very intuitive.
    I've got some questions / feedback would you rather do that on this thread or by email?
     
  21. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey thanks!
    If it's generic questions that some other people might find useful here I guess it's fine. If not by email is perfect as well :)
     
  22. DoctorMobius

    DoctorMobius

    Joined:
    Oct 2, 2014
    Posts:
    15
    How does the compute shader return movement information back to the Unity objects?

    I'm currently working on a water-based game which has a realtime deforming plane as the water surface - would it be possible to apply Cocuy on that gently rippled mesh to get a visual "wake" effect and apply movement turbulence to my model boats?

    cocuy_questions.png
     
  23. jgalvezpa12

    jgalvezpa12

    Joined:
    Jan 8, 2015
    Posts:
    35
    is the work on mobile? looks awesome
     
  24. webitube2

    webitube2

    Joined:
    Feb 16, 2014
    Posts:
    1
    Do the simulated water particles respond to gravity? If I put it in a container and drop stuff in, will it work realistically?
     
  25. system-idle

    system-idle

    Joined:
    Dec 13, 2013
    Posts:
    26
    This plugin is looking great! 2D is cool and thinking to buy, but if you're working on a 3D version would the upgrade be free?

    Thanks
     
  26. Foose

    Foose

    Joined:
    Jul 3, 2014
    Posts:
    21
    I am having the exact same question. I am currently in the process of developing a mobile game but I am curious if it will work in that environment. Any news on that?
     
  27. DiNoGames

    DiNoGames

    Joined:
    Feb 5, 2015
    Posts:
    14
    I am also very interested in this asset. But if it just works on Windows only, the whole benefit of working with Unity as a cross platform environment is gone... if this asset goes mobile it's a no brainer though. Hope you are already working on the render texture solution you mentioned.
     
  28. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi DoctorMobius,
    The velocity of the fluid can be queried at any point within the fluid simulation area, that's how the FluidFollower component works (used in this demo: http://goo.gl/QZr50m). You can use this information to move your objects with the fluid.

    For the wake effects you can attach the VelocityManipulator component to your ship so that it disturbs the fluid as it sails, the same with the "turbulance to a location" question. The only problem there is that we don't have a "radial" way of manipulating the fluid like in your example, you have to choose a direction in which to modify the velocities (although, that sounds like a nice feature to add to our backlog).

    Having said that and looking at your screenshot it seems you want to render this on top of a 3D mesh? How do you create the ripples and water simulation? If you want drop me an email with more info on what you're trying to do to see if Cocuy is a good fit.
     
    overthere likes this.
  29. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey!
    Yes, mobile support is our top priority at the moment. It's currently DX11 only but we are working on getting it to mobile as soon as possible. I will keep you all posted on progress!
     
    LoDx, Simie and DiNoGames like this.
  30. DiNoGames

    DiNoGames

    Joined:
    Feb 5, 2015
    Posts:
    14
    Will mobile support be a free update if we have bought the Dx11 Version before?
     
  31. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi DiNoGames,
    Yes, of course, it would be just an update to the same asset.
     
  32. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    380
    So cool... Does this support Playmaker ?
     
  33. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi system-idle,
    At the moment we are focusing on the 2D version so don't have much plans yet on how we want to go about it.
     
  34. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi,

    Me!

    I just bought your asset and ... I thought it was compatible for mobile platform. And I'm working on OSX. So ... I just can't use it.

    I search for your email adresse to ask you a refund because I just can't use it.


    Can I have your email please to send you my "order confirmation" please ?

    Thank you !
     
  35. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi ababab5,
    I've just sent you a private message. Please confirm if you got it.
     
  36. jjobby

    jjobby

    Joined:
    Nov 28, 2009
    Posts:
    161
    Do you have any ETA update for mobile support?
     
  37. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    yes thanks !
     
  38. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    456
    This looks great. As we're developing for mobile I'll be waiting for that before purchasing, but I've definitely got my eye on this!

    Do you have any early information about what performance will be like on mobile/tablets?
     
  39. tiagoroldao

    tiagoroldao

    Joined:
    Dec 9, 2013
    Posts:
    4
    Sorry to be asking the same thing, but can you share your thoughts on the timeframe for release and performance you hope to have with the change to using Render Textures?

    We are developing a game that would benefit from this for some visual effects, but would need to know if this is to be available in the game's timeframe.

    Also, would the API stay the same? That is, could our experiments with the X11 version translate to the multiplatform one?
     
  40. TobiasW

    TobiasW

    Joined:
    Jun 18, 2011
    Posts:
    91
    I'd also be very much interested in using this with Render Textures. The effect looks stunningly great, but not being able to use it on Mac and Linux means I can't use it.
     
  41. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    I think the question here was about creating textures from a velocity field which is calculated from a heightmap as well as information such as height of the fluid (as compared to the heightmap, think of water flowing between stones) and external forces (most likely just the angle of the surface). It's a relatively common visual effect (so additional forces to the fluid aren't relevant, only body forces) for water movement on the ground in rainy scenes.

    I wonder how you're approaching turbulence, mathematically, are you also factoring in kelvin-helmholtz instability? That might allow for some very intuitive turbulence control but I guess it's probably difficult to locate velocity shears, plus it of course depends on how you're handling turbulence in the first place. It looks pretty good, though!
     
  42. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hey!
    The render textures version is what I'm working on right now so should be the in the next update. I would like to have it ready this month but depending on other things it could take a bit longer.

    In terms of performance I'm not too sure (also wouldn't want to lie and make up some numbers). Once it's done I'll have some better metrics and I'll post them here :)

    Yes, I'd like to keep the API as it is. In the case I did change something I would inform it and suggest ways to port it to the new one.
     
    tiagoroldao and Simie like this.
  43. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    "Requires DirectX 11" means it won't work on IOS/Android correct?
     
  44. overthere

    overthere

    Joined:
    Jun 28, 2013
    Posts:
    110
    Yes DirectX 11 is windows only.
     
    sergioschiavo and Musiu-Bar like this.
  45. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    Thanks for the reply. If if worked cross platforms I would definitely purchase! It's a really nice effects.
     
  46. TobiasW

    TobiasW

    Joined:
    Jun 18, 2011
    Posts:
    91
    Great! Looking very much forward to that.
     
  47. JuroX

    JuroX

    Joined:
    Feb 11, 2013
    Posts:
    4
    Hi,
    Is there a possibility to use Cocuy to simulate heat transfer in fluid flow as well? E.g. I will place "hot" solid square inside 2D room and the fluid - air will start to flowing up in gravity field because of heat transfer and heat expansion. And it will transfer the heat energy into another solid objects. I understand that the simulation would not be numerically exact, but to some degree total energy will be preserved.
    Thanks for answer.
     
  48. mrcsbmr

    mrcsbmr

    Joined:
    Nov 23, 2014
    Posts:
    2
    Looks amazing! I'm really looking forward to the next update since I'm using OSX as well. :)
     
  49. PabloLaMont_1

    PabloLaMont_1

    Joined:
    May 17, 2015
    Posts:
    3
    Hi! just got the assest, having some problems running the demos, got a shader compilation error in AdvectVelocity, applyVorticity and AdvectParticles , any ideas what may be causing the problem? Thanks !! :D CocutProblem.png
     
  50. Musiu-Bar

    Musiu-Bar

    Joined:
    Apr 6, 2015
    Posts:
    58
    Hi Jurox,
    At the moment the simulation doesn't handle temperature. I've looked at it but haven't included it in Cocuy.

    As for heat transfer that would be a whole different simulation I believe, could be an interesting idea but I think out of the scope of what Cocuy can do. Maybe it could be expanded to work alonside it.