Commit: be24adc9ef6a73aa9e0f06da6014911e6a8a80d2
Author: Lukas Tönne
Date:   Sat Nov 8 19:34:16 2014 +0100
Branches: master
https://developer.blender.org/rBbe24adc9ef6a73aa9e0f06da6014911e6a8a80d2

Implemented PIC and FLIP methods for combining the fluid grid simulation
with the Lagrangian hair model.

===================================================================

M       source/blender/physics/intern/hair_volume.cpp

===================================================================

diff --git a/source/blender/physics/intern/hair_volume.cpp 
b/source/blender/physics/intern/hair_volume.cpp
index cd4e650..f59df71 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)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to