Paolo, the steps you described seem correct to me but since you’re getting that error, one of us must have made a mistake. The only thing that gets checked before giving that message is the number of objects you have selected. I’d like to figure out why this is happening to you and it might help me eliminate a couple of ideas if you could take a screenshot of your screen right before (or right after) you hit the “Add Hair” button and get the error and send it to me in a Private Message.
I don’t thought it was important, but the two objects were in the layer 3, while in the RenderLayer only layer 1 was active.
As soon as I moved both the object in layer 1 HairNet worked fine.
EDIT: and it works very well indeed, very useful and easy!
Awesome script Jandals!! I’m so o glad to see someone toying with alternative methods for styling particle hair guides. Do you have any plans to extend the script to convert curves to guide hairs? It’d be extremely useful for zbrush fiber mesh users who want to render their zbrush hair systems in Blender.
Paolo, I’m glad you were able to track-down that error. I would not have thought to consider checking which render layers were active.
theLuthier, I hadn’t planned on implementing the script to use curves instead of a mesh but if that’s how ZBrush brings hair into Blender, that would be really useful. I don’t have any ZBrush fiber mesh data available so I don’t know how it is converted. If it creates a set of curves with the same number of subdivision, it ought to be pretty easy to accommodate. If the number of subdivisions varies, HairNet would need to re-interpolate the curves and I haven’t discovered how to do that yet.
I’m interested in looking at the possibilities. If you’re familiar with bringing fiber mesh data into Blender, it could be very helpful to have you share any insights you have.
I hope you’ll pardon my stupid suggestion and eventually forget it, since actually I don’t know how things work under the skin.
Anyway, the particle editor has a function for re-keying of selected particles (hairs) to a different number of keys, so maybe you could find a way to make use of it to overcome the limitation of having the same number of point for each strand.
I usually move curves back and forth between Blender and Maya.
I was always thinking that it would be useful to convert from curves to hair.
Here is the curves from Zbrush below.
fiber.zip (173 KB)
Just import this as an OBJ, then Alt + C and select curve from mesh.
I am new to Blender and am designing a character with long, neatly combed hair parted on one side. After what amounted to days of frustration trying to achieve this with Blender’s “hairdressing tools” (which are by no means inferior - to those of Softimage at the very least), I achieved it simply and enjoyably using your excellent plugin, since it transforms the process into straightforward polygon modeling, and gives a great result. For designing any kind of hairstyle, I don’t anticipate using anything other than Hairnet in the future. No doubt, everyone has their own preferences in terms of workflow, and if the particle mode hairdressing tools work for you, then fine (and you can of course use them in combination with Hairnet). For me however, your plugin represents a far more exact and easy method of designing a hairstyle, and I believe it deserves much more recognition, and inclusion as one of Blender’s main hair workflow tools.
As you may have gathered from the above - I like Hairnet!
From my experience of using it, I would like to make a suggestion. Having modeled a low polygon count mesh for the hairstyle, I made a copy of it, then increased the number of edge loops perpendicular to the “root loops” in order to get more guide hairs when the hair was generated. In order to tweak it further, I went back to the low poly mesh, edited it then had to copy and divide the mesh again. It would be useful if there was an option under the hair creation button for choosing “x2, x4, x8, x16…”. That it to say “when you generate the hair, multiply the number of guide hairs by x2, x4, x8 etc, keeping the origin hair modeling mesh”. I don’t know how difficult that would be, but I think it would be very useful.
Alternatively, if there’s an easier way of getting more guide hairs, please let me know.
Keep up the great work!
Well, I finally had some time to test out this script and,… I still love it.
Here is an early test using both polygon objects and curves
thanks again for the great script, and take care
Paolo: No I can’t forget your suggestion because I think it’s a good one. Actually, it’s what I had hoped to do when I started writing The obstacle is that Python doesn’t have access to all of the tools that a user has. In this case, adding a single hair or modifying the number of keys are operations that seem to be unavailable to a script. What the script has to do to get around such limitations is to create a hair system with the right number of hairs and then move all the hairs into place. Which works alright but the limitation is that all the hairs are constrained to having the same number of keys. <sad face>
Mill: Thanks for posting that sample data. Added a second button to HairNet that takes that kind of data and turns it into a hair system. That fiber mesh data imports as a collections of objects, each of which is a series of edges made of exactly 9 vertices. The fact that each fiber has the same number of vertices is very convenient; it made it very easy to adapt HairNet to convert them into Blender’s hair guides. I don’t know whether all fiber mesh data is uniform like that or if it’s possible to have fibers with different numbers of keys/vertices. I hope not because HairNet can’t handle it…
Blenderocks: Thank you for your feedback. I agree with you about being able to subdivide a mesh on-the-fly. Early-on I realized that making the polygon meshes dense enough to look appealing created a lot of work unnecessarily. I think that it would be straightforward to create extra guides every half, third, quarter etc… interval between “real” guides but they would be constrained to a straight line, which I see as a deal-breaker. It must be possible to make extra guides that would follow a curve like that generated by a subsurf modifier but I haven’t explored that.
JDCookie: That’s awesome! It’s very exciting to see HairNet used so well. I think that’s a great result! And I had never thought to try using beveled curves to create the necessary geometry. Thank you very much for posting your test!
I have posted a new version of HairNet to the project tracker (version 0.4 dated June 12, 2013). The original function as you know it is unchanged but I have renamed its button to “Add Hair From Sheets.” That’s to distinguish it from the new button “Add Hair From Fibers” which is meant to accommodate curve-like hair styles rather than poly-based styles. I have only used it on the sample file that Mill posted but the way it has worked is to import the fiber file and join all the fiber objects together. Then make the same hair-then-head selection as in previous releases. It may be premature to release it since it is sure to have some weaknesses. But I was eager to share the update.
One vulnerability that I know about is that hair guides could be created in reverse order. If a hair system gave each hair a thick root and a thin tip, some hairs might appear with their thinnest point at the scalp. When using a polygon “sheet,” the script has that seam to decide where to start but I haven’t figured out a way to create a starting point like that for a fiber mesh.
Another issue that came up is that some hair guides do not create child particles. I don’t know why this happens and it’s only sort-of reproducible.
I appreciate all the feedback you all have given. It makes a big difference in how well I can continue working on making the script better. I hope it keeps doing the job!
I totally agree!
jdcooke2010 - Great results! Mind explaining the image a bit? Like the color coding on the hair-cap geo - is that for controling density like vertex groups or just reference when creating hair groups? That bit of brown around the edge - is that used for blending the hair line? Also, are you using simple or interpolated children?
The color coding is for visual reference.
Because hair may have different lengths and characteristics across the whole head, I’ll break down the “skullcap” into several sections to make the hair sculpting easier to manage. This example has nine particle systems arranged as, left-side top and bottom, right-side top and bottom, back top and bottom, crown, bangs and edges - the edges can help blend the hair-line as well as have unpredictable, fly-away or mashed down, crumpled hair ( I hadn’t completed the edge hair in the previous image).
When sculpting the hair I’ll begin at the base/back of the head, similar to how wigs are made, then work my way up to the crown - building one section/area at a time.
I mostly use interpolated child hairs because they can be controlled by vertex groups - also the skullcap is a medium density triangle mesh, to keep the children from wandering too far from the parents.
note: This script can be used to make multiple hair systems on the same mesh simply be renaming the system after it’s generated.
You’ll notice that when a second system is created, the hairs from the first system will alter slightly and become “anchored” to the mesh allowing for the proper use interpolated children - you’ll need to use this behavior to your advantage when sculpting the hair.
Thanks jdcooke2010, thats great info. the only thing I’m not familiar with is the curve modifiers on polygons, but will figure that out.
this is very nice
unbelievable, this script is exist
I added a third button to HairNet 0.4.5 for turning curves into hair systems. It doesn’t accommodate curves with a Bevel Object set.
Thanks a lot Jandals,this is an amazing tool!
Thank you very much Jandals for this amazing addon, now even more powerful!
Now it’s not the right time to me for an advanced use of it, and I still have to figure the best workflow between the several options we have, but I’m very interested and I’m watching with ‘envy’ the excellent results of jdcooke2010.
EDIT: Thanks to you too jdcooke2010 for sharing your workflow.
This is so sexy, i hope you can get it in the trunk.
Glad you’re still working on it.