Hair System Roadmap

The Blender hair system will get a number of improvements for the Gooseberry project. Especially the hair dynamics have to be improved and integrated better into the set of artistic tools to allow animators to control and tweak the hair system efficiently. We have a number of goals that should make hair modelling and simulation into a more flexible and helpful tool.

Solver Stability

Animation tools for hair are quite useless without a stable physical solver. Especially for long hairs a physical solver is a valuable tool for generating believable motion. The solver for the simulation has to be very stable, meaning that it produces correct values (no “explosions”) and does not introduce additional motion due to numerical errors (jiggling).

The current solver for the hair dynamics has a number of issues, resulting from conflicts in the mixed cloth/hair model, questionable assumptions in the force model and plain bugs. To avoid these issues the numerical solver implementation will be replaced by a modified Eigen-based solver. Eigen is a library for linear algebra that is already used in Blender and provides a lot of optimizations that would be hard to introduce otherwise.

Numerical Solver Overview (since this is a code blog)

The physical model for hair systems defines each hair as a series of points, connected by “springs”. In addition there are a couple of external influences that have to be accounted for. The physical equations boil down to calculating changes in positions and velocities of these points.

Our solver then has the task of calculating these Δx and Δv so that the result is as close as possible to the actual value. As a first-order approximation and using sensible force models the differential equations can be expressed as a linear system A·Δv = b (See the References section for in-depth information). The algorithm of choice for solving this system is the Conjugate Gradient method. The Eigen library provides a nice set of CG algorithms already.

Unfortunately, for a constrained system such as a hair structure with “pinned” hair root points as well as collision contacts (see below) the basic CG solver is not enough. We need to extend the method somewhat to take constraints into account and limit the degrees-of-freedom in the solution selectively. The paper by Baraff/Witkin describes this modification in detail.

Hair Volume and Friction

Hair and fur coats need a number of features that notoriously difficult to model in a hair simulation: Volume and Friction. “Volume” is the phenomenon where a lot of hairs closely together will push each other away and leave empty space between them (especially curly hair). “Friction” is what makes entangled hair so difficult to comb, because hairs stick together and have lots of surface area.

Both these effects could be naively modeled by hair-hair collisions, but this is prohibitively expensive due to the potential number of collision pairs. A more economical approach is to model the cumulative effect of hairs using a voxel grid. This feature has already been implemented.

https://youtu.be/1zdgV_oiJMU

Collisions

Collisions are essential for believable simulation results, but so far don”t exist in for hair simulation in Blender (only a volume-based friction model which is a poor replacement).

The first stage in collision handling is to actually detect intersection of hair segments with meshes. This is done in two distinct phases to speed up the process:

  • Broadphase: The hair segment is tested against the bounding boxes of eligible colliders to narrow down the number of pairs. Acceleration structures can speed up the process of finding overlapping pairs.
  • Nearphase: The potential intersection pairs are tested for actual intersection of the detailed geometry.

The detection of collision pairs is currently handled by a BVH tree based structure. In the future it may become advisable to use the Bullet collision detection for finding such pairs, since it has a lot better optimizations for complicated intersection tests and broadphase filtering.

The second stage is to actually make a hair particle react to a collision, so that the hair is prevented from entering the mesh object. A simple approach is to generate a repulsion force which pushes outward from the mesh. However, this force can cause a lot of unwanted motion. The effect is that a hair particle can not stably come to rest on a surface or even the simulation can “explode” when a particle gets trapped in a collider cavity and it”s velocity increases exponentially from repeated collision responses.

A much more elegant and stable approach to handling collision response is to define the contact between a hair and a mesh as a “constraint”: When the hair collides with a surface it”s motion becomes restricted in the direction of the surface normal (while moving tangentially is still possible and desired to relax internal spring forces). An implicit solver can be modified so that collision constraints are taken into account and jittering effects as well as spring instability is largely avoided.

Physics Settings

Settings in the hair dynamics panel need reorganization to be more intuitive and allow easier tweaking. Naming there is currently misleading and as a consequence artists seem to tend to overconstrain the hair system by steadily increasing forces, until eventually the solver gives up and the simulation “explodes”.

