Shrinkwrap modifier

Hi there!

Im trying to get use and control better some techniques that I intend to apply to as much as possible realistic clothes to an object (body). I work with 2.49b and Im now learning to use the Shrinkwrap modifier…

In the default scene with the default cube Im duplicating it and make the second cube (grey) big enough to entirely contain the first one (red). Then I apply a Shrinkwrap modifier with the following settings

and the second cube wraps nicely the first one. Sooo this is OK! :slight_smile:

Then I subdivided both cubes, I distorted a little the front side of the first cube (red one) and applied the same modifier again. Here is what is the result:

Frankly, I expected the grey cube to wrap nicely the red one AGAIN as it has the same number of verts and topology as the red one. I.e. the grey cube has ALL the possibilities to wrap the red one w/o problems… But you can see that the middle-right vertex of the red cube is NOT covered! Rather than that, at the grey cube one can see a very tiny upper part of the front face to the right. Other sides are also shaped differentlly ( havent change anything else on the red cube except its front side after subdividing). For easy understanding of red-cube’s shape - the green cube to the right has the same shape and size.

Any suggestions how can I avoid such kind of problems, not to mention that my future shapes will definitely be more complex???


Maybe this is not much help, but have you tested the same process with 2.5x?

If I understand correctly, you moved some vertices of the red cube outside the volume of the shrinkwrapped cube. If this is the case the shrinkwrap is shrinking to the inside of the red cube. Always have the object being shrinkwrapped bigger than the target object so it shrinks to the outer surface.

Shrink wrap algorithm affect vertex to surface and not vertex to vertex. So if you have objects with same number of vertex some vertex is going to be going off to nearest surface as it sees it. So if you want to wrap things tight, the wrapper needs to have more vertices than object being wrapped to follow the sufrace.

@ Richard - Unfortunately, this is NOT the case… I intuitively figured out this may be the problem and I made the grey cube much, much bigger. Here it is in EDIT mode - subdivided w/o verts moved anywhere and wrapping well both other cubes, the whole scene even:

Here is my testing .blend file.

@ ptbbastos - Truly I havent tried this in 2.5 - I still work with 2.49b, mainly due to the full scripting capabilities of that version. In fact, my alternative idea to coping with the problem is to create a script that re-shapes an object covering another object and staying at a certain distance off it. :cool:

@ ridix - you seems to be right, but is it logical??? In such a case, one can never be sure if verts available at the wrapping object are sufficient to cover the target object during an animation. For example, there may be sections of your podcast where the sleeve wont cover the arm entirely to the wrist but - say - the half way from wrist to elbow only… and this should be a situation to avoid, right?

You only need to have your shrinkwrapped mesh just larger than your target. If it’s too large the vertices don’t project as accurately.
Wrap1.blend (41.8 KB)

Oh, great, Richard! This kind of solution looks much better!!! I was afraid NOT to leave my object un-covered so I scaled the wrapping cube really much, LOL :cool:

A setting that also helps in such situations is one I for some reason don’t see in your screenshot of the Shrinkwrap modifier panel – a button labeled “Above surface” that sits just below the SS levels field in my version of 2.49b. Enabling this option insures that all the shrinkwrapped vertices will sit above the target surface (above as defined by the target mesh normals) – extremely useful for clothing setups. In many frames of the Kata teaser you can see how I used it to keep the character mesh from “busting out” of her separate costume top mesh, especially the breasts, during a lot of vigorous motion with major deformation.

Hi there, chipmasque

Perhaps I have copied the panel from 2.46… You’re right that in 2.49 there is a “Above surface” button that helps a little. See, I tried to wrap the monkey (Suzanne) with the same settings and a lot more subdivided cube as a wrapper. I am not very happy with the result:

I thought it is supposed to wrap it by retaining the form w/o showing the cave at mouth and (may be) ears. My idea of a script placing a wrapping mesh equidistantly off the inner object would also not be working in the situation with Suzanne cause it would follow the mouth cave @ 0.1 units, for example (rather then wrap it vertically).

Your Kata is almost perfect! :yes:

If you want a mesh to wrap with significant surface contour matching, the mesh you wrap with has to be significantly denser than the target mesh, so there are many more verts mapping to the surface, reducing the error in the resulting form. This is especially true when wrapping forms like Suzanne that have a complex surface topology with many concavities and undercuts.

Also, only judge the results with some subsurf in effect. Think of the wrapping mesh as actual wrapping paper being vacu-formed onto the target – you’re bound to have some areas where the paper just can’t fill in all the little nooks and crannies unless it’s really flexible on a small scale and the “vacuum” is turned up way high. Adding subsurf levels to both the target and wrapping mesh and spec’ing an appropriate SS level in the modifier is sort of like doing this, and can really make a huge diff in the wrap success.

