19
Force Fields And Hair Lawrence D’Olivero <[email protected] > Applicable Blender version: 2.75 Doing realistic hair in Blender can involve quite a lot of trickery. While “Particle Edit” mode is handy for shaping custom hair styles, sometimes you want something which is controlled in a more procedural fashion, for example for animation purposes. This document will explore ways of using force fields for shaping hair. Documentation Conventions Blender makes heavy use of keystrokes. This document will use conventions for representing these similar to that commonly found in other Blender documentation: A symbol like G means to type the key with that label on the keyboard, then let it go. (If the key needs to be held down, this will be explicitly stated.) This also applies to non-modifier keys with labels that are not single characters, e.g. DEL or ENTER , as well as the arrows and function keys F1 , F2 etc. The spacebar (which is normally unlabelled) is denoted by SPACE . Because there are two sets of number keys, the ones on the numeric keypad will be denoted thus: NUM0 , NUM1 , etc, while the ones on the main keyboard will be denoted thus: 0KEY , 1KEY , etc. This also applies to the non-numeric NUM. versus .KEY , NUM+ versus +KEY etc. Modifier keys ( ALT , CTRL , SHIFT ) will be followed by a plus sign to indicate that they apply to a following key. Thus, ALT + G means to hold down the ALT key, and while doing so, press G . Multiple modifier keys may be applied, thus ALT + SHIFT + G means to hold down both ALT and SHIFT and, while doing so, press G . A sequence of keys to be pressed in succession will be denoted by the appropriate succession of symbols: thus G X , means to type G followed by X , while G G means to type G followed by G again. The standard mouse buons are denoted by LMB (leſt mouse buon), MMB (middle mouse buon) and RMB (right mouse buon). The mouse wheel will always be referred to as “the mouse wheel”.

Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Force Fields And HairLawrence D’Olivero <[email protected]>

Applicable Blender version: 2.75

Doing realistic hair in Blender can involve quite a lot of trickery. While “Particle Edit” mode is handy for shaping custom hair styles, sometimes you want something which is controlled in a more procedural fashion, for example for animation purposes. This document will explore ways of using force fields for shaping hair.

Documentation Conventions

Blender makes heavy use of keystrokes. This document will use conventions for representing these similar to that commonly found in other Blender documentation:

• A symbol like G means to type the key with that label on the keyboard, then let it

go. (If the key needs to be held down, this will be explicitly stated.) This also applies to

non-modifier keys with labels that are not single characters, e.g. DEL or ENTER ,

as well as the arrows ↑ ← ↓ → and function keys F1 , F2 etc. The spacebar

(which is normally unlabelled) is denoted by SPACE .

• Because there are two sets of number keys, the ones on the numeric keypad will be

denoted thus: NUM0 , NUM1 , etc, while the ones on the main keyboard will be

denoted thus: 0KEY , 1KEY , etc. This also applies to the non-numeric NUM.

versus .KEY , NUM+ versus +KEY etc.

• Modifier keys ( ALT , CTRL , SHIFT ) will be followed by a plus sign to indicate

that they apply to a following key. Thus, ALT + G means to hold down the ALT

key, and while doing so, press G . Multiple modifier keys may be applied, thus

ALT + SHIFT + G means to hold down both ALT and SHIFT and, while doing

so, press G .

• A sequence of keys to be pressed in succession will be denoted by the appropriate

succession of symbols: thus G X , means to type G followed by X , while G G

means to type G followed by G again.

• The standard mouse buttons are denoted by LMB (left mouse button), MMB

(middle mouse button) and RMB (right mouse button). The mouse wheel will always

be referred to as “the mouse wheel”.

Page 2: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Fields That Work

In my experiments, I found only two kinds of force fields that seemed to work in a useful way with hair: “Curve Guide” and “Charge”. If there are ways to make any others work, by all means let me know.

Basic Model

Here is a view of the basic model setup I will use for my experiments. The human-figure mesh I use comes from the excellent MakeHuman project, but you can use whatever you like.

I simply added a particle system to my figure, set its type to “Hair”, its length and density influences to the “Scalp” vertex group I had previously defined, assigned a material, set a suitablelength for the hair, and changed nothing else. As you can see, by default the hair goes in all directions. Now we will see how different force fields will affect this.

Selecting things gets slow: Once you add the hair system, you will notice that

trying to RMB on the figure, or anything near it, takes a long time. As an

alternative way to select things in Object mode, try LMB on the names of the

