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:
    223
    uFLex integrates NVidia Flex with Unity3D.
    Now released on the AssetStore http://u3d.as/r50

    NVidia FleX is the new GPU accelerated particle simulation library aimed at physically-based visual effects. The core idea of FleX is that every object (such as rigid body, soft body or fluids) is represented as a system of particles connected by constraints. Such unified representation allows efficient modelling of many different materials and natural interaction between elements of different types, for example, two-way coupling between rigid bodies and fluids, or fluids and soft bodies. See Flex official site for more info.

    Flex requires NVidia GPU!





    uFLex comes with a part of the Screen Space Fluids Pro (SSF Pro), a shader pack for realistic fluid rendering, included for free. However, to get a complete feature set of SSF Pro such a fluid translucency and refractions (more to come soon) you need to purchase SSF Pro separately.

    uFLex is under development with current releases aimed at early adopters.
    Any bug reports and feature requests are more than welcome.
    Subscribe to my YouTube Channel for devlog videos.

    uFLex currently provides:
    - Access to low-level Flex native library
    - Support for rigid and soft bodies, cloths, fluids, inflatables, ropes, and granular materials
    - Deformable mesh rendering
    - Screen space fluid rendering via included external package (SSF Pro)
    - GUI for straightforward creation of Flex assets
    - Example scripted framework for quick integration with your games
    - Bunch of example scenes

    See a short uFlex QuickStart Video to get things running in no time.

    uFlex Test Scenes Preview


    New Features in v0.3


    NEW! Fluid emitters and rendering via Screen Space Fluids Pro (free for uFlex customers)



    ----Requirements----
    - NVidia GPU with at least CUDA compute capability 3.0 and drivers 347.25
    - Windows 64 bit (Win 32bit, Android and Linux support planned)

    ----ChangeLog-----
    v0.45
    -Ropes rendering
    -FlexParticlesRenderer size control fixed
    -Fixed fluid spacing
    -Added small scale example scene

    v0.4
    -Dynamic containers
    -Fluid emitters
    -Shape-match transforms generation
    -Improved sphere ponints renderer
    -Integration with Screen Space Fluids (SSF)
    -FlexSolver/Container refactor
    -FlexProcessors
    -Some bugs fixed

    v0.3
    -Flex Components refactor
    -Fast soft bodies rendering via SkinnedRenderer
    -Ropes
    -Inflatables
    -Air Meshes

    v0.2
    -Deformable mesh rendering
    -Mouse interactions
    -Colliders update

    v0.1 - first public release - early preview
    -GUI

    v0.05 - pre-release version
    -Rigid bodies
    -Soft bodies
    -Fluids
    -Cloths

    v0.01 - pre-release version
    -fluids vs. triangle mesh collisions
     
    Last edited: Jun 29, 2016
  2. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks for adding some mesh rendering in 0.2! Using the mesh rendering for a wider range of demo scenes would be good. I understand the complexities of water rendering so I know that will take a while (took nvidia themselves quite a long time to bring the rendering part of water to UE4 FleX and its visually ok but not stunning). But what about cloth rendering, or does that already work with the new mesh stuff in 0.2? Sorry for silly questions but this is what happens to my brain when most of the demo scenes only use the 0.1 simplistic rendering.

    I've not had much time to play yet, but thanks for launching your asset in this way and not waiting till it was 'finished' before enabling other people to join in the fun.
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Ah yes I think I forgot to say that I also look forward to inflatables very much!
     
  4. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi Elbows,

    I've just submitted v0.3 to the AssetStore. The new features include much faster deformable (soft) bodies rendering using Unity's built in skinning, better cloth rendering, ropes, inflatables and air meshes. All demo scenes are using now the latest rendering capabilities.



    ----ChangeLog-----
    v0.3

    -Flex Components refactor
    -Fast soft bodies rendering via SkinnedRenderer
    -Ropes
    -Inflatables
    -Air Meshes
    -Update to Demo scenes

    PS: Any feature requests concerning real-life applications such as games dev, VFX or simulation are more than welcome as I intend to provide more than simple Flex wrapper.
     
    Last edited: May 25, 2016
    elbows likes this.
  5. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    New version looks great, I can't wait to try it :)
     
  6. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi looks like a great update. A feature request I would like would be the ability to fracture or shatter an object as well as perhaps produce physical smoke during an explosion or dust during an impact. I would for example like to be able to select a mesh and set uflex to fill that mesh with a particular type of material like concrete for example. I would then like to be able to destroy or break bits off that concrete if I shot it by setting how brittle or viscous the matterial shoutd be.. Ideally I would also like to be able to trigger events in game by querying events that had happened to that emitter. For example if part of the wall had been destroyed I would like the particles that were broken off to be destoyed after a certain period of time for performance reasons and also I would like the ability to repair or reconstruct the concrete structure after a period of time.

    An idea I have for a game would be that it would be set in the future where their were repair drones that would repair structures after they were damaged. The game would need to be able to tell uflex to send the robot to spray cement particles on a partcular area if it detected a hole in it. It would also need to know to repair structures from the bottom up so that they don't collapse while being repaired.
     
  7. kosowski

    kosowski

    Joined:
    Jun 19, 2014
    Posts:
    15
    Hi! I'm interested in the plugin for fluid simulation, do you have any schedule for including the fluid renderer?

    If it is not going to be available anytime soon, I was thinking about using the marching cubes algorithm to create a mesh from the particles simulated by flex every frame. Not sure if this could be fast enough, has any one tried this or another approach?
     
  8. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi, due to the large number of requests I will prioritize work on fluid rendering. Here is a video of my previous attempt to screen-space fluid rendering:



    I plan to reimplement this and integrate better with Unity's lighting and shadow systems.
    Regarding the marching cube I've tried this some time ago https://scrawkblog.com/2013/04/01/marching-cubes-plugin-for-unity/ but it was very slow.
     
  9. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Did you try the CPU version or the GPU version? You linked to the CPU version but the same blog has a GPU version too. In any case I am not surprised if that method is too costly to use for fluid in this way. I also know that it is not easy to get screen space fluid to look completely amazing & integrate well with rest of rendering looks, and it took quite a long time for nvidia to get a version working for the UE4 FleX integration and its not visually stunning. But anything you can do to get fluid rendering going in some form, even if basic to start with, is great news.

    Do you offer the possibility of users getting their hands on version updates before they are available in the store, if we give your our invoice/order numbers privately? No matter if not, but the wait to get my hands on 0.3 is starting to drive me silly because I am so looking forward to trying that version for myself!

    Thanks again for making this plugin.
     
  10. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    I tried both, the GPU was much faster but there were some artefacts with mesh appearing/disappearing as far as I remember (
    ).

    The AssetStore delays are annoying for me as well. I submitted v0.3 almost a week ago. Please drop me an email with the invoice and I will respond with a download link. I can also set-up a Git dev branch if requested.

    Best wishes
     
    Mister-D likes this.
  11. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hello korzen303,
    Looking great!
    -I was wondering, if you have any plans to bake simulation results into file sequences? to be rendered offline.
    -Also does NVidia Flex have any license requirements? or is it totally free to use?
    Thanks
     
  12. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi Gurayg,

    thanks. Adding off-line simulation shouldn't be a problem, you only need to store the particles positions at every time-step. Flex is free to use (similarly to PhysX used in Unity and many games) but it runs on NVidia GPUs only (and Android but I haven't tested it)
     
  13. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    WIP on highly requested Screen Space Fluid (SSF) rendering for uFlex.
     
    elbows likes this.
  14. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Will it be possible to make the pressure of inflatables dynamically changeable during game runtime? At the moment I only see a difference in behaviour if I change pressure value in editor before pressing play, not if I change it while the game is running. Thats using the example inflatables scene with the torus balloons.

    Your fluid rendering looks very promising already :)
     
  15. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    totally agree, i want it!!!
     
  16. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    I plan to refactor the whole scripting framework so the changes will be detected and the data will be copied to the GPU when needed. For now, you can use this brute force method:

    FlexContainer.cs:

    Code (CSharp):
    1.  
    2.  
    3. void Update()
    4. {
    5. int inflatableId = 0;
    6. for (int iId = 0; iId < m_instances.Length; iId++)
    7. {
    8. FlexParticles particles = m_instances[iId].GetComponent<FlexParticles>();
    9. FlexTriangles triangles = m_instances[iId].GetComponent<FlexTriangles>();
    10. FlexInflatable inflatable = m_instances[iId].GetComponent<FlexInflatable>();
    11.  
    12. if (inflatable && inflatable.enabled)
    13. {
    14. m_inflatableStarts[inflatableId] = triangles.m_trianglesIndex;
    15. m_inflatableCounts[inflatableId] = triangles.m_trianglesCount;
    16. m_inflatableVolumes[inflatableId] = inflatable.m_restVolume;
    17. m_inflatablePressures[inflatableId] = inflatable.m_pressure;
    18. m_inflatableStiffness[inflatableId] = inflatable.m_stiffness;
    19. inflatableId++;
    20. }
    21. }
    22. }
    FlexSolver.cs:

    Add this in Update():
    Code (CSharp):
    1.  if (m_cntr.m_inflatablesCount > 0)
    2. Flex.SetInflatables(m_solverPtr, m_cntr.m_inflatableStarts, m_cntr.m_inflatableCounts, m_cntr.m_inflatableVolumes, m_cntr.m_inflatablePressures, m_cntr.m_inflatableStiffness, m_cntr.m_inflatablesCount, Flex.Memory.eFlexMemoryHost);
    Before this lines:

    Code (CSharp):
    1. GetComponent<FlexParameters>().GetParams(ref m_params);
    2. Flex.SetParams(m_solverPtr, ref m_params);
    This will allow you to control the pressure by controlling it's value directly in the FlexInflatable component in the Editor.

    I hope it helps
     
    elbows likes this.
  17. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Great stuff, it works just how I imagined, thanks for the very quick fix!

    I will try to post video of my initial experiment later today.
     
  18. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Is the following a bug?

    Flex Particles Lock stops working after mouse button is released after dragging flex objects around at runtime. Even if the object that is locked is not touched by the mouse.
     
  19. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Great Elbows,

    looking forward for the video!

    Yes, its a bug. I will fix in the next v0.4 release (hopefully, next week).
     
  20. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Sorry that I ran out of time to make a video today. I will try to find time during the week but worst case is that I won't get time till next weekend.

    Thanks for confirming the bug.
     
  21. nosyrbllewe

    nosyrbllewe

    Joined:
    Oct 18, 2012
    Posts:
    182
    Looks cool, though I unfortunately have an AMD GPU, so it would not be of much use to me.
     
  22. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    As far as I know NVidia may release a Direct Compute (ie. DX11) version as well.
     
  23. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi, I have just purchased uFlex and am very impressed.

    Am particularly interested in obtaining ScreenSpaceFluids as soon as possible. May I obtain an ETA?

    Very impressive work :)
     
  24. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi dvochin,

    please drop me an email at the support address given in uFlex readMe file.
     
  25. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Dear uFlex Users,

    I have just submitted a free version of Screen Space Fluids (SSF) shaders pack to the Asset Store. As a uFlex customer you can get an early access plus a bonus high quality shaders, which will be a part of a future paid SSF Pro version.
    Just drop me an email with your uFlex invoice (preferably from GMail account so I can share via Drive) .

    Over the few next weeks I will work on improving the SSF (performance) and will publish the Pro version (transparency, absorption, refractions, diffuse particles etc.)

    Below is a QuickStart video:
     
    Ony likes this.
  26. Slowin

    Slowin

    Joined:
    Mar 6, 2015
    Posts:
    62
    Hello,

    I have a question regarding fixed timestep settings and uFlex:

    In my project, I have to run the engine at high 600 physics frames per second. Unity and Physx handle this very well, but using these settings together with uFlex seems to be a real problem: the framerate drops by almost 90 percent for me in comparison to the default 50 frames per second physics.

    Is there something I could possibly do here to use uFlex and keep my fixed timestep settings?

    Thank you very much
     
  27. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi Slowin,

    Flex has some overhead and latency related to passing data back and forth from the GPU. It can be tricky to get high update rates with it (as with any GPU solution really). You could probably slightly mitigate this by calling flex update once per frame (fixed timestep = max allowed timestep) and increasing the number of flex solver sub-steps. You can also remove some data movement and synchronization in the solver update.

    Also having a separate GPU dedicated to CUDA (flex) can improve things. The drivers then do not have to switch context between CUDA nad OpenGL/DX.

    My idea would be to move Flex updates to a separate thread which will try to run on its own at constant 600Hz. Then you copy asynchronously the data on Unity update. This requires some work though as Unity API is not thread safe, you will need some sort of double buffering or other syncing method.

    But before, if I were you, I would try Flex (https://developer.nvidia.com/flex) on its own if it can handle such a high update rates. Just modify the demos sources there.
     
  28. Khaledelashry

    Khaledelashry

    Joined:
    Mar 17, 2014
    Posts:
    1
    Hi
    First great work
    I was wondering , did you have a chance to do a demo fos somethin similar to the smoke simulation shown in this video (at 0:56) and wind tunnel (1:25)
     
    Last edited: Jun 10, 2016
  29. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi Khaled,

    unfortunately, for some reason, the smoke simulation is not included in NVidia Flex 1.0. Hopefully, they will update it soon and it will be included in uFlex.
     
  30. jugadorgl4

    jugadorgl4

    Joined:
    Jun 11, 2016
    Posts:
    14
    korzen303
    If the system is not NVIDIA (AMD or Intel GPU), the plugin will not work at all or switch to CPU calculation?
     
  31. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Unfortunately, Flex will not fallback to the CPU. Hopefully, NVidia will release a DX11 (DirectCompute) version so that it will work on AMD cards
     
  32. jugadorgl4

    jugadorgl4

    Joined:
    Jun 11, 2016
    Posts:
    14
    tnx for answer.
     
  33. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi All,

    I've just submitted uFlex v0.4 to the AssetStore.

    ChangeLog:
    -Dynamic containers
    -Fluid emitters
    -Shape-match transforms generation
    -Improved sphere points renderer
    -Integration with Screen Space Fluids (SSF)
    -FlexSolver/Container refactor
    -FlexProcessors
    -Some bugs fixed

    Here is a small teaser video:
     
    Last edited: Jun 14, 2016
  34. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    The last major Flex 1.0 functionality to support in uFlex is cloth tearing. This will come in the next v0.5 release.

    However, I intend to make the uFlex more than a Flex wrapper. That is why I will slightly shift my focus towards Screen Space Fluids rendering as this is most frequently requested feature.

    For the future uFlex releases (i.e. >v0.5), I would like to add tools, which will simplify using flex in games and simulations. Therefore, I am looking for ideas what to do next. Any suggestions? Potential use cases?

    I was also thinking about (partially) re-implementing Flex as an open-source project in DirectCompute and for multi-threaded CPUs. The API would be 100% compatible with Flex and the user would be able to choose the "backend" in uFlex (i.e Flex on NVidia GPUs, DirectCompute on other GPUs or CPU). Of course, it wouldn't be as fast as Flex but could make up a decent fallback. What do you think?
     
    Last edited: Jun 14, 2016
  35. Magaro

    Magaro

    Joined:
    Apr 7, 2016
    Posts:
    1
    uFlex is such a great addition to the toolbox. This will be a lot of fun. Right now, I can't seem to get any of the demos to build and run - they freeze on the first frame. They all run fine inside Unity. Perhaps I just can't figure out how to start them. Running version 0.3. I'll send you a request for a link to 0.4 to see if it fixes things. Anyway, great work.
    GeForce GTX 960M
    Core i7-6700HQ 2.6 GHz
    16 GB RAM
    1920 x 1080, 60Hz
    Windows 10
    Unity3D 5.3.4f1
     
  36. jugadorgl4

    jugadorgl4

    Joined:
    Jun 11, 2016
    Posts:
    14
    Even if the speed will be 2-3 times slower than on nvidia, it will still be much faster than CPU.
     
  37. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    If you were going to go to the trouble of re implementing flux to be compatible with non nvidia platforms you would be better off writting it in opencl or another spir v compatible language that you could then compile into vulcan or metal for better performance and compatibility on more platforms. Directx 11 is relatively slow. Even Directx 12 wouldn't make as much sense because then it would only be compatible with pc's . Also I think there is a company that is making a cuda to opencl convertor so if you have access to the source you could use it to convert it without having to re-write it. There is rumour that AMD themselves will be releasing cuda tools that will do a similar thing.
     
  38. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Unity have done work to make compute shaders also compile to other platforms. So far modern OpenGL on Linux and some Android devices. But it sounds like something they intend to bring to metal one day too, and whilst it is a bit early to talk about Vulkan & Unity I would also expect the initiative to extend on that front.
     
  39. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    DO we require NVIDIA GPU on the machine where the application/ game will be installed too?
     
  40. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    @rahuxx
    Yes, you need NVidia GPU for the builds as well.

    @IanStanbridge @elbows @jugadorgl4 Regarding the previous posts I've already got large parts of Unified Particles Physics paper implemented for CPU and DirectCompute (i.e compute shaders). Will need to refactor it however before open-sourcing. Will keep you guys posted.
     
    rahuxx and elbows like this.
  41. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    would be cool if textures can be applied.
    i mean water is ok in nvidia demos... but what if i want to do a soil?
     
  42. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    v0.45 submitted to the Asset Store. Early adopters can get it now from my Drive.
    -Ropes rendering
    -FlexParticlesRenderer size control fixed
    -Fixed fluid spacing control
    -Added small scale example scene
     
    pan-master, elbows and rahuxx like this.
  43. pan-master

    pan-master

    Joined:
    Nov 11, 2013
    Posts:
    127
    what is needed for devs:
    1Fluids on Skined meshed rendered moving characters
    2 Skined meshed moving characters with atached flex particles to simulate softbody pshysic on parts of the body, as well as enable colluison with fluids,

    3.creation of particles on meshes with small holes( human models with eye holes)
    colorig particles to give them diffrent weights of interactivity
    assigning particles to bones
    4. taging diffrent particles for callback functions(informations about which particles has been hit)
    for example you color block of particles and if red oneces has been hit thendosomething();

    here is a script that updates mesh renderer on skiened mesh animated charactrers, its very slow but it created udpated mesh collider,(if forced update is checked) it does not work with flex, but might be helpfull
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class SkinnedCollisionHelper : MonoBehaviour
    4. {
    5.     class CVertexWeight
    6.     {
    7.         public int index;
    8.         public Vector3 localPosition;
    9.         public float weight;
    10.  
    11.         public CVertexWeight(int i, Vector3 p, float w)
    12.         {
    13.             index = i;
    14.             localPosition = p;
    15.             weight = w;
    16.         }
    17.     }
    18.  
    19.     class CWeightList
    20.     {
    21.         public Transform transform;
    22.         public ArrayList weights;
    23.         public CWeightList()
    24.         {
    25.             weights = new ArrayList();
    26.         }
    27.     }
    28.  
    29.     public bool forceUpdate;
    30.     public bool updateOncePerFrame = true;
    31.  
    32.     private CWeightList[] nodeWeights; // one per node
    33.  
    34.     private SkinnedMeshRenderer skinnedMeshRenderer;
    35.     private MeshCollider meshCollider;
    36.  
    37.  
    38.     /// <summary>
    39.     ///  This basically translates the information about the skinned mesh into
    40.     /// data that we can internally use to quickly update the collision mesh.
    41.     /// </summary>
    42.     void Start()
    43.     {
    44.         skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
    45.         meshCollider = GetComponent<MeshCollider>();
    46.    
    47.         if (meshCollider != null  skinnedMeshRenderer != null)
    48.         {
    49.             // Cache used values rather than accessing straight from the mesh on the loop below
    50.             Vector3[] cachedVertices = skinnedMeshRenderer.sharedMesh.vertices;
    51.             Matrix4x4[] cachedBindposes = skinnedMeshRenderer.sharedMesh.bindposes;
    52.             BoneWeight[] cachedBoneWeights = skinnedMeshRenderer.sharedMesh.boneWeights;
    53.        
    54.             // Make a CWeightList for each bone in the skinned mesh
    55.             nodeWeights = new CWeightList[skinnedMeshRenderer.bones.Length];
    56.             for ( int i = 0 ; i < skinnedMeshRenderer.bones.Length ; i++ )
    57.             {
    58.                 nodeWeights[i] = new CWeightList();
    59.                 nodeWeights[i].transform = skinnedMeshRenderer.bones[i];
    60.             }
    61.             // Create a bone weight list for each bone, ready for quick calculation during an update...
    62.             for ( int i = 0 ; i < cachedVertices.Length ; i++ )
    63.             {
    64.                 BoneWeight bw = cachedBoneWeights[i];
    65.                 if (bw.weight0 != 0.0f)
    66.                 {
    67.                     Vector3 localPt = cachedBindposes[bw.boneIndex0].MultiplyPoint3x4( cachedVertices[i] );
    68.                     nodeWeights[bw.boneIndex0].weights.Add( new CVertexWeight( i, localPt, bw.weight0 ) );
    69.                 }
    70.                 if (bw.weight1 != 0.0f)
    71.                 {
    72.                     Vector3 localPt = cachedBindposes[bw.boneIndex1].MultiplyPoint3x4( cachedVertices[i] );
    73.                     nodeWeights[bw.boneIndex1].weights.Add( new CVertexWeight( i, localPt, bw.weight1 ) );
    74.                 }
    75.                 if (bw.weight2 != 0.0f)
    76.                 {
    77.                     Vector3 localPt = cachedBindposes[bw.boneIndex2].MultiplyPoint3x4( cachedVertices[i] );
    78.                     nodeWeights[bw.boneIndex2].weights.Add( new CVertexWeight( i, localPt, bw.weight2 ) );
    79.                 }
    80.                 if (bw.weight3 != 0.0f)
    81.                 {
    82.                     Vector3 localPt = cachedBindposes[bw.boneIndex3].MultiplyPoint3x4( cachedVertices[i] );
    83.                     nodeWeights[bw.boneIndex3].weights.Add( new CVertexWeight( i, localPt, bw.weight3 ) );
    84.                 }
    85.             }
    86.            // UpdateCollisionMesh();
    87.         }
    88.         else
    89.         {
    90.             Debug.LogError("[SkinnedCollisionHelper] "+ gameObject.name +" is missing SkinnedMeshRenderer or MeshCollider!");
    91.         }
    92.    //invoke("UpdateCollisionMesh",1);
    93.     }
    94.  
    95.     /// <summary>
    96.     /// Manually recalculates the collision mesh of the skinned mesh on this object.
    97.     /// </summary>
    98.     public void UpdateCollisionMesh()
    99.     {
    100.         Mesh mesh = new Mesh();
    101.    
    102.         Vector3[] newVert = new Vector3[skinnedMeshRenderer.sharedMesh.vertices.Length];
    103.    
    104.         // Now get the local positions of all weighted indices...
    105.         foreach ( CWeightList wList in nodeWeights )
    106.         {
    107.             foreach ( CVertexWeight vw in wList.weights )
    108.             {
    109.                 newVert[vw.index] += wList.transform.localToWorldMatrix.MultiplyPoint3x4( vw.localPosition ) * vw.weight;
    110.             }
    111.         }
    112.         // Now convert each point into local coordinates of this object.
    113.         for ( int i = 0 ; i < newVert.Length ; i++ )
    114.         {
    115.             newVert[i] = transform.InverseTransformPoint( newVert[i] );
    116.         }
    117.         // Update the mesh ( collider) with the updated vertices
    118.         mesh.vertices = newVert;
    119.         mesh.uv = skinnedMeshRenderer.sharedMesh.uv; // is this even needed here?
    120.         mesh.triangles = skinnedMeshRenderer.sharedMesh.triangles;
    121.         mesh.RecalculateBounds();
    122.         mesh.MarkDynamic(); // says it should improve performance, but I couldn't see it happening
    123.         meshCollider.sharedMesh = mesh;
    124.     }
    125.  
    126.     /// <summary>
    127.     /// If the 'forceUpdate' flag is set, updates the collision mesh for the skinned mesh on this object
    128.     /// </summary>
    129.     void Update()
    130.     {
    131.         /*if (forceUpdate)
    132.         {
    133.             if (updateOncePerFrame) forceUpdate = false;
    134.             UpdateCollisionMesh();
    135.         }*/
    136.     }
    137. }
     
    Last edited: Jun 19, 2016
  44. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Just purchased. other than the QuickStart video, is there any other documentation? You've included the official NVIDIA documentation, but I was hoping for some getting started tutorials
     
  45. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
  46. local306

    local306

    Joined:
    Feb 28, 2016
    Posts:
    155
    Hey @korzen303, what are your system's specs? Your demo videos on YouTube are so smooth and fast, whereas mine seem to run sub 60 FPS at times.

    I'm running the asset on a GTX 980. My CPU is an older i7-950, but I'm not sure how that all plays in given how FleX operates on the GPU, right?

    EDIT: I'm also running it on Unity 5.4b if that makes any difference. I know your store page says Unity 5.3.5, but I don't want to upgrade mid project from 5.3.4 at the moment.
     
  47. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Screen Space Fluids Pro v0.1 is now live on the Asset Store. v0.2, which has been just submitted for the review, will contain much requested fluid transparency with refractions. Check out the video:



    To make things clear: with uFlex you are getting just a part of SSF Pro for free, which contains High Quality shaders for opaque fluids. For a complete SSF Pro feature set such as transparency and refractions (more coming soon) you need to purchase SSF Pro separately.
     
    sebastien-barry likes this.
  48. coastermania

    coastermania

    Joined:
    Oct 4, 2013
    Posts:
    1
    Uflex real water is how do you make it for? We ask you to tutorial video.
     
  49. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Yes, I aim to recreate water shaders from NVidia Flex demo. I will record more video tutorials soon.
     
  50. GameDevMig

    GameDevMig

    Joined:
    Nov 5, 2014
    Posts:
    18
    Hi! Just purchasd this and had some fun going through the demos. Sorry if I missed something basic, but:

    How do I tell if a body/fluid particle has hit a gameobject? I'm using a MeshCollider, but even though particles bounce off, they don't send an OnCollisionEnter/OnTriggerEnter Message?

    Also I noticed your emitter use a pre-created pool of particles (awesome) , is there any way to leave them inactive until they are needed? Or do I just have to make bowl really really far away?

    Lastly I'm currently running into a sorting/blending issue with the shader (uFlex/SpherePointsSpritesShader) where the uFlex particles are always in front of transparent particles.
    uFlexSorting_AlphaBlended.jpg
    (uFlex vs. Unity Default Alpha-blended Particle System)


    Feature requests:
    - Please add support for Box / Sphere Colliders / Capsule colliders
    - You mentioned a non screen space solution for blending the fluid spheres? That would be more performant for VR, right (Mesh once vs Depth/Blur pass on each eye?)


    Thanks again for such an awesome tool, I plan to use it bunch!