PBD Fluid
Shuang Yu - Computer Animation Final Project
For my final project, I implemented the position-based fluid method and used SDF for collision detection.
Method
Position Based Fluid
The position based fluid has the similar structure of cloth PBD in A5.
- Apply Force
- Position-based density constraints
- Collision Detection and Response(SDF)
- Vorticity Confinement and Viscosity
Note: In the implementation of Fluid PBD, we need to find the neighbors of the particle, here I just use the brute force method.
Signed Distance Field
Signed distance field can provide the distance between a given point and a triangle mesh. We can get a signed distance. Assuming triangle normals point outwards from the enclosed volume, the sign of the distance will be positive outside and negative inside. I used a existing C++ library for the signed distance calculation.
With SDF, we can load lots of complicated object instead of simple sphere in our scene. Here I load a little prince and changed some parameter to simulate the crystal ball
(I used 1.5k particles to simulate but only render some of them in the result)
Reference
- Macklin M, MΓΌller M. Position based fluids[J]. ACM Transactions on Graphics (TOG), 2013, 32(4): 1-12.
- TriangleMeshDistance, Github Repository
https://github.com/InteractiveComputerGraphics/TriangleMeshDistance?tab=readme-ov-file