objects in the Outliner window instead. This is why it is a good idea to give your objects meaningful names.

Curve Guide Basics

The first type of force field we will try is the Curve Guide. Naturally, we will attach this to a new Curve object, thereby using the shape of the curve to control the shape of the hair. Here I createda simple Bézier curve, oriented it over the figure’s head, running front to back, and under the

Physics property tab, click the “Force Field” button and set the “Type” to “Curve Guide”.

Page 3: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Before playing with the settings, try and get a reasonable-looking position for the curve in terms of its effect on the hair.

Page 4: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

If the hair gets pulled forwards rather than backwards, it is because the

direction of your curve goes the wrong way. Either rotate it 180°, or TAB into

Edit mode on the curve and, in the “Segments” submenu of the “Curve” menu, use the “Switch Direction” option so the arrows go the right way.

Use only a single curve segment. I tried adding a second discontiguous segment to the curve, but it seems to be ignored for the purposes of the Curve Guide field.

Increasing the resolution of the hair: By default, the hair looks very angular. You can increase

the number of interpolation steps for each strand in the Particles properties tab of your

figure.

Look for the Render panel:

Page 5: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

See the “Steps:” field at the lower left? A value of n means that each hair gets 2n steps during rendering, so increasing this makes the hair look much less angular. Because it’s an exponent, increasing it to just 4 or 5 can make quite a bit of difference. It is also worthwhile trying the “B-Spline” checkbox: this makes the hair even smoother.

There is a similar “Steps:” field at the lower right of the Display panel:

This one applies to the on-screen display of the hair.

Page 6: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Now try editing the shape of the guide curve, and see how the shape of the hair follows it:

Also try the effect of altering the curve radius ALT + S and tilt CTRL + T on particular curve

points. For example, here the radius on the rear point is set to 3.0, causing the hair to billow out proportionately:

Page 7: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Here I added another point to the middle of the Bézier, reduced its radius with ALT + S to 0.2

to correspondingly constrict the hair and, after some quick scaling down of the neighbouring control points to smooth things out, I ended up with a reasonble starting point for a “pony tail” effect

However, the hair is pulled back too tight from the scalp. So here I tried increasing the Radius on the Bézier point closest to the head (shown selected) to the value 1.3:

Page 8: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Trouble is, the effect doesn’t really look right—the hair spreads out in a weird way around the scalp. However, there is another option: if you look in the Force Fields panel on the curve guide, you will see a “Weights” checkbox. Check this, and the Weight value assigned to each curve pointis used to control the strength of the field.

Here I restored the Radius of the selected point to 1, and changed its Weight to a low value instead—0.01. The remaining points have their Weight set to 1.0. As you can see, the hair puffs out more nicely from the scalp.

Page 9: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Clumping Amount and Shape: I did look at these settings briefly, but they didn’t seem to offer the kind of control compared to the other options I have described. If you discover anything interesting that can be done with these, let me know.

Next, in order to get more options to play with, we can turn on the “Kink” on our Curve Guide field. I could only find two items in this menu that could be coaxed into any noticeable effect: “Braid” and “Radial”.

Curve Guide With Radial Kink

From the “Kink” menu,choose the “Radial”option. Initially, nothing will happen.This is because youalso need to havenonzero values forboth the “Frequency:’ and “Amplitude:” fieldsbefore this option hasany effect.

The “Frequency”controls the number ofcycles of oscillation(actually the numberof half-cycles) of theradial effect along thelength of the curve,while the “Amplitude”controls the strength of the effect.

The maximum Frequency is limited to 10, but it is also effectively limited by the resolution of the hair strands, which you set in the “Steps” values in the “Render” and “Display” panels further back, remember?

Making different selections from the “Axis:” menu has no effect that I can discern. If you do discover one, let me know.

Page 10: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Here is what the Radial kink looks like with a Frequency of 4.0 and an Amplitude of 0.25:

Notice there are two places where the hair is widest, and two places where it is narrowest, making two complete cycles of variation, not four.

Curve Guide With Braid Kink

Now try choosing a Braid kink. There will be no effect until the Frequency is set to a nonzero value. The Amplitude of the braid controls how far the hairs spread out from the curve; you need to set it to a nonzero value in order to actually see a braid effect, otherwise the hair just clings tightly to the curve. However, it is best to choose a small amplitude, otherwise the effect will lookquite crazy! Here is an example with a Frequency of 10.0 and an Amplitude of 0.02:

