1 of 32

Physically-Based Simulation Final Presentation

Group 11: Longteng Duan, Guo Han, Boxiang Rong

Bunny in the Water

Position Based Fluids

2 of 32

  • 3D Position-based fluids simulation
  • Static rigid body collision detection and response within fluid
  • Diffuse materials incorporating spray, foam, and bubbles
  • CPU/GPU parallelization empowered by Taichi
  • Real-time particle visualization via Taichi GGUI
  • Offline rendering using Blender

Feature Overview

Successfully accomplish all the targets outlined in the proposal!

3 of 32

  • 3D Position-based fluids simulation

Progress at Milestone

4 of 32

  • Static rigid body collision detection and response within fluid
  • Diffuse materials incorporating spray, foam, and bubbles
  • CPU/GPU parallelization empowered by Taichi
  • Offline rendering using Blender

Progress Since Then

5 of 32

Static Rigid Body

6 of 32

  • Consideration limited to a static watertight mesh

Static Rigid Body

7 of 32

  • Consideration limited to a static watertight mesh
  • Collision Detection
    • Broad phase: axis-aligned bounding box (AABB)

Static Rigid Body

AABB rough detection top-down view

AABB rough detection side view

8 of 32

  • Consideration limited to a static watertight mesh
  • Collision Detection
    • Broad phase: axis-aligned bounding box (AABB)
    • Narrow phase: signed distance function

Static Rigid Body

SDF narrow detection top-down view

9 of 32

  • Consideration limited to a static watertight mesh
  • Collision Response
    • Apply a collision force to collided fluid particles

Static Rigid Body

Collision Response

10 of 32

Diffuse Material

11 of 32

  • Water-air mixtures: spray, foam and air bubbles
  • Goal: measure the potential of each fluid particle to mix with air

Diffuse Material

[1] Ihmsen, Markus & Akinci, Nadir & Akinci, Gizem & Teschner, Matthias. (2012). Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer. 28. 669-677. 10.1007/s00371-012-0697-9.

12 of 32

  • Water-air mixtures: spray, foam and air bubbles
  • Goal: measure the potential of each fluid particle to mix with air
  • 4 Potentials[1]:
    • The potential to trap air
      • e.g. lip of wave falls down

Diffuse Material

[1] Ihmsen, Markus & Akinci, Nadir & Akinci, Gizem & Teschner, Matthias. (2012). Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer. 28. 669-677. 10.1007/s00371-012-0697-9.

13 of 32

  • Water-air mixtures: spray, foam and air bubbles
  • Goal: measure the potential of each fluid particle to mix with air
  • 4 Potentials[1]:
    • The potential to trap air
    • The likelihood to be at the crest of a wave
      • wave crest breaks in case of strong wind
      • wave crest starts to fall and break when base is unstable

Diffuse Material

[1] Ihmsen, Markus & Akinci, Nadir & Akinci, Gizem & Teschner, Matthias. (2012). Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer. 28. 669-677. 10.1007/s00371-012-0697-9.

14 of 32

  • Water-air mixtures: spray, foam and air bubbles
  • Goal: measure the potential of each fluid particle to mix with air
  • 4 Potentials[1]:
    • The potential to trap air
    • The likelihood to be at the crest of a wave
    • The vorticity difference
    • The kinetic energy

Diffuse Material

[1] Ihmsen, Markus & Akinci, Nadir & Akinci, Gizem & Teschner, Matthias. (2012). Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer. 28. 669-677. 10.1007/s00371-012-0697-9.

15 of 32

  • Water-air mixtures: spray, foam and air bubbles
  • Goal: measure the potential of each fluid particle to mix with air
  • 4 Potentials[1]:
    • The potential to trap air
    • The likelihood to be at the crest of a wave
    • The vorticity difference
    • The kinetic energy
  • Number of new diffuse particles =

Diffuse Material

[1] Ihmsen, Markus & Akinci, Nadir & Akinci, Gizem & Teschner, Matthias. (2012). Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer. 28. 669-677. 10.1007/s00371-012-0697-9.

16 of 32

  • Generate foam for each fluid particle i

Diffuse Material

  • Build a unit cylinder
  • Uniformly sample position and velocity

[1] Ihmsen, Markus & Akinci, Nadir & Akinci, Gizem & Teschner, Matthias. (2012). Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer. 28. 669-677. 10.1007/s00371-012-0697-9.

