Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

enter image description here

share|improve this question
    
Could you please insert a picture or drawing of the effect you want to achieve ? It would be easier to understand your problem. –  wil Jan 2 '13 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. –  Sam Hocevar Jan 2 '13 at 8:08
    
what is wrong with moving the whole shape? –  Ali.S Jan 2 '13 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 '13 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 '13 at 16:34

1 Answer 1

You have a depth map, which I assume is simply the distance between the convex mesh A and the neutral deformed mesh B, and you have surface normals of mesh A.

What you're missing is weights (or groupings) of how each vert on mesh B affects its neighbors. For example, when the central vert gets moved it should also drag along its neighbor verts by some amount (percentage) if they are in the same group.

If you have a group of verts affect each other 100% they will all end up pushed out by the farthest amount from your depth map as if they were all part of an unbendable steel structure that moves as a unit, set at 50% this structure may act more like thick rubber sheets and 10% like form fitting plastic wrap because each vert barely affects its neighbor (which is what you have now.

Obviously there's some blending and merging of values going on. Like @Gajoo said, "what is wrong with moving the whole shape?"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.