diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-12-16 21:40:29 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:09 +0300 |
commit | 5c7adf5be25552d4d9847bc99b25207880573005 (patch) | |
tree | bc833e90ae9dbce438cd390554a07b7da89ecab3 /source/blender/blenkernel | |
parent | 658fc3ddbc0e0a8b1ea7c10a62c6cc2e208c9461 (diff) |
Improved force field effects on hair strands.
The previous calculation was modulated with the angle between the wind
direction and the segments, which leads to very oscillating behavior.
Now the formula includes an estimate for the geometric cross section
of a hair segment based on the incident angle and the hair thickness
(currently just the particle size). This gives a more stable behavior
and more realistic response to wind.
Conflicts:
source/blender/blenkernel/intern/particle_system.c
source/blender/physics/intern/BPH_mass_spring.cpp
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_cloth.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index ccb45cb4de2..beb4f226aea 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -65,6 +65,7 @@ typedef struct ClothHairData { float loc[3]; float rot[3][3]; float rest_target[3]; /* rest target direction for each segment */ + float radius; float bending_stiffness; } ClothHairData; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index bcd0a0318fb..93eb273fc00 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3007,6 +3007,7 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int int k, hair_index; float hairmat[4][4]; float max_length; + float hair_radius; dm = *r_dm; if (!dm) { @@ -3034,6 +3035,9 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int psys->clmd->sim_parms->vgroup_mass = 1; + /* XXX placeholder for more flexible future hair settings */ + hair_radius = part->size; + /* make vgroup for pin roots etc.. */ hair_index = 1; LOOP_PARTICLES { @@ -3063,6 +3067,7 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int copy_v3_v3(hair->loc, root_mat[3]); copy_m3_m4(hair->rot, root_mat); + hair->radius = hair_radius; hair->bending_stiffness = bending_stiffness; add_v3_v3v3(mvert->co, co, co); @@ -3083,6 +3088,7 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int copy_v3_v3(hair->loc, root_mat[3]); copy_m3_m4(hair->rot, root_mat); + hair->radius = hair_radius; hair->bending_stiffness = bending_stiffness; copy_v3_v3(mvert->co, co); |