Make 'Select Random Strands' work for strand based hair
Strand based hair consists of lines of connected edges with no faces. After importing to blender the hair will normally consist of several million verts. After converting to particle hair the hair is very thick and performance heavy. Unfortunately the tools for thinning hair prior to conversion only work on geometry with faces. This makes sense for ‘select strands by size’ and ‘select strands by width’ but not for ‘Select random strands’.
The relevant code is in proxy,py. I’ve amended my local copy to work with strand based hair and my changes seem to work well. I’m happy to submit a PR if this would be helpful?
Comments (9)
-
-
repo owner Implemented in last commit. However, when you delete random strands, the material assignment is lost, so you end up with a particle hair with a single material. There is a way around that, though. First make hair with polyline output. We then get separate polyline meshes with different materials. Then we can select and delete random strands for all meshes; the select random strands tool now work on all selected meshes. Finally we make hair for each polyline mesh, one at a time. That worked out quite well for the curls2 hair.
-
repo owner Alessandro, it would be different to implement a “select strands by material” tool, since the material assignment is not stored edgewise (mesh edges cannot have custom properties) but polylinewise. So one must analyze the entire hair to find the material assignment. But as I suggested above, Make Hair with polyline output splits the hair by materials, and then you can apply reduction to each polyline mesh.
-
-
repo owner Fixed in last commit. I only tested with random strands before.
-
Commit 54ff8b9 works fine.
I see there’s a lot of unconnected vertices when we import the curls-2 hair. That doesn’t seem to harm anything but we may delete those on import for cleanup. Also “make polyline hair” will delete the extra vertices anyway so this could be enough.
Unless there’s some reason to keep the extra vertices on import. Let me know so I’ll mark as resolved.
note. Please note that of course this is only for dforce/sbh hairs. Since transmapped hairs may have morphs so we can’t touch the imported geometry.
-
repo owner The unconnected verts belong to the hair guides. Previously I assumed that the first vertices were used by the guides and after some vertex number all verts were used by the actual hairs. Then the hair guide verts were deleted and the remaining verts were renumbered. However, that assumption wasn’t true for the curls-2 hair, which led to incorrect material assignment. To avoid that all vertices are now retained.
I’m not sure that loose vertices can be removed before making particle hair. Maybe, but maybe there will be problems with materials. After particle hair has been made the entire polyline mesh is removed, so the issue is gone.
-
- changed status to resolved
Thank you for the explanation.
-
- changed status to duplicate
Duplicate of
#1050. - Log in to comment
Also “select strands by size” and may be add “select strands by material” that’s not possible with the blender tools since materials can’t be assigned to polylines.
This is also requested in
#1050so I’ll merge.