Page 11: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Or again, with an extra point added to the middle of the curve, Weights turned on, and the Weight assigned to the curve point closest to the head set to 0.01 to puff out the hair from the scalp:

As with the Radial kink, selecting from the Axis menu doesn’t seem to affect anything.

Charge

Next, we will try the Charge force field. Just note one thing:

Page 12: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

You need at least two Charge force fields to interact with each other.

This is because the Charge field behaves (in a simplistic way, anyway!) similarly to electrical charges in the physical world: like charges (positive-versus-positive, negative-versus-negative) repel, unlike charges (positive-versus-negative) attract, and neutral (uncharged) objects are not affected by the field at all.

So the way to get the hair to interact with a Charge effector is to give the hair itself a Charge

force field. To do this, look in the Particles properties tab of your figure for the “Force Field

Settings” panel. Initially it looks like this:

As you can see, it lets you define up to two force fields for the hair to carry.

From the “Type 1:” menu, select “Charge”.

Leave all the settings at their defaults for now. We will play around with settings on the other Charge effector instead.

Page 13: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

For this Charge effector, create an Empty object, position it behind the head, and give it a Chargefield and set the Strength to -1.

This way, the hair gets attracted to the Charge effector. If the Strength is left at a positive value, then the hair will be repelled away from the effector.

Of course, the important thing is that the signs are opposite: you could equally set the Strength of the Charge field on the hair negative, and that on the Empty positive, that would also work.

Page 14: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

I am using an attracting effector rather than a repelling one, because I think this gives more control over the hair. If you come up with a useful technique using a repelling Charge effector, byall means let me know.

Here I set the strength of the Charge effector to -10. As you can see, the greater magnitude of thestrength causes the hair to bunch more closely around the effector.

And here I increased the Noise value as well, to 10. This adds a bit of interest to the placement of the hair—perhaps too much.

Page 15: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

There are two choices for the Shape of the Charge field: “Point” and “Plane”. We tried “Point” with the Empty object above; for the “Plane” shape, it seems best to actually use a Plane mesh as the effector.

Here is a plane (displayed as a wireframe) with a Charge effector with the Shape set to “Plane”. The strength is -10, and I moved it forward a bit so it intersects the hair: note how the hair spreads out in an interesting way on the rear side of the plane.

The size of the plane doesn’t make a difference to the field behaviour, but the orientation of its face normal does.

In the “Field Weights” panel of the hair settings, there is a “Stiffness” slider. Setting this to a nonzero (but small!) value:

Page 16: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

causes the hair to be less responsive to the field towards the roots, bending more as it gets further away from the scalp. For example, the illustrated value of 0.015 produces this result with the above plane effector:

It may also be worth enabling the “Advanced” particle physics settings. For example, with Newtonian physics, the “Damp” value adds some interesting effect, up to a setting of about 0.1.

Page 17: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Multiple Force Fields

Unfortunately, it seems you cannot have two different kinds of force fields (Curve Guide and Charge) acting on the hair at the same time. However, you can have more than one effector with the same kind of force field.

Trouble is, this turns out to be less useful than it might appear. Here I tried to place two curve guides at different angles to try to produce a twin-tail look. Initially the hair would just bunch upin the middle between the guides, but by checking the “Use Max” box on the field settings for each, and setting a “Maximum Distance” of 0.2, I was able to persuade at least some of the hairs to bunch around each guide. But sadly, only some.

The only way I could figure out to do this with reasonable control was to have two separate hair systems. I split the Scalp vertex group on the head of my figure into two, one for the left half and one for the right half, and gave each one its own hair particle system with its own copy of the settings. I put each of my curve guide effectors into its own object group, called “Hair L” and “Hair R”. Then, in the “Field Weights” panel of the settings for each hair system, I put in the name of the corresponding Effector Group:

Page 18: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

The result was exactly the level of control I wanted over the two separate sections of hair:

Particle Edit With Force Fields

What about creating a custom hair shape with Particle Edit mode, then trying to apply a force field to it?

This does work, but to prevent the force field from completely overpowering your custom hairstyle, you need to use low field strengths. For the Curve Guide, this means turning on the

Page 19: Force Fields And Hair - orig09.deviantart.netorig09.deviantart.net/f580/f/2015/190/9/4/force_fields_and_hair_by... · As you can see, it lets you define up to two force fields for

Weights option and assigning low Weight values (e.g. around 0.1) to the control points of the curve.

Copyright

This document is copyright © 2015 Lawrence D’Oliveiro. Licensed under CC-BY-SA.

Document History

2015 July 9 — first release