Search Unity

uFlex - NVidia FLEX for Unity3D - Unified Visual FX [RELEASED]

Discussion in 'Assets and Asset Store' started by korzen303, Apr 15, 2016.

  1. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    The uFlex is not integrated with Unity's collision system. You can get the contact points and planes via
    flexGetContacts() and then use unity Physics to check for collision with game objects. Just add this to the Pull data method in the FlexSolver. I will add this to v0.5. Please refer to Flex manual for explanation of Flex's collision system.

    This should work, I will double check though.

    Haven't tested the shaders with the transparencies to be honest. Will have a look into this as well.

    This is on the ToDo list. I have some memory problems with the PInvoke, which I need to sort out.

    The only non-screen space solution for fluids, which I am aware of, are well known marching cubes.
    Its GPU version can be reasonably fast but it suffers from some visual artefacts. See the video:



    I can add it to later version of uFlex though.
     
  2. GameDevMig

    GameDevMig

    Joined:
    Nov 5, 2014
    Posts:
    17
    Thanks for the quick response!
    In case it's relevant I'm on version 0.45 and am looking at "TestAll v0.4.unity"

    Yes, please and thank you. This would be just what I need.

    One more question: Any plans to / is it possible to move FlexSolver's FixedUpdate or Update off the main Thread?
     
  3. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Yes, this is also planned.

    Latest news from Siggraph 2016. I am pretty sure this will be in the next Flex release! Can't wait
     
    Saber_S, lazygunn and elbows like this.
  4. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    There's a game in itself there

    What kind of hardware do you have in mind for this? I have uflex (and your fluids asset too) and most things run way above 30fps with a 970 gtx but I'm targeting vr platforms with a 60-75fps expected minimum framerate. Would sacrificing simulation fidelity to get that framerate produce questionable results? Is there any further optimisation in mind, or can you suggest any critical points in setup that might affect the process more than others?

    Another slightly annoying thing (although this is in 5.4 beta) is that if I make changes to any of the demos the whole thing seems to break, even after restoring previous settings, is this just a 5.4 thing?
     
  5. GameDevMig

    GameDevMig

    Joined:
    Nov 5, 2014
    Posts:
    17
    I'm sure it's on the list already, but letting the Flex Colliders be non-uniformly scaled on initial processing would help with the prototyping stage. (Before I send anything to the modeling team, I use basic shapes to "Greybox" level features)

    The clay thing looks really cool. Especially how they've used it with the Leap motion controller

    FWIW I'm on a i7-6700 w/ GTX980, and for my purposes, dropping from 32k particles to 4-8k helped. One less obvious thing is to deselect your FlexSolver GameObject when testing in the editor. Doing that doubled my framerate.
     
    lazygunn likes this.
  6. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Beside the above suggestions I would also suggest trying a separate dedicated GPU for Flex (i.e. CUDA). On a single GPU the drivers have to switch context between DX/OpenGL rendering and CUDA computing.

    In terms of SSF try lowering the resolution of all render textures from 2k to e.g. 512.

    I tested uFlex with 5.4 a month or two ago and it worked fine. I will double check with the latest revision.

    Will have a look at the colliders for 0.5
     
  7. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    PhysX + Flex in VR!

     
  8. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Just came across NVidia Flow - a grid based CFD for games. Looks interesting

     
  9. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,420
    It's interesting, since the grid is dynamic. I've played with similar systems that dont have a dynamic grid in the past (eg fluidity for unity which is on display in my avatar) and the fixed grid was too limiting, so I've really been looking forward to Flow. But I dont really know whats going on with it - it got a mention in the GDC press release and that page/video exist but it's not linked to from their website menus and I've not found anywhere to download the standalone demo.
     
    Last edited: Jul 15, 2016
  10. GameDevMig

    GameDevMig

    Joined:
    Nov 5, 2014
    Posts:
    17
    Hey, thanks for being so responsive and showing the awesome future of Flex/uFlex. (I'm really looking forward to the fire and smoke stuff) I've reproduced a normal calculation error in the shader. It appears as if normals are calculated based on ViewUp as opposed to a World Up uFlex_NormalsFollowViewUp0.jpg
    Normal(ish) straight on view

    uFlex_NormalsFollowViewUp1.jpg (Camera/view Rotation by touching ear to the shoulder)
     
  11. Mr_Dan_O

    Mr_Dan_O

    Joined:
    Oct 12, 2013
    Posts:
    347
    Magneficent project, keep it up. If it is a dead project now, would anyone please tell me where can I get an alternative to this asset? I'm looking forward for an answer.
     
  12. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,420
    Ah I just noticed that the Nvidia Flow page is actually now linked to from their GameWorks Visual FX website menu, so I guess it is actually coming.
     
  13. phiLine

    phiLine

    Joined:
    Jul 21, 2016
    Posts:
    2
    Any way to detect how many particles are inside of a collider? Thanks much. Love the plugin
     
  14. phiLine

    phiLine

    Joined:
    Jul 21, 2016
    Posts:
    2
    Also had a question regarding performance in VR. Any tips to keep the particle system from ruining framerate? I've already tried removing shaders, and limiting the particle count.
     
  15. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Sorry but there are problems with Unity forums (they rolled back to the old system) and I wasn't getting any notifications. I will try to reply over the next week as I am on holidays now.

    Bw

    korzen
     
  16. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    People often ask which GPU they need for Flex + VR. To give you a brief idea NVidia recommends the following spec for their latest Funhouse VR tech-demo, which is physics oriented and, looks like, uses Flex for softbodies and fluids.



    Low Graphics Setting
    • GeForce GTX 1070
    • GeForce GTX 1060
    • GeForce GTX 980Ti
    Medium Graphics Setting
    • GeForce GTX 1080
    High Graphics Setting
    • GeForce GTX 1080 or greater*
    • GeForce GTX 980Ti in SLI or greater*
    *Dedicated PhysX card: GTX 980Ti or greater
     
    Last edited: Jul 26, 2016
  17. ccc7861

    ccc7861

    Joined:
    Jan 19, 2016
    Posts:
    16
    Uflex is fantastic. When is the 0.5 version out?
     
  18. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    It is coming, hopefully in a week or two. The main feature will be cloth tearing plus some smaller tweaks and fixes
     
  19. ccc7861

    ccc7861

    Joined:
    Jan 19, 2016
    Posts:
    16
    Thank you for your reply and look forward to it.
     
  20. DAU_JONES

    DAU_JONES

    Joined:
    Sep 5, 2014
    Posts:
    5
    Great work on flex integration to unity so far. I've bought your asset a few weeks ago. I am working for a simulation department making virtual commissioning for all machines builded up by our company. We are using Unity occupationally to display the machine state according to the connected Logic simulation (PLC). At the moment I'm working on the simulation of charging and discharging a blast furnace by a bell less top loading system.
    BlastFurnace.png

    During this project some questions are coming up.
    1.)
    I have some performance issues. To relax the performance problem i plan to use a dedicated GTX 780TI or higher for the particle simulation. How this has to configured? Should both cards be connected with the SLI cord or are the independent? How i can dedicate a card for the particle calculation?
    2.)
    I have problems to change the size of the particles to match the the size of different granular masses. Which parameters have to be changed to repressent for examle a gran size of 1cm (iron ore).

    Thank you in advance
     
  21. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Hi,

    1) If you add 2nd GPU it should appear in NVidia Control Panel under PhysX settings. Haven't tested it, but it should only require switching from "auto-select" to the dedicated GPU. AFAIK, it does not require SLI as you don't splitCUDA computations between separate GPUs. You just assign one card exclusively to CUDA.

    2) There is a TestSmallScale in Unified scenes Folder. For granular materials you just need to tweak the radius, solid rest distance and collision distance. Also make sure that the fluid is unchecked in the solver and adjust the size in the particles renderer. See the attached manual, it explains well how things works.
     
    DAU_JONES likes this.
  22. AkhmetsharipovRuslan

    AkhmetsharipovRuslan

    Joined:
    Mar 18, 2015
    Posts:
    6
    Korzen, Hi, amazing asset, thank you, but i have one question, how is it possible to cut soft bodies, like cut on the skin?
     
  23. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Hi Ruslan,

    cutting is a huge and complex topic in CG. Basically, the simplest (and very coarse) solutions would be:

    1. For the soft-bodies based on a mass-spring models using spring constraints, find the cutting surface vs. spring intersections and simply split the springs. Update the visual mesh accordingly (not so trivial)

    2. Fore the soft-bodies based on shape-matching. Remove/split the intersecting clusters. Update the visual mesh accordingly (not so trivial).

    I will have a look into this for later versions of uFlex
     
    Last edited: Aug 17, 2016
  24. DAU_JONES

    DAU_JONES

    Joined:
    Sep 5, 2014
    Posts:
    5
    Thank you for your quick reply. I will check this out tomorrow.
     
  25. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
  26. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    @DAU_JONES
    please let us know how much faster things are on a dedicated GPU.
     
  27. DAU_JONES

    DAU_JONES

    Joined:
    Sep 5, 2014
    Posts:
    5
    @korzen303

    Unfortunately i have crashes as soon as i activate the particle renderer in edit mode(game is not running). Probably this is a bug. For more Information I've uploaded some Screenshots


    Device Manager / clean install of the driver version 372.54 @ Win10 64
    2016-08-18 07_50_59-Computerverwaltung.png

    Nvidia Systemmanagement dedicated Physx setting


    Cuda in 3D Settting(will not be effected by the physx setting)


    Unity Inspector FlexParticles Renderer


    Eventlog Windows System


    The crash occurs as soon as the particle renderer is activated in edit mode. I started the debbuger and wanted to step into the line that makes the trouble. But I found nothing. I was able to step through the complete class without a crash or error. I assume that the delay between my steps is the reason why I can't identify the problem. And this leeds into the conclusion that there is a timing problem somewhere. I also send you the unity logfiles and dumps to your gmail account.
    I have checked any other unity projects not using uflex without any problem.

    Thank you in advance
     

    Attached Files:

  28. AkhmetsharipovRuslan

    AkhmetsharipovRuslan

    Joined:
    Mar 18, 2015
    Posts:
    6
    thank you! I used clothes in UE4 flex and it components have attribute tearing, i was looking for it in uFlex, but i only found references to flex dll
     
  29. AkhmetsharipovRuslan

    AkhmetsharipovRuslan

    Joined:
    Mar 18, 2015
    Posts:
    6
    can you help me understand how particles connected with mesh? And how to deform mesh with particles, I mean when I had changed vertices count and triangles, that changed geometry. How to reassign particles for a new mesh?
     
  30. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    @AkhmetsharipovRuslan
    the cloth tearing is planned in the next release (v0.5). The skinning between visual mesh and the particles (or rather shape constraints (location+orientation)) is done when you generate the flex asset in the editor.

    You can use the available methods from FlexExtAPI (see FlexWindow for example) in the run-time. The skinning is done using Unity's default SkinnedRenderer.
     
  31. AkhmetsharipovRuslan

    AkhmetsharipovRuslan

    Joined:
    Mar 18, 2015
    Posts:
    6
    thanks, when are you going to update flex in asset store?
     
  32. AkhmetsharipovRuslan

    AkhmetsharipovRuslan

    Joined:
    Mar 18, 2015
    Posts:
    6
    Hi, can you help one more time :) I don't know how to use method GetContacts, can you explain me it
     
  33. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    uFlex v0.5 with tearing support, diffuse particles (foam), inextensible ropes (via long range attachments) and some bug fixing is about to be submitted to the AssetStore



     
    elbows and ccc7861 like this.
  34. ccc7861

    ccc7861

    Joined:
    Jan 19, 2016
    Posts:
    16
    So amazing!
    Function is getting stronger and stronger
     
  35. MelvinEng

    MelvinEng

    Joined:
    Jan 11, 2016
    Posts:
    14
    Hi Korzen,

    I was wondering, what about a sharp object cutting into another object simply due to high pressure at the point of intersection(which is what happens in reality)?
    Also, bending an object to the point of splintering and snapping?
    Btw the exposure of new surfaces would introduce new triangles(along with new UV coordinates).
    This brings to mind Pixelux's DMM which does exactly this.
    Any possibility of seeing this happen in some future version of uFlex?

    Cheers,
    Melvin.
     
  36. MelvinEng

    MelvinEng

    Joined:
    Jan 11, 2016
    Posts:
    14
    Hi Korzen,

    Is there any way to get the reaction forces from contacts(be it forces during sliding/rolling contact, resting contact, or impact)
    As I understand it, PhysX and Flex do not compute these explicitly.
    Just wondering if you're planning support for this?

    Cheers,
    Melvin.
     
  37. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Any update on unity physics integration or is it still as per post above? Now tearing is in it looks great for games but involves integration with existing unity assets that could get complex if moving a bunch of physics to uflex
     
  38. ccc7861

    ccc7861

    Joined:
    Jan 19, 2016
    Posts:
    16
    0.5 version is very good, what is the next version of the plan?
     
  39. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    I will have a look at implementing this paper on top of Flex (http://sealab.cs.utah.edu/Papers/Jones-2016-DFF/)

    I will have a look at adding contacts and collisions with PhysX rigidbodies. But Flex was thought as a passive library for real-time visual effects. Not an ultimate physics simulation engine. Moreover, NVidia announced that Flex will be integrated into PhysX 3.4.

    v0.5 supports pretty much all of the Flex functionality. The next step would be to update SSF Pro to support anisotropy (smoother looking fluids). In terms of uFlex itself I will focus on the above matters and tools for better integration with Unity (e.g. easy attaching of flex objects to skinned meshes).

    I am open for any requests about new uFlex functionality. I am not a game developer so I am not sure what the industry needs most from such a package.
     
  40. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,100
    This looks like so much fun!

    Can softbody meshes use a heat map via vertex color or texture to control how rigid / soft any part of the mesh is? This would be so different parts of a mesh can react differently on a collision.
     
  41. MelvinEng

    MelvinEng

    Joined:
    Jan 11, 2016
    Posts:
    14
    Hi Korzen,

    Glad to hear you'll be looking at fracture capability(and the issue of rendering exposed inner surfaces).
    Also looking forward to getting access to the reaction forces from contacts(be it during sliding/rolling contact, resting contact, or impact).
    This will make Flex that much more useful for novel physics-based game-play, instead of just being eye-candy.

    Do keep the good stuff coming!

    Melvin Eng
    Workshop Foundry
     
    Last edited: Sep 1, 2016
  42. karonte

    karonte

    Joined:
    Jun 2, 2013
    Posts:
    23
    Hi korzen, my client ask me to simulate a "small part of ocean wave"..... I found online this video ( the first part..wave in a box...with particle foam) and i think can be ok.


    So i Bought your asset to test someting similar but cannot reach someting similar .... I know that i'm not a good developer but can you help me to find a solution? Is there somewhere a unity project like the water in the video? Regards...
     
  43. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,913
    Will this work with animated SkinnedMesh models? If I have an animated character, for instance, how well will this system interact with it?
     
  44. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    What kind of interactions exactly do you need?
     
  45. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,913
    Well, if I wanted to splash an animated character with paint or some kind of fluid, and have it stick or drip, etc. Something like that.
     
    Martin_H likes this.
  46. Prateek_Jain

    Prateek_Jain

    Joined:
    Dec 22, 2015
    Posts:
    1
    Hello,

    I am sending you mail about the issue I am facing while using your UFlex plugin in my Unity 5.4.0f.
    My client purchased this plugin https://www.assetstore.unity3d.com/en/#!/content/59843 from Asset store but when i try to run its demo scene I am getting errors. you can see attached screenshots below:-

     
  47. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Hi,

    uFlex is currently working on Windows x64 and requires NVidia GPU. This is clearly stated on the AssetStore.

    Please note, that this is a limitation of NVidia Flex library and not uFlex itself.
    As some Macs have NVidia GPUs I don't see reason why NVidia haven't released Mac binaries yet.

    In this case I suggest requesting a refund from Unity.
     
  48. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    233
    Hey there... I was wondering if you could outline how I might go about creating something similar to the fluid guns in the Nvidia Circus VR demo. I understand how to use the uFlex panel in Unity to create a volume, but I'd like to dynamically create fluids. I presume this would require some interaction with the Flex API and probably keeping a pool of unused particles? Can you set me in the right direction?

    Also: is there a way to add forces to particles?

    -A
     
  49. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Yes, check the demos using FlexFluidEmitter componenet (e.g Unified/TestDynamicContainer.scene)


    For some reason there is no explicit SetForce() method in Flex API but it is easy to add forces by updating particles velocities in between the solver updates
    Code (CSharp):
    1. velocities[i] += forces[i] * dt / mass[i];
     
  50. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    175
    Hi,

    In terms of VR I have just got my hands on Oculus Rift DK2 and CV1. Just to confirm that uFlex and SSF/SSF Pro work fine with VR except when using Single-Pass Stereo Mode. This include point sprites as well as fluids rendering. Just note that you need really good GPU for such a combo and ideally two separate GPUs (one for uFlex physics simulation and one for graphics rendering)
     
unityunity