Soft body physics in Nvidia FleX

Return

Project Description

As my graduation work at Digital Arts & Entertainment, I studied soft body physics and implemented it in my own engine using Nvidia FleX. The goal was to learn about the framework and to efficiently render and simulate soft bodies.

Challenges

  • Learning from source code in SDK
  • Efficiently rendering multiple bodies
  • Implementation in my own engine
  • Working with very little documentation

Technology Used

  • Visual Studio
  • Nvidia FleX
  • Adobe Photoshop
  • Autodesk 3ds max

Language

  • C++
  • HLSL

FleX is a simulation framework. This means that it does not provide any visual feedback of what happening. Because of this, I started with creating a debug renderer that can efficiently render spheres at the position of each particle. It can render a great amount of instanced geometry without lowering the framerate too much. For extra visual feedback, the spheres are color coded depending on their collision group. Throughout my research, the visual debugger was a must to get a good result.


The next step was to research the 'anatomy' of a soft body in FleX. The framework has large data chuncks that holds information of all the particle systems that the solver(s) simulate each frame. To create a soft body, you load in a mesh, that mesh gets voxelized into particles with user-defined parameters. This algorithm also provides extra data called 'rigids' or 'clusters'.

You could compare rigids with bones in animations as particles are connected to multiple clusters with different weights. Each cluster has its own rotation and translation and because of this, you get the 'soft/fluid' body effect.

The final step is then uploading all the data to the solver and eventually rendering the body and taking care of skinning on the GPU.

Click on an image to enlarge