Home Technical Talk

Best way to create hair planes in Maya?

greentooth
Offline / Send Message
CheeseOnToast greentooth
Hey peeps,

I'm trying to improve my workflow for creating hair. I'm going for something similar to this :

HairTechnique?action=AttachFile&do=get&target=hair_uncharted2-chloe-wires.jpg

I've tried various approaches, but they all seem a little long-winded. Currently, the best method I've found is to create a poly hair strip and use a simple curve as a wire deformer. This works fine when the hair runs roughly in the same plane (e.g. the side of the head), but there's a few problems when trying to duplicate and rotate a hair section and its deformer. Basically, I'm just looking for some suggestions.

Mop, if you read this, I've tried using your renderable curve script, but I found the twisting to be a little unpredictable and hard to control. Might just be cluelessness at my end though.

Replies

  • Eric Chadwick
    I knew I saw something like this recently. Maybe some of the info here might help?
    Best method to create lowpoly hairs?
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    Cheers Eric, but there's nothing in that thread I can use. The one tip posted was Max-specific.
  • achillesian
    could make a strip, add bones and IK, clone it a bunch of times dunno, i don't use curves at all, so thats probably how i would do it, or just timesink polypushing. Depending on how you do the hierachy you can pin parts of the hair to spots too, might be kinda cool and a little more interactive than curves.
  • throttlekitty
    Curves would be the best way to go for a good 'clean' look like in the pic. The artist may have created simulated hair first, then constructed the planes to best match it. But the stretching in the back around the ponytail suggests use of deformers to pull the planes around.

    Looking at the part in the hair gives me an idea: Pull a curve from the head mesh and trim it down. Create a couple of curve-based planes. Use the fancy 'duplicate along curve' script twice on it: once for left side hair planes, and once for the right. I'd start with them pointing up, like an offset double-mohawk, and use a combo of deformers to wrassle it down, probably starting with a bend or wrap with a lowish poly plane. (I guess this is kind of a manual version of hair sims, innit.)

    That would only work for styles similar to this, but I think it could be expanded on.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    This is interesting. Keep us posted on your progress.

    I might just give this a go as well. Would be nice to grasp making hair like that.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    About 1½ hours. Pretty much my first attempt ever to do hair alpha.

    This probably doesn't suit that well for the type of hair the uncharted girl has

    hairtest01.th.jpg
    The head model and textures was the free head scan from Infinite Realities.

    I didn't really do any research on how people usually do this type of hair.
    I created a polygon plane with 16/12 segments and placed above his head >
    Scult modifier to get initial spherical shape >
    Lattice 3x3x3 and tweaked the plane >
    Make live and tweaked each vertex by hand >
    Deleted a few faces and merged vertices >
    Selected edges going across >
    Extruded in 3 iterations with Keep faces together off >
    Some manual tweaking on certain planes >
    Selected the faces from the original plane and deleted those >
    Selected vertices that connects the planes together and detached + separated them >
    UV-mapped (planar + normalize) one of them >
    Transferred UV layout to all other planes >
    Grouped all planes >
    Duplicated the group and displaced this group a bit from the other group >
    Manually tweaked some more on certain planes >
    Applied cgfx shader using diffuse w. alpha and a normal map.

    ... phew
  • throttlekitty
    In the coming week, I've a hairstyle a little bit similar to the one in the OP coming up. I'll chime in if I find anything helpful.

    Not bad kodde, though the polygon edges are very obvious. I'm still on the fence whether that style works better than an overall 'shell' for the main shape with fewer planes trailing off to suggest volume or not.
  • Illusions
    Offline / Send Message
    Illusions polycounter lvl 18
    Couldn't you just model the whole shape of the hair as one single polygon object (or multiples for different layers), with edgeloops heading in the direction you want the hair to flow, then once you have the hair mass and layers close to how you like it, use the edge ring selection tool to select strips you want, convert selection to faces, then extract with duplicate on. Repeat until satisfied. Then on the individual strips, use deformers, deformation brushes, or hand tweaking to add in variety.

    Or alternatively, do the above modeling of the shapes and layers you want, but instead of using extraction to make the strips, make the hair surface live, and draw out using the cv curve tool to draw how you'd want the strips to flow, then extrude a polygon edge along them. Repeat for each drawn curve. You could also duplicate strips once completed, then tweak like in the above.

    Using a plugin like Roadkill would probably help with rapidly uv'ing these as well.
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    I've been messing with NURBS planes to create the geometry. It's turning out to be a pretty decent way to work. I use a very simple NURBS plane (1 width division, 4 height divisions) to model the basic hair planes. You can abuse the NURBS shape as much as you want without having to worry about keeping nice, even quads. When you convert NURBS to polys with the settings below, you'll get a perfectly tessellated poly strip.

    NURBSconvert.jpg

    As a bonus, you can continue to shape the NURBS strip, and the polystrip will update to reflect the changes as long as you keep history. You can also change the number of divisions in the polystrip on the fly as shown here :

    NURBStesselate.jpg

    I'm still refining the process, but it's a step in the right direction.
  • Eric Chadwick
    ... and you get good UVs for free. Nice.
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    ... and you get good UVs for free. Nice.

    You would think so, but unfortunately not. The UVs are there and normalized into the 0-1 space, but they're not proportional. I didn't find any magic setting anywhere to fix it either.
  • wailingmonkey
    Maya seems to be having an awfully tough time with z-sorting
    (hardware render in viewport with the lcHairShader 2.0)


    preview.jpg



    Does anyone know of a way to fix this? (in XSI there were a couple of camera
    options that helped force z-sort to work better...I'm not familiar yet with
    Maya enough to know how to fix this) :(


    P.S. Thanks, CheeseOnToast...these planes were setup with your technique. :)



    *edit* ... frustrating ...
    frustrating.jpg
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    wailingmonkey> Thats cool. A bit stripey and thin at the end, but the placement of the planes looks nice.

    Maya's viewport handeling transparency has always been crap afaik. I have same issue on my Maya with my shader. :(
  • throttlekitty
    In your viewport menu, you have Shading>Object/Polygon Transparency Sorting, and Render>Default/High Quality Lighting. Your (physical) workspace should have: Cloth of an unknown origin, a small copper piece, an upturned thimble with the retinal discharge of a leper, and two candles.

    Different combinations of settings in Maya may help, video card driver updates sometimes help/hurt, especially with ATI cards. If not, perform invocations with the objects mentioned.
  • wailingmonkey
    thanks, throttlekitty....I was totally spacin' it on the leper retinal discharge...once
    I added that it's working *mostly* better now. (and switching to High Quality
    helped, although it changed up the overall lighting a bit, but way less z-issues --
    they just 'pop' now instead of showing the underlying skull
    geometry) :)
  • Neox
    Offline / Send Message
    Neox veteran polycounter
    ise some retopo tools, i guess nex can paint strips on existing surfaces? if so:

    hairtut.jpg
    it works with longer hair as well and is to me way easier than just extruding edges all the time without knowing how the final volume will look like

    as for the uvs of your nurbs, isn't there any setting for worldspace scale? even max has that and the nurbs in max are just plain crap :D
  • Snowfly
    Offline / Send Message
    Snowfly polycounter lvl 18
    That's cool Neox!

    About all the examples here, is it necessary to build the entire head of hair out of strips? Or could you build out a helmet, and lay on the flyaway strips afterwards to soften the silhouette? Seems like this would cut down on the z-sorting issues the Maya users are experiencing.
  • Vrav
    Offline / Send Message
    Vrav polycounter lvl 11
    Yeah, that's not an uncommon method at all as far as I know, but it does take up more texture resources and time if you sculpt the 'helmet' part out by hand. Can definitely look good, but it's not as modular in the end. So if you know exactly what you want and don't expect requiring much dynamic animation ingame, absolutely.

    And yeah, Neox, that's sweet.
  • ablaine
    Offline / Send Message
    ablaine polycounter lvl 14
    That's my favorite method so far. Sculpt out a base shape for the hair in zbrush and then retopo over that to create the hair strips. Hard to have different layers of hair with this method though.. Unless I guess you could sculpt out three layers of hair- inner, middle, and outer and then retopo each to create volumetric long hair?
  • wailingmonkey
    starting to really dislike Maya's hardware render capabilities (if you want to call them
    that)

    dislike-hardware-render.jpg

    Since the poly-strips method was creating such unacceptable z-sorting
    problems (neither 'high' quality nor default gave a reasonable result),
    I went back and just did a hair-mesh as 1 piece. Now I've basically got
    it to an acceptable point, but if the hair polys overlap themselves in
    the viewport in terms of z-depth, they seem to be unable to figure out
    which section is further behind the other.
    (sigh)

    Any way to fix this b.s.?
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    wailingmonkey> Throttlekitty's advice doesnt do anything for this project?

    As previously stated, Maya's Viewport + Transparency != True
  • wailingmonkey
    Hi kodde...well, I've been going between high/default, rendering and
    adjusting 'Transparency sorting' between per-poly/per-object, setting
    render options 'culling' (tried all 3 settings, none fixed it)...basically
    trying every combination to see if just 1 will allow for proper transparency.

    No dice. :(

    (using your eye-shader, btw...it rocks!) :)
  • arshlevon
    Offline / Send Message
    arshlevon polycounter lvl 18
    does anyone know if there is a good alpha to coverage cgfx shader for maya? this is typically the way you sort hair correctly for console hardware. i know its how square does the hair in final fantasy.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    Hi kodde...well, I've been going between high/default, rendering and
    adjusting 'Transparency sorting' between per-poly/per-object, setting
    render options 'culling' (tried all 3 settings, none fixed it)...basically
    trying every combination to see if just 1 will allow for proper transparency.

    No dice. :(

    (using your eye-shader, btw...it rocks!) :)

    Oh, bummer.
    Cool, didn't know anyone actually found it useful. :)

    Arshlevon> That sounds mighty interesting. Do you know of any good resources for Alpha to Coverage? I might just have to do some research on the subject. Would be nice if this could be used in a CGFX shader to solve this.
  • arshlevon
    Offline / Send Message
    arshlevon polycounter lvl 18
    its basically a way to anti alias 1 bit alpha so it looks kinda soft, if you look really close you can see patterning, but it looks way better than standard 1 bit alpha. so you get the sorting benefits of 1 bit alpha with a nice soft looking edge, really cuts down on the jaggies. i don't really know where to start looking for research, i know its now standard in shader model 3, i think it was hardware dependent before that.

    ***edit***

    you can see the effect in action on this comicon entry, check the hair out..

    http://www.gameartisans.org/forums/showthread.php?t=16567&page=6
  • wailingmonkey
    welp, just went ugly with it and duplicated the geometry, scaled by .99,
    then flipped normals. ugh.

    quick-fix.jpg

    RE: yer shader, kodde...like it alot. :) Didn't rtfm (of course), but is
    there a way to move main light source from 'centered' on the pupil as it
    is in default? (so it's upper-right, for instance instead of center)
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    arshlevon>
    Ahh, cool.
    You've certainly sparked my interest :)
    I'll have to find some time to do some research on this.

    wailingmonkey>
    There should be some light direction and/or position slots. Don't remember if it's only directional lights or if there is also any point lights. Here's an approach. Create a directional light. Open the shader in the attribute editor. Right click in an empty light direction slot, Lights > Your new light. Now when you rotate that light it should alter the direction of the light on the shader. Remember, don't scale the directional light representation with the scale attributes.
  • Eric Chadwick
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18

    Awesome. Thank you.

    So unless I am mistaking here, this is not possible in Maya since it does not have any form of AA in the viewport at all? You can't do AA with shader code right? At least not without post processing?
  • Eric Chadwick
    Ah, I guess not then. :(

    Unless you were able to use another hardware renderer maybe.
  • throttlekitty
    starting to really dislike Maya's hardware render capabilities (if you want to call them
    that)

    dislike-hardware-render.jpg

    Since the poly-strips method was creating such unacceptable z-sorting
    problems (neither 'high' quality nor default gave a reasonable result),
    I went back and just did a hair-mesh as 1 piece. Now I've basically got
    it to an acceptable point, but if the hair polys overlap themselves in
    the viewport in terms of z-depth, they seem to be unable to figure out
    which section is further behind the other.
    (sigh)

    Any way to fix this b.s.?

    Any time you're going to have a single object + transparent 'layers', you need to sort the triangles manually. For the most part, it is a matter of joining the objects together in a particular order. The mesh is rendered in real-time based on the vertex index, starting from zero, and to get proper blending, you first need to know what's behind an upper layer.

    In Maya, each new object added to the selection will be placed last in the vertex order when you do Mesh>Combine. In your case, it should be pretty simple, select the inner shell, then the outer, and combine. It can get more tricky if you have a lot of strips that weave around, or curl up and around at the tips.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 18
    In Maya, each new object added to the selection will be placed last in the vertex order when you do Mesh>Combine. In your case, it should be pretty simple, select the inner shell, then the outer, and combine. It can get more tricky if you have a lot of strips that weave around, or curl up and around at the tips.

    Nice. Good piece of info right there. Thanks.
  • Eric Chadwick
    Same is true in Max with EditablePoly>Attach, fwiw. More...
    http://wiki.polycount.com/TransparencyMap#Sorting_Fixes
  • wailingmonkey
    thanks, throttlekitty! now that I'm rebuilding my character, I'll try to incorporate
    yer tips to solve some render issues.

    appreciate it! :)
  • Fingus
    Offline / Send Message
    Fingus polycounter lvl 11
    Here's a little experiment I did inspired by the thread.

    In zBrush you have the option to export fibermesh as curves.
    I set the number of fibers down to something reasonable, like 600.

    fibers.jpg

    I exported them as .ma and opened it in Maya and used Surfaces > Extrude with these settings:


    maya.jpg

    Worked pretty well I'd say.

    We'll have to see how well it works on a real character. Also, it seems like this method doesn't produce any UV's. Perhaps having the Output Geometry be NURBS and then convert them to polygons would help?
    If not, simply doing a Unitize and then Move and Sew UV's should produce good UV's.
  • artquest
    Offline / Send Message
    artquest polycounter lvl 13
    starting to really dislike Maya's hardware render capabilities (if you want to call them
    that)

    dislike-hardware-render.jpg

    Since the poly-strips method was creating such unacceptable z-sorting
    problems (neither 'high' quality nor default gave a reasonable result),
    I went back and just did a hair-mesh as 1 piece. Now I've basically got
    it to an acceptable point, but if the hair polys overlap themselves in
    the viewport in terms of z-depth, they seem to be unable to figure out
    which section is further behind the other.
    (sigh)

    Any way to fix this b.s.?

    So I dont know if this works with the non default hlsl shaders or not but... Viewport 2.0 has an option listed under performance called "Transparency Algorithm", change the option to use depth peeling and it should fix all of your transparency sorting issues. Of course if you plan to display the final result in a realtime engine it's worth setting up your mesh to work with object sorting like others have said.
Sign In or Register to comment.