The suggested changes would group the dynamics settings into four categories:

  1. Internal Forces: Structural features of the hairs in general (Bending, Stretching, Damping)
  2. Interaction: Friction and Volume Pressure settings, caused by concentrations of hair in the same space
  3. Collision: Bounciness (restitution) and friction of the hair
  4. External Forces: Effect of various force field types on the hair system

To avoid the problem of counterbalancing forces this ordering should suggest a sensible workflow. Starting with the internal forces results in natural behavior of individual hairs. Setting up friction and damping effects secondarily should help avoid the problem of masking extreme forces by equally strong damping, which creates an “explosive” setup that is hard to control.

Each of the categories can be disabled on its own. This also helps to fix issues with either of the influences in case something goes wrong. Otherwise the only way to test the hair dynamics settings is to reset them to zero individually.

Presets could be another simple but effective way to facilitate tweaking. A fine-tuned group of settings can then be stored for later use or to generate variants from.

Guide Hairs

Editing parent hairs on Koro

Physical simulation is only one tool among many in 3D animation production. A major goal for the hair system is to improve tools for artists and combine classic keyframe animation with simulation. The current workflow of the particle hairs gives animators very little control over the simulation beyond the initial setup phase (“grooming”). The results of a simulation never turn out exactly as desired, and so it is very important that animators be able to define corrections to simulation results.

An important concept for simulation control is the rest position of hairs, i.e. the “natural” shape and orientation a hair will be attracted to by the internal bending forces and additional (non-physical) goal spring forces. This rest position is currently defined as a single shape. Defining keyframes for particle system/hair is a clumsy process with a lot of overhead and far from a usable tool. After baking the entire simulation artists can also modify the point cache data, treating the motion of each hair point as a curve, but this is also limited and doesn”t scale well to large hair systems.

Guide Hairs would solve the problem of keyframing the hair rest positions. They are the primary data structure that animators work with, using sculpting/grooming tools and keyframes if necessary. They are roughly equivalent to the current base hair system, although for clarity renaming them is a good idea.

Simulation Hairs form the second data layer in the hair system. They are initially generated from the guide hairs (which also form the sim hairs” natural rest position). We have to decide how to display and distinguish these layers in the viewport, but it should be clear to artists that these are separate concepts.

Note that there could actually be more simulation hairs than guide hairs! This is an important feature which allows animators to work on a small set of hairs (easy to set up and control), while having more detail in simulations such as colliding with small objects. Generating simulation hairs can use the same interpolation approach as current child hairs.

Render Hairs are the current “child” hairs. They are not stored as permanent data and don”t carry state information of their own. Their purpose is only to generate sufficient visual detail for renderers. Render hairs can incorporate quite a few shaping features of their own, such as randomness, curling or tapering.

Further Reading

“Large Steps in Cloth Simulation” (Baraff/Witkin 1998): Extensive paper on the use of a modified Conjugate Gradient solver for cloth systems, including useful chapters on force derivations, constraints and collisions.

“Simulating Complex Hair with Robust Collision Handling” (Choe/Choi/Ko 2005): Detailed description of a hair collision response model using the CG solver method

“Artistic Simulation of Curly Hair” (Pixar technical paper, “Brave”): Very sophisticated hair model for long curly hair (collisions are too much for our purposes, but the bending model is very nice)

“Volumetric Methods for Simulation and Rendering of Hair” (Pixar technical paper, “The Incredibles”): Describes in detail the volumetric approach to hair-hair friction modeling

The Future of Overrides
This Summer’s Sculpt Mode Refactor
Geometry Nodes Workshop: October 2024
New Brush Thumbnails

