Fluid Simulation with Ray Tracing Cores

Introduction

We use ray tracing cores to perform nearby particles detection and implement local particle based simulation methods based on that.

Ray Tracing Cores

Just like the implementation of a lot of graphics pipeline, ray tracing is making everything simpler, especially when there is hardware-handled BVH building. For example, ray-traced shadow does not need us to swap passes and transfer textures and it has no limitation of resolution of the shadow map texture.

For the implementation of neighborhood particles searching, we can also avoid building the complex data structures and let the graphics API handle this while the performance remains high since there are cores handling the ray-primitive detection.

Implementation

We use the wavefront execution path, by collecting the contact pairs in a buffer and launch the force and velocity calculation in parallel. There is a trade off between the atomic operations and the branch divergence problem on GPU.

Atomic operation happens in these two stages:

  • The contact pair counter
  • The momentum collector

The divergence problem (if we use megakernel) occur because of:

  • Internal calculation divergence
  • Different count of contacted particles

The wavefront method triumphs when the velocity calculation method is more complicated and the particle distribution is more uneven.

Code coming soon.

Pengfei Shen
Pengfei Shen
PhD Student

My research interests include computational imaging, realistic rendering and differentiable rendering.