What would be a good filter to create 'magnetic deformers' from a depth map?

In my project, I am creating a system for deforming a highly detailed mesh (clothing) so that it 'fits' a convex mesh. To do this I use depth maps of the item and the 'hull' to determine at what point in world space the deviation occurs and the extent.

Simply transforming all occluded vertices to the depths as defined by the 'hull' is fairly effective, and has good performance, but it suffers the problem of not preserving the features of the mesh and requires extensive culling to avoid false-positives.

I would like instead to generate from the depth deviation map a set of simple 'deformers' which will 'push'* all vertices of the deformed mesh outwards (in world space). This way, all features of the mesh are preserved and there is no need to have complex heuristics to cull inappropriate vertices.

I am not sure how to go about generating this deformer set however. I am imagining something like an algorithm that attempts to match a spherical surface to each patch of contiguous deviations within a certain range, but do not know where to start doing this.

Can anyone suggest a suitable filter or algorithm for generating deformers? Or to put it another way 'compressing' a depth map?

(*Push because its fitting to a convex 'bulgy' humanoid so transforms are likely to be 'spherical' from the POV of the surface.)

Edit: Here is an image/diagram rightly suggested that illustrates what I am trying to achieve.

Also, I should say since this question was posted I worked a lot more on this problem, and though I never solved how to the get the deformers I did eventually decide that depth maps for this were unsuitable as:

1. If the deformed mesh is not complete, it is possible to get texels in the map that are meant to be on the other side of the convex mesh (because they are not obscured by those closer to the camera on the correct side).
2. The efficiency was not as high as I had hoped due to the fact 6 maps were needed per deformation.

Not that these were unsolvable, but the other solution, which involved collision testing in kernels running on the GPU, resulted in higher quality results and was much simpler, even though it may not be as fast.

I still think this questions problem is interesting though and would be interested in any answers as I am sure there are situations where it would be preferred.

• Could you please insert a picture or drawing of the effect you want to achieve ? It would be easier to understand your problem.
– wip
Jan 2, 2013 at 4:29
• Seconding a comment made below, a picture or drawing may help a lot. There are many ways to simulate how clothing wraps body parts and maybe your “deformers” idea is only one of the several that could apply. Jan 2, 2013 at 8:08
• what is wrong with moving the whole shape? Jan 2, 2013 at 16:22
• Gajoo, Imagine if the shape wrapped around the mesh, moving it in one direction would cause it to only further intersect the shape on the other side - though indeed that is what the deformers are doing, just little bits of the shape at a time.
– sebf
Jan 2, 2013 at 16:33
• SamHocevar, this question was about fitting only - you have a mesh thats slightly smaller than the character it is meant to fit, so the mesh is adjusted accordingly. The depth field implementation was chosen for performance reasons, the deformers were chosen because of that approaches ability for feature preservation.
– sebf
Jan 2, 2013 at 16:34