NVIDIA has released few days ago a new SDK for physics simulations. This time it’s Flex (we already covered Flex news HERE and HERE).
Flex is a GPU-based particle simulation library designed for real-time applications.. It provides a unified interface that is capable of simulating fluids, clothing, solids, ropes, and more.
Flex is a particle-based simulation library that is broadly based on Position-Based Dynamics , and the Unified Particle Physics for Real-Time Applications SIGGRAPH paper .
The core idea of Flex is that everything is a system of particles connected by constraints. The benefit of having a unified representation is that it allows efficient modeling of many different materials, and allows interaction between elements of different types, for example, two-way coupling between rigid bodies and fluids.
Flex’s strength lies in enabling interesting secondary effects that enhance the visual experience. It is not designed to build gameplay affecting physics, for example it lacks functionality such as trigger events, contact callbacks, ray-casting, serialization, etc. Although it is possible to build these capabilities on top of the core solver, they don’t come in the box. For this reason it is recommended to use Flex in conjunction with a traditional rigid-body physics engine, such as PhysX.
I quickly looked at the SDK and at first sight, it seems easy to use: two headers files with C like functions prototypes, and the libs / DLLs. Here is a code snippet of the demo shipped with the SDK:
... g_flex = flexCreateSolver(maxParticles, g_maxDiffuseParticles, g_maxNeighborsPerParticle); flexSetParams(g_flex, &g_params); flexSetParticles(g_flex, (float*)&g_positions, numParticles, eFlexMemoryHost); flexSetVelocities(g_flex, (float*)&g_velocities, numParticles, eFlexMemoryHost); flexSetNormals(g_flex, (float*)&g_normals, numParticles, eFlexMemoryHost); ...
The SDK (for NVIDIA registered developers) is available from THIS PAGE.
I’ll try to test it asap and add its support in GLSL Hacker.