Download presentation
Presentation is loading. Please wait.
Published byProsper Spencer Modified over 9 years ago
1
Writing a Hair Dynamics Solver Tae-Yong Kim Rhythm & Hues Studios tae@rhythm.com
2
Hair Simulation Overview Understanding the Problem State of the Art Mass-Spring for Hair Length Preservation Angle Preservation Numerical Integration Advanced Issues
3
Uniqueness of Hair Dynamics Hair does not stretch at all But, (long) hair bends quite a lot Upon extreme bending, hair becomes stiff
4
Uniqueness of Hair Dynamics Hair does not stretch at all Stiffness Issue in length But, (long) hair bends quite a lot Preservation of Angular Momentum Upon extreme bending, hair becomes stiff Stiffness issue in bending
5
State of the art Rigid joint approach Mass-Spring (Clumped Particle Model) Continuum approach
6
Rigid Joints Simulate hair as connected rigid joints Developed in robotics field (e.g. Featherstone’s algorithm) Reduced Coordinate Formulation (Hadap2001) Generalized Serial Rigid Multi-body chain (Chang2002)
7
Rigid joints – state of the art Pros Natural Model for Hair Stiffness in stretch is avoided by formulation Cons Explicit integration only (Runge Kutta, etc.) Another stiffness problem in angles Collision response difficult (IK required) Hair tip touching shoulder problem Fails on stiff hair, fast collision
8
Mass Spring Simulate hair as connected particle mass Early work on hair simulation Mass-spring-hinge model Explicit integrators
9
Mass Spring – state of the art Pros Well understood in other field (e.g. cloth) No restriction in collision handling More stable integrator available (implicit) Cons Stiffness issue in explicit integrator Angles difficult to deal with in implicit one
10
Hair is a non-linear problem Rigid Joint (linear in angles) Non-linear constraints Mass Spring (linear in position) Non-linear in angles
11
Our choice - Mass Spring Friendly for production environment Robust Collision Response Efficient Challenges Standard mass spring integrator fails for a non-linear problem Implicit integrator helps, but not fully.
12
Basic Mass Spring System xixi xjxj
13
xixi xjxj L
14
xixi xjxj FjFj
15
xixi xjxj FjFj
17
How large is k ?
18
Hair does not stretch at all k is close to infinity k =
19
Explicit integrator diverges on Large dt (smaller dt slow!) Large k (smaller k looks bad!) k = n
20
Implicit integrator adds stability Large dt (OK) Large k (OK) k = n+1 implicit integration?
21
k = n+1 implicit integration?
22
Implicit integration – a closer look Filter Damping
23
Implicit integration – a closer look Filter Damping Implicit integrator adds stability thru Wider filtering of velocity Artificial Damping
24
Implicit integration as a filter Filter Damping * = Velocity Field
25
As k becomes larger, Implicit filter widens Filter Damping * = Smaller k * = larger k
26
As K , implicit filter makes things move together * = Smaller k * = kk Stability gain good for cloth, not quite for hair Too large k results in excessive smoothing Loss of angular momentum Too small k results in stretching of hair
27
Implicit integration as a damping force Filter Damping Artificial damping is automatically added Damping term depends on k and dt Increase in stability, but loss of accuracy too much damping as k approaches
28
Implicit integrator adds stability Loss of angular momentum ‘Good’ Jacobian (filter) very important k = n+1 implicit integration?
29
Well, how do we preserve length then? use non-linear correction k Is infinity!
30
non-linear post correction
33
Post solve correction Successive relaxation until convergence Guaranteed length preservation Cheap simulation of k infinity
34
non-linear post correction How to implement? Cloth simulation literatures Provot 1995 (position only) Bridson 2002 (impulse) Hair-specific relaxation possible
35
non-linear post correction Provot1995 Simulates biphasic spring Apply correction until convergence (or time limited) Non-linear, Non-dynamic inverse kinematic procedure
36
non-linear post correction Bridson2002 Momentum preserving impulse Non-linear Jacobi vs Gauss-Seidel
37
Large k not good Explicit integrator blows up Loss of angular momentum in implicit solvers k = Recap
38
Use post-step relaxation Very small k ok Explicit integrators ok k = Recap
39
Angle preservation Length preservation isn’t enough Hair tends to go back to original shape
40
Angle preservation
41
Flexion spring? Linear spring between distant nodes.
42
Flexion spring (x) Linear Spring Loss of angular momentum Ambiguity in direction for angles > 180 Unwanted wrinkles in hair shape
43
Angle preservation Derivation on angles Two angles suffice (no torsion) Energy derived from changes in angles
44
Angle preservation 00 F
45
Derivation on angles Additional anchor point needed at the root Angle preservation
46
Derivation on angles Full angle required (360 ) Axis generation an issue Angle preservation =2 /3 =4 /3 ’= 2 - = 2 /3
47
Implicit integration used on angles Non-linear problem again Jacobian treatment needed Angle preservation
48
Predictor-corrector scheme Implicit integration as a predictor for angles Non-linear corrector for length Two-pass implicit filtering with non-linear corrector in the middle of integration Linearized Implicit integrator augmented with a non-linear optimizer
49
Predictor-corrector scheme Implicit Filter (Predictor) Sharpener (Corrector) Implicit Filter (Predictor)
50
1.First pass-implicit integration First implicit solve to get new velocity
51
2.First pass-implicit integration Advance position with the predicted mid-step velocity
52
3.Non-linear Correction Apply non-linear corrector to get position (length) right
53
4.Impulse Change velocity due to length preservation Velocity may be out of sync after impulse
54
5.Second implicit integration Filters out velocity field Velocity field in sync again
55
Recap - Simulating Hair with Mass Spring System Hair dynamics is a non-linear numerical integration problem Standard mass spring integrator fails Implicit integrator helps, but not enough. Predictor-corrector scheme
56
Numerical integration Hair system is a banded system Block-tridiagonal (3 bands, length only) Block-diagonal (5 bands including angles) non-iterative, fast solver exists blockwise cholesky, LU decomposition 10-20x faster than Conjugate Gradient
57
Advanced Issues Collision handling Standard particle-based collision handler works seamlessly Flexibility in collision response Projection Invariant in implicit integration (Baraff- Witkin Style) Direct position alternation (corrector term)
58
Advanced Issues Hair-hair interaction Many ideas from existing simulation literature such as Proximity-based spring forces Continuous collision Rigid body like interaction Fluid-like interaction ….
59
Movies and Q&A Hair without bending force Hair with bending force Non-straight rest shape Collision of stiff hair Hair hair interaction – type I Hair hair interaction – type II
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.