PaintFX: The Ultimate Hair Designer
Since some people have emailed me for explainations, I have decided to added a sample file for this tutorial get it here, it shows the basic concept at work.
Creating cg hair in 3D is a difficult task, the most common approach uses geometry surface with texture mapping. There are a few disadvantages to this method, that makes it difficult to work with. First of all to to tweak the look of your hair requires repainting texture maps, and to control the form requires careful planing and placing each geometry piece. So why Paint Effects? Pfx is a very effective tool suited for creating hair, it gives you ultimate control on exactly how you shape your hair, with no texture painting/alpha maps and lesser time to setup. Changing the looks of your hair can be done on the fly with instant feed back. It is very faster to render, takes very little memory. The render that appears on the above image will take no more than 30 seconds on a 1Ghz machine. "Did you say 30sec!?" "Yes I did", "But I heard in the Final Fantasy Movie it took ..xxxxx amount of days with xxxx machines and xxx mount of people...." Haha...I was only joking this is nothing compare to FF of course, but with performance(speed) to quality ratio, Paint Effects can prove very effective, just read on and I shall you how.
Part 1: setup
First you'll need to have a clear vision of what kind of hair you want for your character, otherwise you'll find your self tweaking endlessly in Maya without any satisfaction. If the image of the hair you want is not in your head then its best to work against a image plane of a photo or sketch. OK so you have a head of some character, we need to make that surface live and draw curves on top of the skull. If you have a subd surface just convert to poly for makelive. Select the head, Modify->Make Live, Create->CV curve tool, start from the back and middle of the head to the front. This curve determines where the hair splits, check my reference for how long this should be. Now EditCurves->Rebuild curve , rebuilt it to uniform and around 9 spans, degree 3. You should also turn on show CV for the curve, you are going to need this often in this tut. You should assign this command to a hotkey,like Cntrl-Alt-V, rename this curve to hair_split_curve01. Now select the curve, Duplicate then move the two curves apart a little so that mid line of the head is in between the two curves(below)rename the second curve hair_split_curve02. Also draw a small curve between at the front of these two hair_split curves, so they join. Doesn't have to be too accurate, 2 spans should do(below). Lower and scale these 3 curves so they are borrowed inside the head.
Part 2: hair control curves
We are going to draw a series of curves that roughly resembles how the hair should flow. Select the head, Make Live, CV curve tool, start off by snapping the first point on to the front CV of hair_split_curve01. Then place about 4-6 CVs on the side of the head(left). The number of CV should be as little as possible while still able to give enough control to shape your hair later on. You can start off a bit more and then delete the CVs later on if the controls takes too long to tweak. Continuously place new curves this way snapping the start of the each new curve to the CVs on the hair_split_curve01. This way the main hair_control_curve are evenly spread, and will result better optimization for paintfx later on. If your hair_split_curve01 has 9 spans you should end up drawing 9 to 11 hair_control_curves on one side of the head. Now select first hair_control_curve and move the CVs out from the head, so they don't intersect with the head.
Tweak the CVs on this curve so they take the shape of your hair in that region.(i.e. front, side). Now tweak all the CVs of the hair_control_curves, so they don't intersect and take on the shape of your hair. Take your time, the better resemblance of your hair you achieve here with few curves/CVs the better look/optimized paintfx will perform later on. I' would say spending a good 30min tweaking will be while worth it :) check the images below for reference. After tweaking them Group the hair_control_curves and Duplicate to the other side Then tweak a little to make the difference between the two sides. Now draw the curves the same way for the front hair_split_curve, so that you have a some hair control curves for the front. 3 curves would be good, make sure those curves looks continuous to the curves control curves on the left and right side.(More below)
Part 3: Power of Pfx
Now we are ready to make some hair! Go to the visor and open up the *brushes/hair/ folder and select a hair brush that mostly resembles your hair design. If you have followed my hair design then select the hairRed1.mel(right, make sure its highlighted). We are going to base on this brush to start off, select hair_split_curve01, PaintEffects->Curve Utilities->Attach Brush to Curves, this will create a new brush for the the stroke hair_split_curve01, and some hair of course. Don't worry if the hair looks like lightning strikes. Rename the new stroke to hair_side_stroke01(outliner), and the new brush to hair_side_brush. If you select the stroke in the outliner and bring up attribute editor. Check the brush tab, there's a load of sliders here, don't be put off by it, its categorized well so you don't have to access many settings that's not required here, I'll go through all the ones that requires to design our hair :) We'll need to adjust the Global Scale according to the size of the head, you can see I have 0.150, but that is my character is at 8cm tall. You should adjust this so that the hair looks very short. If your character is 160cm then leave the Global scale at 3. This is your over all pfx brush scale setting. Open Brush Profiles and look at the Brush Width, this will resemble the how wide our hair emits grows from the hair_split _curves, set it to 0.8, just don't make it too low otherwise your hair will look too flat. Leave the rest of the slider default, oh yeah ignore those other tabs on my screenshots.
Now first select the hair_side_stroke01 again(outliner), then shift select the all the main_control_curves on one side of the head,(i.e. either left or right), Paint Effects->Curve Utilities->Set Stroke Control Curves. The hair now may follow the shape of the hair a little. Bring attributes for hair_side_brush, then open up the tab tubes|Behavior|forces, set CurveFollow=1, now all the hair should follow exactly the main_control_curves. Set Length Flex=1, this will stretch the length of hair to the same as the main_control_curves. Also go to the hair_side_stroke01.shapeNode, and set the display quality to around 10 so its faster to up date. Now its a good time to test render the hair, make sure your background for the camera is white, so the hair shows up. Don't worry if it doesn't look like what you want yet, as long as the shape resembles...ok time for coffee, next I'll start the real thing.
Part 4: Tweaking PFX
Now here comes the part where you'll spend most of your time doing, fine tune the exact look of your hair. 30% setup 70% tuning. Note we will still be working on one side of the hair first. You'll also need to do a lot of test renders, because viewPort hair doesn't reflect some settings you tweak. I suggest using below 320*240 res, as higher res will increase pfx render times, and of course hide everything else other than the hair strokes. Start off by open the hair_side_brush's tab tubes|creation adjust the tubes per Step, this will dramatically effect the speed of pfx renders and amount of hair you have. You don't need a lot actually, around 25 would be good enough.
Then set the Length Min=7 andLength Max=10 . These if you want more hair in between main_control_curves then have length Min higher or even same as Length Max.
Then set the Tube Width1=0.3 and Tube Width2=0.1, width2 is the tip of your hair, so if you want more sharp and realistic hair you need to have lower width1 and 2 more, but you also need to increase the tubes per Step for compensating thinner hair, because the hair don't look as full.
Adjust the Segment=64, the value here should be as little as possible while the hair still looks smooth, this will affect render time also, try to lower it.Also set the simplify Method to Tubes per Step, this speeds up the view port without losing to much details. Check for all the values below. Now do a test render you should get something like below. Spend some time test render the settings for your hair, if you don't know what each slider is contributing to the effects, try one by one and test render, and type in values out side of their range.
Part 5: shading and texturing
Select the hair_side_brush Open up the tabs Shading|tube shading, change color1 to the root color of your hair, and color2 for the tip, I left it as defualt black and dark red. Set transparency1 to black, set the transparency2 to gray if you want softer hair, or black to take more shape like mine. Set tip Fade =0.2, set higher if you want more soft hair, just test render these settings until you are satisfied. Now if you want more realistic hair then you read below on texturing, or if you are just after anime/manga styles its good to leave it at that without texture, its actually pretty nice without textures. Just because textures looks realistic doesn't mean you'll always need to use it, try to suit the character. OK For the texture part, open shading|tubes shading|texturing for the previous brush. Select map Color, set Texcolorscale=0, this lets you use all the colors from your texture. Texture type = File, Map method = tube3D, and set both Tex Color1 and TexColor2 to a white, to take all color from the texture. Now for the image Name you'll need to load a texture, (below) I have my texture sample, you shouldn't make this hires, its only a few color information that will contribute to the effect, and the more random the pattern the better. What I did was use the same hairRed1.mel brush to paint in the 2D canvas viewport, painting vertical lines and then bring to photoshop to scale and touch up. If you have even lower width for your hair then make the texture for the hair as if more zoomed in to the hair strand. If the texture is not showing up then probably you have the hair width too thin and texture res too high.
Part 6: completing the whole hair
Now you need to apply the brush to all hair strokes on the other side of the skull and a little in front. Select hair_split_curve02, PaintEffects->Curve Utilities->Attach Brush to Strokes, while the new stroke is selected shift select all
the control_curves for the other side, PaintEffects->Curve Utilities-> set Stroke Control Curves, just like we did previously. Now select the new_stroke created then shift select the hair_side_stroke01, PaintEffects->share One Brush, this
will allow you to have one brush(hair_side_brush) to control both strokes of the hair. For the front hair, we are going to use separate brush for optimization later, select the original front_hair_split_curve, do a Attach Brush to Strokes and then Set Stroke Control Curves, to grow out the hair again. Rename this new stroke to hair_front_stoke. Now select the hair_side_stroke01, PaintEffects->Get Setting from selected stroke, then select hair_front_stroke, PaintEffects-> apply setting to selected strokes. Now the brush for hair_front_stroke will be the same as hair_side_brush, look at the hypergraph view screen shot below for connection reference. (Note: if your hair design is different on the other side of the skull then you'll need to use a separate brush eventually, just transfer the brush setting from the previously tweaked to the new one, and start tweaking from there). You should also assign a different hair texture for the front hair, if you are working with textures.
Part 7: Optimizing your hair
Right now the hair at the front don't look right and the side still lacks volume, for what I want. We are going to optimize both brushes of hair and make them not only faster to render but also take more volume. You don't have to crank up a lot of tubes per step to achieve more volume in your hair. Select the hair_front_brush, open up attribute editor, tubesPerStep=10,try even lower as there's less need for the front, the trick is to have a high width1 so that it doesn't really represent each strand of hair, but a bunch, you can do each strand with a texture map. Also lower segments=24, or less if the hair still looks smooth. Open the tab Behavior|forces, curveAttract = -0.041, this spread the hair away from a little the control curves, so a lot of the hair don't just stick close together near a single control curve. Select the hair_side_brush and also put a negative curveAttract value, I used -0.050. Now your hair should look more natural, to add more randomness play with the seed value and tube Rand values in the stroke.shape Node and brush NodeWe all know human hair don't grow evenly in volume because we cut them, for example some hair in front will be sparse and back will be more dense, or the side maybe more dense then the back. We can't just crank up the tubesPerStep, that will make overall the hair dense. We'll need to use a pressure curve to tell Paintfx where we need more hair. Pressure curves can be applied to many other parameters to optimize and achieve the effect you are after. Select the hair_side_stroke01, PaintEffects->CurveUtilities->makePressureCurves/option, change the control points=10 and offset scale=0.05, a curve should be created next to your stroke, if the Pressure curve is too close or far you'll need set a different offset Scale, to delete it, open up the pressure Mapping tab under the stroke.shapeNode, then right click pressureMin3, deleteExpression, then delete the pressure curve its self. If you have got a nice pressure curve near hair_side_stroke01 then open pressreMapping tab and set pressureMapping1=tubes Per Step, set pressure min1=0.1 and pressureMax1=1. Turn off other pressureMappings to stop unexpected results. Now you'll need to adjust the CVs on the pressureCurve, move the points in the middle of the curve more up higher then the rest(right). If you don't see any change to the density of hair on the side then change the pressureMin1 a little then it should update. Also lower the CVs the at the two ends of the curve to have less density in front and back. Test render different position for the CVs, using same camera angle and using the slider below the renderView to see the difference. Once you are satisfied, make a pressureCurve for hair_side_stroke02. Here's my render after optimizing with pressure curves.
That's all, you now have good control over your designed hair. There's some very important details that I missed. You maybe wandering, you can't animate this!, true, to add dynamics is very easy after you have the control_curves set. You can use several techniques to drive the motion of hair_control_curves, mel/expression/softbodies/clothObjects. For a clothObject approach take a look a Duncan Brinsmead's tutorial here, it uses cloth dynamics to drive the curves, all you need to to do is use the control curves we already made to produce the cloth objects. Another aspect is lighting, specular and shadow I did not talk about, that you can look into it your self. This is because to have good light/shadow not only requires working with pfx settings but also lights themselves, so its beyond the tut.
I hope you now understand the ideas behind how to use pfx not only for hair but other objects that takes similar form. The trick is using one stroke and some control_curves to shape that stroke to take on the form and let Pfx fill out the in betweens. I hope you had as much fun reading it as me making this tutorial...yeah..right... :) If you have any question
or suggestions please e-mail me email@example.com