About a month ago, NVIDIA has revealed a new unified GPU accelerated physics framework – NVIDIA FLEX – at “The Way It’s Meant To Be Played” press event in Montreal.

Today, Miles Macklin, physics programmer at NVIDIA and lead-developer of the FLEX system, has joined us to share first-hand details about this exciting technology.

PhysXInfo.com: So what is the NVIDIA FLEX exactly ? What are the main features of FLEX ?

Miles Macklin: FLEX is a multi-physics solver for visual effects.

It grew out of the work I did on Position Based Fluids, which was later extended to support two-way coupling between liquids and different object types such as clothing and rigid bodies.

The feature set is largely inspired by tools like Maya’s nCloth and Softimage’s Lagoa. The goal is to bring the capabilities of these off-line applications to real-time games.

The types of materials that FLEX is designed to simulate are:

Liquids (water, goo)

Granular materials (sand, dirt)

Environmental cloth (flags, newspapers)

Rigid bodies (environmental debris)

Soft bodies (inflatables / tetrahedral meshes)

The solver uses a unified representation for all these material types, which means they can interact with each other in a fully coupled way.

However this unified representation also comes with some limitations. It wouldn’t, for instance, be suitable to use for a character controller, or ray-casts. Those would still be better suited to a traditional rigid body physics engine.

PhysXInfo.com: Is collision detection in FLEX re-using some of the PhysX SDK algorithms, or is it completely new pipeline?

Miles Macklin: It is a separate solver and does not share the collision detection pipeline with PhysX.

That means you can use FLEX by itself (independent of PhysX) but need to manually mirror collision objects into FLEX for them to interact. FLEX supports most standard collision primitives to make this easy.

When FLEX is integrated into PhysX 3.4, manual mirroring will not be required.

PhysXInfo.com: Will FLEX support cross-PhysX SDK and/or APEX interactions? For example, can FLEX liquid crush a destructible asset?

Miles Macklin: Two-way coupling between different materials works best when they are all part of the same solver, but in theory you could use a FLEX liquid to affect a traditional destruction asset with some code to arbitrate between the two.

PhysXInfo.com: Are the authoring tools planned for FLEX? Is it going to support LOD and scalability features, similar to APEX?

Miles Macklin: It is likely that we will build authoring tools into at least one major game engine. I expect higher-level features like LOD will be built on-top of the core solver library.

PhysXInfo.com: Is FLEX purely GPU accelerated library, or will it support CPU execution? Is it plausible to see FLEX ported to OpenCL or DirectCompute?

Miles Macklin: Right now we have a CUDA implementation and a DirectCompute implementation is planned. We are considering a CPU implementation.

I have also built FLEX for Linux (Ubuntu 12.04 64bit) and it works great, in some cases it is faster than Windows.

PhysXInfo.com: Are you planning to release FLEX for third-party developers? Is it going to be included in PhysX SDK or APEX package, or available as stand-alone SDK?

Miles Macklin: It will be initially available as a stand-alone SDK that can be used alongside PhysX 3.3.x for a select group of early adopters, and later FLEX will become a first-class feature of PhysX 3.4.

I often say that FLEX is a low-level library because the core solver interface is very minimal (a single C header file). So users who want just the solver can embed that into their applications and build tools on top of it, or they can use the tools we develop inside of PhysX / APEX.

PhysXInfo.com: What future have you prepared for FLEX – computer games or computer graphics?

Miles Macklin: Initially we’ll see FLEX in games, but I am particularly interested to see if we can apply it in offline graphics as well.

To date, NVIDIA FLEX looks like a huge leap for GPU accelerated physics, but will it gain enough momentum to become really popular? Time will tell.