diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-11-08 21:34:16 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:07 +0300 |
commit | be24adc9ef6a73aa9e0f06da6014911e6a8a80d2 (patch) | |
tree | 4e13babe45d794336b0c257a687db88004d92a92 /source | |
parent | 926a674fe804a2ac802650c9fe7b82618addc9a7 (diff) |
Implemented PIC and FLIP methods for combining the fluid grid simulation
with the Lagrangian hair model.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/physics/intern/hair_volume.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/physics/intern/hair_volume.cpp b/source/blender/physics/intern/hair_volume.cpp index cd4e6503965..f59df71d7e9 100644 --- a/source/blender/physics/intern/hair_volume.cpp +++ b/source/blender/physics/intern/hair_volume.cpp @@ -220,11 +220,18 @@ void BPH_hair_volume_grid_velocity(HairGrid *grid, const float x[3], const float float r_v[3]) { float gdensity, gvelocity[3], gvel_smooth[3], ggrad[3], gvelgrad[3][3]; + float v_pic[3], v_flip[3]; hair_grid_interpolate(grid->verts, grid->res, grid->gmin, grid->inv_cellsize, x, &gdensity, gvelocity, gvel_smooth, ggrad, gvelgrad); - /* XXX TODO implement FLIP method and use fluid_factor to blend between FLIP and PIC */ - copy_v3_v3(r_v, gvel_smooth); + /* velocity according to PIC method (Particle-in-Cell) */ + copy_v3_v3(v_pic, gvel_smooth); + + /* velocity according to FLIP method (Fluid-Implicit-Particle) */ + sub_v3_v3v3(v_flip, gvel_smooth, gvelocity); + add_v3_v3(v_flip, v); + + interp_v3_v3v3(r_v, v_pic, v_flip, fluid_factor); } void BPH_hair_volume_grid_clear(HairGrid *grid) |