17 of 32

  • Pseudo Code:

Diffuse Material

for all particles i in FluidParticles do

= computePotentials( )

AllDiffuseParticels ← generateDiffuseParticles( )

for all particles j in AllDiffuseParticles do

removeParticles(AllDiffuseParticels)

advectParticles(AllDiffuseParticels)

(simulation loop)

18 of 32

  • Pseudo Code:

Diffuse Material

= computePotentials( )

AllDiffuseParticels ← generateDiffuseParticles( )

for all particles j in AllDiffuseParticles do

removeParticles(AllDiffuseParticels)

advectParticles(AllDiffuseParticels)

(simulation loop)

for all particles i in FluidParticles do

Remove diffuse particles that used up its lifetime

19 of 32

  • Pseudo Code:

Diffuse Material

= computePotentials( )

AllDiffuseParticels ← generateDiffuseParticles( )

for all particles j in AllDiffuseParticles do

removeParticles(AllDiffuseParticels)

advectParticles(AllDiffuseParticels)

for all particles i in FluidParticles do

(simulation loop)

Change of diffuse particles

20 of 32

  • Pseudo Code:

Diffuse Material

= computePotentials( )

AllDiffuseParticels ← generateDiffuseParticles( )

for all particles j in AllDiffuseParticles do

removeParticles(AllDiffuseParticels)

advectParticles(AllDiffuseParticels)

(simulation loop)

Generate new diffuse particles

for all particles i in FluidParticles do

21 of 32

Visualize: spray / foam / bubbles

Classifying diffuse particles:

  • Based on number of neighboring fluid particles
  • Render with different materials

Spray

Foam

Bubble

Diffuse particles

22 of 32

What We Have Now

Real-time

~25FPS

23 of 32

Offline Rendering

24 of 32

Offline Rendering

  • Bake mesh with splashsurf and Open3D
    • Reconstruct fluid mesh with splashsurf
    • Export foam, bubble and spray as point clouds using Open3D

Fluid mesh

Diffuse material point cloud

25 of 32

Offline Rendering

  • Use Blender Python API for rendering - Rigid Body

Low-poly watertight bunny mesh for simulation

High-poly bunny mesh for rendering

26 of 32

Offline Rendering

  • Use Blender Python API for rendering - Diffuse Material
    • Apply ‘Mesh to Points’ node to create spherical mesh at diffuse particle positions with radius randomly assigned

Blender setup to generate spherical mesh at diffuse particle positions

27 of 32

Offline Rendering

  • Use Blender Python API for rendering - Diffuse Material
    • Utilize 'Musgrave texture', 'Transparent BSDF', and emission settings to make diffuse materials both partial emissive and partial transparent.

Blender material setup for diffuse particles

Diffuse particle zoom in

28 of 32

Final Demo

960px * 540px | 64 Samples | 61k Particles

29 of 32

30 of 32

References

[1] Macklin, Miles, and Matthias Müller. "Position based fluids." ACM Transactions on Graphics (TOG) 32.4 (2013): 1-12.

[2] Ihmsen, Markus, et al. "Unified spray, foam and air bubbles for particle-based fluids." The Visual Computer 28 (2012): 669-677.

[3] Taichi Blog for Collision Handling: https://docs.taichi-lang.org/blog/acclerate-collision-detection-with-taichi

[4] Taichi PBF 2D Example by Ye Kuang: https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/pbf2d.py

[5] SPlisHSPlasH Library for Diffuse Particles Synthesis: https://github.com/InteractiveComputerGraphics/SPlisHSPlasH

31 of 32

Appendix / CPU/GPU Parallelization

  • Taichi kernels automatically parallelize for-loops at the outermost level.

Taichi's parallelization optimization cannot be leveraged in this implementation.

  • The initial code for generating and removing foam relies on a global counter named foam_counter.
  • Serialization is crucial to guarantee correct foam statuses update

32 of 32

Appendix / CPU/GPU Parallelization

  • Taichi kernels automatically parallelize for-loops at the outermost level.
  • Global counter to local counter
  • Borrow the grid design from fluid simulation when generating foam
    • Each fluid particle has at most x foam particle
    • Foam generation is independent for each particle

Taichi's parallelization optimization can be used now!!!