From ffde74a878882618ab4d4179ba8dd9b98aab15e2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 14 Feb 2018 14:33:53 +0100 Subject: Simple hair children: Initial implementation of twist control It allows to have children hair to be twisted around parent curve, which is quite an essential feature when creating hair braids. There are currently two controls: - Number of turns around parent children. - Influence curve, which allows to modify "twistness" along the strand. --- source/blender/blenkernel/BKE_particle.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/BKE_particle.h') diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 2c72373c2a9..747a6b65bb0 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -162,6 +162,7 @@ typedef struct ParticleThreadContext { struct CurveMapping *clumpcurve; struct CurveMapping *roughcurve; + struct CurveMapping *twistcurve; } ParticleThreadContext; typedef struct ParticleTask { @@ -349,6 +350,7 @@ int psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct Pa /* child paths */ void BKE_particlesettings_clump_curve_init(struct ParticleSettings *part); void BKE_particlesettings_rough_curve_init(struct ParticleSettings *part); +void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part); void psys_apply_child_modifiers(struct ParticleThreadContext *ctx, struct ListBase *modifiers, struct ChildParticle *cpa, struct ParticleTexture *ptex, const float orco[3], const float ornor[3], float hairmat[4][4], struct ParticleCacheKey *keys, struct ParticleCacheKey *parent_keys, const float parent_orco[3]); -- cgit v1.2.3 From 67cec97387965009dfaa57f7f4c8ab948e048e70 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 14 Feb 2018 16:46:29 +0100 Subject: Simple hair children: Make twist affected by vertex group The idea is to give a control over direction of twist, and maybe amount of twist as well. More concrete example: make braids on left and right side of character head to be twisting opposite directions. Now, tricky part: we need some negative values to flip direction, but weights can not be negative. So we use same trick as displacement map and tangent normal maps, where 0.5 is neutral, values below 0.5 are considered negative and values above 0.5 are considered positive. --- source/blender/blenkernel/BKE_particle.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/BKE_particle.h') diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 747a6b65bb0..0cda7dceb33 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -112,6 +112,7 @@ typedef struct ParticleTexture { float damp, gravity, field; /* used in physics */ float length, clump, kink_freq, kink_amp, effector; /* used in path caching */ float rough1, rough2, roughe; /* used in path caching */ + float twist; /* used in path caching */ } ParticleTexture; typedef struct ParticleSeam { @@ -159,6 +160,7 @@ typedef struct ParticleThreadContext { float *vg_length, *vg_clump, *vg_kink; float *vg_rough1, *vg_rough2, *vg_roughe; float *vg_effector; + float *vg_twist; struct CurveMapping *clumpcurve; struct CurveMapping *roughcurve; -- cgit v1.2.3