And thanks for your comment on Kata, but whaddya mean almost perfect? :wink: :smiley:

@ chipmasque - you’re right that applying Subsurf modifier to the wrapper makes things much better. Here’s that I have when I applied Subsurf Level 1 to my previous package:

I applied Smooth to it as well :wink:

You see though, it is ALL wrapped but it is far from equidistance to inner object. You cant really figure out there are ears inside. Simply at ends of ears plus end of skull area, for example, the distance to the “package” is much higher than 0.10… Is there a way to avoid this effect? Im think of something like marking some edges of the inner object (or edgeloops) that are to “attract” the wrapper, i.e. making it follow more closely the required distance of 0.10 resulting in what you are also describing - the “vacuum-wrapper” effect… Are there such settings or a combination of those?

P.S.: I’ll send you personal message on commenting Kata a bit later today.

It’s really hard to say without seeing it what aspects of your wrapping mesh need to be changed to get the more complete final form you’re looking for, but probably the most important is the mesh density – the more vertices, the better the wrap (in general).

The topology of the wrapping mesh compared to the target is also critical – remember that the Shrinkwrap modifier uses math to calculate which surface point to send a vertex to – it has no idea what either mesh actually looks like or what the modeler’s intent is. Probably it uses the “anti-normal” vector for each vertex as a straight-line path for finding the surface.

But this makes “negative” surface curvatures (like undercuts & concavities) harder to solve for because this kind of path to vertices in those areas may be obstructed by other parts of the surface – the path is “blocked” unless you pre-shape the wrapping mesh to allow for the problem, or unless there are so many verts in the wrapping mesh that there are always some that can find the proper path to the surface.

But even with high-density meshes, there are some target mesh situations where you have to go in and re-shape the wrapping mesh to better fit the target when wrapping. I found this to be the case when working with some very convoluted mesh topologies (can’t post images because of NDA, unfortunately), and my solution was to start with a low- to moderate-density cage for the wrapping mesh, and using both Mesh editing tools and Sculpt tools to tweak the wrapper mesh into an optimum pre-shape. Then I added Multi-res levels and tweaked some more, until I got an optimized wrap. It’s not an automatic process by any means, but then, the Shrinkwrap modifier wasn’t really designed to do a perfect automatic “copy” of the surface – it couldn’t be, since it has to deal with any number of possible surface topologies.

PS: I more than anyone am fully aware of the imperfections on display in the Kata imagery – been living with them for years now, they’re old friends. My pretend indignation – well, in the words of ol’ Foghorn Leghorn, “It’s a joke… Ah say it’s a joke, son!” :smiley: Web forums aren’t the best places to try for expressive subtlety :frowning: :wink:

@ chipmasque - Yeah, using verts normals would be the easiest solution but perhaps for meshes having no-so-that sharp spatial angles. The monkey is NOT the perfect object for this. It is - may be - the one of most problematic objects cause (1) its mesh consists of many parts, (2) these parts are not aligned, etc… Nevertheless, I tried on it a script that makes a new covering object with the same topology and verts displaced at a distance along verts normals. I used dist = 0.10 which does not give me distance of 0.10 between corresponding faces of the two objects but it covers the “old” monkey. Well, ALMOST - cause (like I said) the monkey is a very weird object. :wink:

Here’s the result:

That’s kind of inflated monkey… The result is as bad as the original - in parts, etc… Therefore, I should limit use of that approach to fully closed 3D figures or (alternatively) should find a way to produce a one-piece of a closed mesh for the wrapper, which I think will be real hard… :eek:

Anyway, here is a short video of the “inflated” monkey. One can easily see the defects of the mesh around the eyes at the transparent monkey. There are holes at top of ear-attachment seam (not seen in the pic and video).

What I like of such a wrapper is to cover the mouth (i.e. eliminate the cavity there), cover eyes and eyebrows with relatively simple surface as they are convex areas, then cover the rest of the head following closely the shape at a distance = 0.10 (more or less) and covering the ears as of they are separately packed (i.e. wrapping each of them again at a distance 0.10 till the place of attachment to the head). To me, supposing the object to wrap is a good one (with one-part mesh and closed or with easy to solve holes), this looks like defining some edges (verts) to “attract” the wrapper at the concave areas, if the designer chooses so. Following such a description, a nicely wrapped ear would look like this (so far done manually):

I dont know if I will be able to implement ALL this in a script. If so - I will post it in the Python section of this forum.

BTW, have you got my message on Kata or it went lost somewhere in the I-net?


Yep, that’s what I mean by tweaking the wrapper mesh topology to get the optimum shrinkwrap result. I think that trying to get a script to do it would be more trouble than it’s worth since it has to deal with many possible target topologies in order to be generally applicable, so the manual tweaking, while tedious at times, seems also the most efficient approach.

No PMs from you that I know of, btw, can’t say why not.