29 comments
  1. Blender is splendid package, but hair collisions to mesh very puerile It will be good if constraint like the Maya and some other soft and plugins

  2. The updated collisions is something that many people have been asking for across forums. It will be great if the hair does actually stay outside of the mesh(es) it intersects with.

  3. Great job on the hair system! :)

    Similar to what ivampretti said, here’s what I’d love to see in Blender.

    https://www.youtube.com/watch?v=sHXnOX29DJg

    Something this easy for the creation of the hairstyles would be a dream come true (maybe the hairnet add-on could work as a starting point?).

    We wouldn’t need to spend so much time working on the children if we had better control on the shape of the parents. The children would just follow it.

    That alone would already make me super happy, but think of the possibilities… If those guide-meshes could remain linked to the particles (as instructions that tell Blender how to create the particle system), we could use them for further animation as well. With all the tools blender already has available for meshes, not even the sky would be the limit. :)

    It would be awesome if the physics for the particles and the control of those guide-meshes could be integrated as nicely as the edit and sculpt modes, allowing us to hop between them quickly to achieve what we want.

  4. It would be nice to be able to impact hair in linked assets. Say you want to animate a shot with hair blowing in the wind on a linked asset, I would like to be able to add the force field and tell Blender which parts of the hair to impact. Since we are limited to only one proxy now, perhaps a separate type of field force can be designed or changed for a linked group to “see” inside and animate that part of the group.

  5. One thing that might be nice for hair is to have a memory slot or so for hair styles and maybe be able to change them just as facial morphs.
    So a hero can have wild hair at work, but at home have good looking hair. Just a bit like me when i wake up and go to work..

    • Shape keys for hair! And being able to animate between them?

  6. A cool tool for artists might be to set it up so the artist can control the amount of velocity smoothing that happens. Some hair bounces around more than other hair. Also if it was set up to work with with weight painting, it could be used to show the transition from a muddy, matted sheep to a clean sheep with dynamic paint. It could also be used for a sheep that fell on it’s side in a puddle and becomes muddy on just one side.

  7. The movement is so real. Great job.

    The hair system in blender could get an new feature that is used to model and animate the hair. With a mesh you sculpt the general shape of a part of the hair and the particles fill the shape of the mesh, is like to build a shape for the children particles and each parent get a mesh. I dont think it is too complicate to implement.

  8. I am 13 and I suggest that if you guys can make blender a bit easier to use and work around the game engine that would be great. If you guys can have not only a modeling tool but also a Game Engine that is so much powerful than Unity, everyone would be using you guys software since most of the questions are based on the game engine. The hair modeling is a pain and causes to much confusion and I wish that you cut off the difficulty on the hair thing for all artist who are complaining about it today.

    In respect the Game Engine is not completely finished and there has been so many complaints about, how to move an object with python code. You can eve use velocity without having to write a billion lines. When you run the game engine the glass won’t show up and if it does it is ugly and not clean, can’t see the objects from the other side and looks like a mirror. The whole game engine is a mess. Can’t even make the game engine work for a decent MMORPG because the engine is a mess. Because of this most people don’t touch it and go back to Unity and all the other cool engines that aren’t a mess. The GLSL is not finished as everyone can tell.

    Everything else is awesome in Blender. The best tool I have used for modeling. I hope that you guys fix these problems because if you do you will have more people using it than ever before and that would be great and grand!

    Thank you Blender Team!

    • Bge is somewhat incomplete but right now they are focusing on render samples and cycles. Major improvements have been made to renders and baking. But this is an open source project. There are many that help make blender users happy. If you know somewhat of programming in python you can also make an add-on. I’ve seen 13 and even 10 year olds making fully functionable apps and games.

      • I agree. I have a lot to learn if I am planning to make an MMORPG with Blenders Game Engine. So far I am getting picked on for doing so but the picking on me thing is not going to keep me from achieving my dream goals.

  9. Please have a look at this
    A Chinese person made an hair add on :

    http://ch.nicovideo.jp/Arasen/blomaga/ar500981

    Sadly i cannot read it, but i think this another type of hair much seen inside animations and games, maybe combine your ideas ?.
    And find a translator to reach him / her

  10. Hi, this roadmap is woderfull ! I have just a suggestion for a feature of the hair system. When you use hair particle to do a field of flowers, you use an instance of a mesh flower ( or several ). But if you curve hairs, the flowers are not skinned by each hair ? Is this feature is hard to code ?

  11. I have found that a key element to hair control and animation is to be able to actually fix areas of the hair to controllers.

    For example hair pins, pony tails, hair tucked behind the ear and so on.

    Also I would suggest a good study of the nDynamics system in Maya. nHair is very stable and interactive for an artist.

    With sDynamics you can fix hair to controllers as I have suggested.

  12. Could be great have some way to sculpt the hair in the timeline, for animations. and new tools to sculpt better hair. The actual tools are great for sculpt, but we need a way to make a precise hair shape.

  13. Thanks for hair improvements. Can you also make a tool like this https://www.youtube.com/watch?v=u0DBirlPfjQ ?

  14. Having Lukas on board is one of the best things we can ask for. Lots of massive topics and hard tasks he’s able to cover about Blender development. I personally can’t wait for Cloth overhaul and Object Nodes.

    This hair article sounds great, mind fixing the “Editing parent hairs on Koro”? Can’t see that, seems broken.

    Last question: are nodes for hair on roadmap eventually? The article isn’t clear about that.

    Thanks

    • I used one of the Caminandes files for the Koro image (can’t remember which one is the original). Enabled the chest fur system and switched to particle edit mode. It’s not much more than a symbolic image though, since the current parent hairs are not quite the same as true guide hairs.

      We would like to “nodify” the hair system eventually. There are quite a few effects that can be combined, and nodes have the advantage of clarity because the user explicitly adds individual effects, instead of using a large one-for-all system and disabling parts of it. However, getting the solver stabilized, completing physical effects and improving the editing tools has higher priority.

      • Lukas, I think one of the biggest needs of the hair system is allowing more control/input based on child hairs. For example, allowing multiple child systems per hair system, and allowing child systems to be driven by other children. A great example of this is having children that are clumped to the parent hairs, but then having other children that are clumped to the first set of children. Is allowing finer control and mapping of hair systems a goal of this project?

    • Oh sorry, i misunderstood the Koro image remark. Should be fixed now.

      • I see, thanks a lot Lukas, can’t wait to follow future updates closely.
        Keep rockin’ and enjoy Gooseberry project

  15. if you want to analyse a fur system you can also look at the implementation of the houdini fur system. the nodes can be viewed and analysed and the tool doesn’t cost.

  16. Well the 2nd sheep looked a lot better, for collisions do you mean from the main mesh, so long hair can fall over a shoulder. Or do you really mean anything else; in that case it might be an idea to create special hair collision option, so the massive calculation can more easily be skipped.

    On a side note, i often read about the goal of Blender to do more with the bullet engine, i’m no blender coder, and i wonder what is the status of that, is it a slow far future set goal; or since it seams fast is it something more for a near future; i just got no idea of the work that is done; and so i like articles, like this one about hair.

    On a second note, with a bit more attention to the developing area, maybe blender can attract more people who are willing to learn this part from blender; for me and many like me its now abacadabra magical what you people do.

    • The goal is to get collisions working for anything you might want colliding with your hair, as well as a fast inter-hair system.

      I’m guessing that it will only check collisions against objects within the rigid body world/collision list. It would definitely be nice to be able to set a group within the modifier to manually override this though, in the case that you have a physics sim in your scene but only want certain objects to be tested against the hair.

  17. I agree with the previous two comments. I also think there could be ever better methods for placement of guide hairs than sculpting. For instance, using easily controllable splines or even grease pencil data to “draw” the hairs on the head, then convert to guide hairs.

  18. I completely agree with Matt, Yeti is a breeze to use and please avoid the typical programer mistake of completely reinventing the wheel. I wouldn’t say copy, but analyse and see if there is really a better workflow, and if there is, then it’s ok to redesign parts of the wheel, or extend it. Let’s not be obtuse or act out of pride (or fun) by going inventing everything from 0. Creativity is just as powerful if references are studied, ask every CG artist about it.

    What I would like to add is how hair is used as a cloner system also, this functionality should definitely not go away, but should go into a separate system or modifier.

  19. When the time comes to start designing the artist tools for working with/grooming/look dev-ing hair, I highly suggest we just copy Yeti as much as we possibly can. There’s no reason to completely reinvent the wheel when there’s already such an excellent, powerful workflow out there. I know that US artists don’t get to appreciate its power (Thanks, Joe Alter -_-), but it’s quickly become the standard in the rest of the industry. Having a similar workflow in Blender would make it much easier for outside artists to start using Blender’s hair system, and vice versa. With PyNodes available, hair could be one of the first internal systems that takes full advantage of the power that they have the potential to bring.

In order to prevent spam, comments are closed 7 days after the post is published.
Feel free to continue the conversation on the forums.