Make 'Select Random Strands' work for strand based hair

Issue #1058 duplicate
Ben Jackson created an issue

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)

  1. Alessandro Padovani

    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 #1050 so I’ll merge.

  2. Thomas Larsson 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.

  3. Thomas Larsson 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.

  4. Alessandro Padovani

    As for commit 73ad39f I get an error.

    steps:

    1. import curls-2.duf in #1050
    2. select “dforce soft curls“, enter edit mode and select strands by size

  5. Alessandro Padovani

    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.

  6. Thomas Larsson 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.

  7. Log in to comment