diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-12-18 15:52:31 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:09 +0300 |
commit | db2ac79fc7ca7d65a3e2912b4b6b5f1ec3b911fd (patch) | |
tree | 6cb4bce50e8a27cebcc7ce913587d2cfb37dcaaa /source/blender/physics/intern/implicit_blender.c | |
parent | f0e86905261713f5ea1cd572b6c40b6c5587110f (diff) |
Radical simplification of the wind effect on hair, since the previous
approach does not work very well.
Using a cross section estimate still causes large oscillations due to
varying hair force based on angles. It also requires a sensible hair
thickness value (particle radius) which is difficult to control and
visualize at this point.
The new model is based purely on per-vertex forces, which seems to be
much more stable. It's also somewhat justified by the fact that each
hair vertex represents a certain mass.
Conflicts:
source/blender/physics/intern/BPH_mass_spring.cpp
Diffstat (limited to 'source/blender/physics/intern/implicit_blender.c')
-rw-r--r-- | source/blender/physics/intern/implicit_blender.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c index e6320507db0..9f43e793e05 100644 --- a/source/blender/physics/intern/implicit_blender.c +++ b/source/blender/physics/intern/implicit_blender.c @@ -1493,11 +1493,22 @@ void BPH_mass_spring_force_edge_wind(Implicit_Data *data, int v1, int v2, float add_v3_v3(data->F[v1], f); world_to_root_v3(data, v2, win, winvec[v2]); - /* use -length to invert edge direction */ edge_wind_vertex(dir, length, radius2, win, f, dfdx, dfdv); add_v3_v3(data->F[v2], f); } +void BPH_mass_spring_force_vertex_wind(Implicit_Data *data, int v, float UNUSED(radius), const float (*winvec)[3]) +{ + const float density = 0.01f; /* XXX arbitrary value, corresponds to effect of air density */ + + float wind[3]; + float f[3]; + + world_to_root_v3(data, v, wind, winvec[v]); + mul_v3_v3fl(f, wind, density); + add_v3_v3(data->F[v], f); +} + BLI_INLINE void dfdx_spring(float to[3][3], const float dir[3], float length, float L, float k) { // dir is unit length direction, rest is spring's restlength, k is spring constant. |