shrinkwrap script help

possible to subdivide only faces that aren’t shrinkwrapped due to difference in polycount through script?
I keep getting parts that stretch out & was hoping there was a way around adding more vertices to areas that dont fully shrinkwrap.

Hi Albert,

I’m going to make some inferences, but I think you mean you have a target_mesh (high res) and a shrink_wrap_mesh with the shrinkwrap modifier, or you are manually snapping with python.

  1. Make a BVH of the high res mesh if you need real speed, otherwise use object.closest_point method

Here is how I would do it.

  1. Iterate over all faces in shrink_wrap_mesh and test the face center distance to the target_mesh (either using the BVH or the object.closest_point)

  2. Collect all the faces which have a distance greater than some error threshold.

  3. Use the bmesh.operator “subdivide_edges” to then subdivide the edges of that face as needed.
    https://www.blender.org/api/blender_python_api_2_76_release/bmesh.ops.html?highlight=bmesh.ops#bmesh.ops.subdivide_edges

Alternatively, you could test edge midpoints instead of face centers since the bmesh_operator is going to subdivide edges anyway.

Best,
Patrick