Video Tutorial: Flex for Unity Plugin

Originally published at:

NVIDIA FleX, a particle based simulation tool for real-time visual effects, has just made its debut as a plugin on the Unity Asset Store. FleX for Unity solves a significant physics challenge in game development: getting different simulated substances (rigid bodies, fluids, clothing, etc.) to interact with each other seamlessly in real time. FleX harnesses…

thanks for the great work! Btw. why does it say DX11 or CUDA only? I thought FleX also works with OpenGL and Linux?

Most important: is it possible to use NvFlexRegisterD3DBuffer to directly copy Flex Data to a ComputeShader (without using the CPU) ?

Question. For VR I want to create a newspaper pickup that actually feels bendy. I want to be able to move it via code but also release it and let it fall and do it's thing. I tried using a softbody but I had to constraint the bottom, left and right edges of the newspaper for it to feel right (even with max stiffness the paper felt more like a cloth than a thick cluster of paper). The issue with that is that if I constraint the edges then the newspaper sticks in midair. Generally adding a parent with a rigidbody allows it to fall but the result is rather odd even if the collider I add to allow the rigidbody to fall is tiny. it would be cool if we could constraint parts of th simulation but at the same time not have them constrained to the world (like local constraints?). Anyway, maybe I'm just not using the right component for the job. Any better ideas? Also, how would you go about adding sound on collision? are there any events or something we can use to do that?

Hi Alvaro,
Did you try to work with a thin softbody, and increase the cluster size? This way you can make the simulation really stiff at the expense of the amount of the degrees of freedom you'll get in the motion.

Flex on Linux uses CUDA, there's no Flex version which uses OpenGL compute shaders. Flex CUDA version can work with both D3D11 and OpenGL. Though, Unity plugin has only native libs for Windows64.
It is possible, in theory, to use NvFlexRegisterD3DBuffer() function with Flex DX11 version, though we didn't try it.

Thanks for the reply, I already tried NvFlexRegisterD3DBuffer it is great, but I get some memory leaks from the buffer maybe I am doing something wrong, an simple example would be great!

Hi i am doing a mechanism for softbody cutting in flex. Can you tell me how change the shapeindices and shapeoffsets values at runtime. i have tired using asset.m_shapeIndices and change the values but it is changing only after the scene gets restarted


Using this plugin in Unity 2018.3, we are trying to scale this Fluids Particles (we are trying to simulate water) but once we do that, the particle source "explodes". So, we can't reduce the size of the fluid source at the scene.

Is there a way to modify the scale of the source without breaking it?


Why do my flex particles pass through * .obj objects?