Garment creation with 0-thickness meshes and Mesh Deform

On:

|

,

|

This is a method I use for creating garments, such as shoes or jackets, out of 0-thickness meshes for easier handling within Blender, which helps reduce mesh complexity, while retaining a nice, detailed look. The greatest benefit of this method is that the weight painting process is extremely simple, compared to weight painting a complex garment. This is quite similar to this method demonstrated here by Pierrick Picaut, who you should absolutely check out!

The gist is that we are creating a complex mesh, and then deforming it with a simple mesh. This can be achieved by the Surface Deform and Mesh Deform modifiers. Surface Deform is best for when your mesh has to follow a relatively simple surface, like a strip of faces to deform a chain, while Mesh Deform works better for more complex meshes, like hair, clothing, etc.

One important disclaimer is that while this method is fantastic for Blender, it will not work out of the box for Unity or other game engines. I will include information on how to adapt this to game engines at the end of the post, though. Consider the mesh created within Blender to be the “master” file, and then versions adapted for game engines later to be variants of it.

This is a very lengthy post where I go through the entire process, so bear with me.

You will also find a download button at the bottom for this outfit, which is the same as the one in this post.

Mesh creation

The first thing we need is to create a mesh for our garment. For this tutorial, I will be showing off how I built DD’s shoes out of different disconnected parts, and then rigged them with a deform cage.

Shoe mesh: Soles

First, create a plane for the sole, then enter Edit Mode and align it to the bottom of your character’s left foot. DD’s model is in a more spread out A pose, so that makes things a little harder, but still doable. If your character’s rest pose has their feet 100% flat with the ground, that makes this process easier!

Hot tip: Change your transform orientation from Global to Normal, and use Face mode within Edit mode to more easily align the plane.

Once you have that plane aligned with the character’s foot, use the annotate tool to get an outline. Make sure you set it to Surface so that your annotation strokes stick to the plane’s surface.

Now we can begin messing around with the plane. Create Loop Cuts and Inset Faces, then align the vertices to the outline you created with the Annotate tool. For this, I greatly recommend that you use the arrows on the Transform gizmo while still set to Normal orientation, so that you don’t accidentally misalign the plane on the Z axis. For this entire process, I hugely recommend using the free LoopTools addon, since it will let you smooth out loops much more easily without ruining your geometry. Just remember that when using LoopTools, you need to be selecting edges that do not intersect, otherwise you get poor results. If you want to align all the vertical edges, make sure you don’t also select the horizontal edges as well.

For shoes, I like to use Inset Faces to create that outer loop of faces, and then I add some loop cuts to give myself enough geometry to smooth things out nicely. On the picture to the right, the purple edges are Creased, which will be relevant later.

Shoe mesh: Body

Now that we have the soles, let’s also work on the shoe’s body. For this, create a cube and also align it with the foot in Edit mode. It’s okay if it’s not perfect, because we’re not going to connect the body to the soles, and they will remain separate objects. Once it’s aligned, you can begin making loop cuts to get you to the general shoe shape you want.

You’ll want to delete the faces that go around the ankles so that you get a hole for the foot to go into, and also the bottom of the cube you created, since we want a 0-thickness mesh, not a proper enclosed mesh.

Now, for these shoes, we also need to separate the shoe’s tongue from the body, as well as add some holes for the shoelaces to go into. We can do that by using the Rip command by selecting the edges and pressing V to take out the tongue.

With the tongue separated, we can push it inwards a little bit, and then also extrude some additional vertices from the shoe’s body to give us space to add those holes for the shoelaces.

Next, we need to add some more loop cuts around the area where the tongue was so that we can properly inset some holes.

Next, press I to inset into those quads, and then delete the inner face. This will get you 8 shoelace holes.

And now, just continue adding cuts where necessary around the shoe’s body, insetting faces where appropriate to give you a nice curvature, until you get something like this.

Again, purple means Crease, which I will explain next.

Solidify modifier

The Solidify modifier is the main basis of this method. With it, we can take these meshes we created and give them thickness. The coolest part is that you can also use Vertex Groups to control where that thickness happens, which is extremely useful.

Let’s look at the shoe body first. On the modifiers panel on the right side of the screen, add a Solidify modifier. Make sure it is set before any Subdivision modifiers. Whether Solidify goes before or after Subdivision is situational, but for this specific application, it works best before.

Without Solidify
With Solidify

You control how thick the mesh is supposed to be with the Thickness slider, and whether the solidifying effect should occur inwards, outwards, or with the mesh at the center with the Offset slider. 1=Fully outwards, -1=Fully inwards, and 0=both in and out, with the mesh at the center.

Creases

Now to explain those Creases. A Crease is a property of an edge that allow you to control how it will behave with the Subdivision Surface modifier. The reason we placed the Solidify modifier before Subdivision is so that we can control the edges of our and give it a sharp-ish edge reminiscent of a thick piece of cloth.

Shoe with 2 levels of subdivision and Solidify, but with no creases
Shoe with 2 levels of subdivision and Solidify, with creases

Creasing allows you to control just how sharp any given edge should be when Subdivision is in play. When you don’t crease those edges, Blender’s subdivision modifier will then smooth the edges more than you wanted, and you’ll lose that nice thick edge. The reason we place Solidify first is that it will extrude one set of faces, and then on the boundaries between the inner and outer part, the creases will remain in place, holding down those edges and preventing excessive smoothing when we subdivide.

Solidify modifier: Using vertex groups

Next, let’s do the soles, where we’ll see how we can use vertex groups to get variable thickness with the Solidify modifier.

If we take our sole and give it a Solidify modifier, we get the same thickness all around.

While this might work for some shoes, it’s not really what we want for this one. Let’s create a vertex group to control the thickness. To do so, enter Weight Paint mode with the sole selected.

Under the Data tab, find the Vertex Groups menu, and click the + icon to add one. Name it SoleThickness. Now, you need to paint it so that a value of 1 (red) corresponds to the part that should be thickest, and then lower values should correspond to the part that should be thinner. Here, I used a Weight value of 0.5, so that wherever it is fully green, it will be half as thick as the thickest part.

Now let’s go back to the Solidify modifier and plug that Vertex Group in.

Ta-da! Now the front is half as thick as the back of the sole, giving it a more even look.

Curve-to-mesh shoelaces

Now the very last part of the mesh creation process will be adding some shoelaces. This is completely optional, but if you want really accurate shoelaces, you can in fact create curves and tie them exactly like you would tie real world shoelaces, and then convert it all to a mesh.

To get started, we’ll need a Curve object. You can find that under the Add menu. Once you add it, enter Edit mode and align the curve to the bottom-most holes on the shoe. If when scaling the curve up and down you get the handles scaling up and down instead, check whether you’re using the Individual Origins transform pivot point (next to the transform orientation menu on the top center of the screen) and switch it to Median Point.

Once it’s aligned, let’s also give it a little bit of thickness so it’s easier to see how the final product will look. This can be done under the Curve data menu on the right, under the Bevel sub-menu of the Geometry menu.

Now, you can start extruding the control points on the laces with E and trying to tie them exactly how you would in real life. You can rotate, scale, and move all the control points, as well as move the Bézier handles in and out to control the shape of the curve.

Make sure you keep track of which side should go under which, and which should be on top. For example, here we have the laces that come from the left always lay on top of the ones that come from the right.

Once you get to the point where you want to tie the shoe laces at the top, make sure you get a real life shoe and really study where each loop goes. It probably took me 30 minutes of staring at a shoe and “tying” the 3D lace until I got a result I liked.

Once you’re happy with the shoelaces, you can select the curve object in Object Mode, and then use the Convert operator.

Then you can enter the mesh in Edit mode and edit the caps of the shoelaces to shrink them a little so they look like little plastic caps at the end.

Socks

The socks are extremely simple to do. You just do the exact same thing you did for the shoe body, but you keep the bottom of the cube. There is honestly very little to it. One tip that does make things easier is for you to use the Face Nearest snapping mode, so that whenever you move a vertex, it’ll try to snap to the closest face, which should be the character’s body. Just snap vertices to the body, then smooth them out, add more geometry where necessary, etc. Make sure you also crease the topmost edge and also add the Solidify and Subdivision Surface modifiers to it.

Mirroring the mesh

We haven’t applied a mirror modifier yet, so we really should. Select all four meshes and apply all transforms so that their origin point returns to the world origin, which should also match the origin of your armature. Then, add mirror modifiers to all four, move it to the top of the stack, and then apply.

Deform cage

And now that we have a complex mesh, we can make it move using a simple mesh. That means creating a deform cage, which is a simplified version of the mesh we just created. This is the basis of the Mesh Deform modifier.

To create a deform cage, just make a cube, align it with the object it’ll deform, and then subdivide it a bunch of times, and then make its contour match the target object. It should completely encase the object, but also still have a bit of space between the object and the cage. I like to set the object display mode to Wire under the Object Properties panel for this. For certain objects with more complex forms, you may also want to extrude some faces to better encompass the shape. Here, for example, I needed to extrude some faces upwards to also encompass the socks.

It is very important that this mesh is watertight, i.e. no holes. Otherwise the Mesh Deform modifier won’t work.

Parenting

Now, parent the deform cage to the armature of your character with the Armature Deform modifier, and the shoe meshes parented to the armature Object. As explained earlier, only the deform cage should have weight painting, while all deformations for the shoe meshes will be taken from the deformation of the cage.

Binding the Mesh Deform modifier

And now we need to also bind the Mesh Deform modifier to the cage. On each of the shoe meshes, add the Mesh Deform modifier to the top of the stack, and then select the deform cage as the target. Then click Bind. The default setting are usually good enough, but you may want to increase the Precision if the deformation looks weird later.

Weight painting the deform cage

Now that all that is set up, we can start weight painting the deform cage. To get us a head start, Data Transfer is an easy way to get weights from one mesh to another. Let’s transfer the weights from the body mesh to the deform cage. First, select the deform cage, and then the character mesh. Then, go to the Object menu and find the Link/Transfer Data menu, and select Transfer Mesh Data. For this, make sure you select All Groups and use Nearest Face Interpolated. Here’s a video by Kaide that also explains the method.

Now you can enter Weight Paint mode with the deform cage selected, and start cleaning up the weight painting. For shoes like these, I’d recommend taking off the toe weights so that they don’t interfere with the shoe’s movement, and instead add a new deform bone that follows the up/down movement of the toes, but ignores their sideways movement so that you can tuck them inside the shoes.

In this example, I added a DEF.ShoeFront bone that copies the movement of the toe master bone (i.e. the bone that controls the toes’s up/down movement) so that whenever I bend the toes upwards or downwards, the shoe follows appropriately. There are lots of ways to solve this, and you can even make it so that toe movement inside the shoes affects the shoes themselves, but for this method, I did not add that functionality.

Troubleshooting mesh deforms

Various things can go wrong with the Mesh Deform modifier, so it’s important to know how to solve them.

If when you move the character around in Pose mode and parts of the shoe mesh get left behind, that is because the deform cage either does not completely encase the target mesh, or because there is not enough space between the target mesh and the deform cage.

If the target mesh seems to move without sufficient detail, such as large portions getting way too stretched out, it can also be the case that your deform cage does not have sufficient geometry to deform it properly. Go back to the deform cage and add a couple more loop cuts, and then smooth the geometry out again.

If when you turn the entire character upside down, parts of the mesh are left behind, that may be a binding precision issue, or again, insufficient space between the mesh and the deform cage. Precision values above 7 tend to take a long time to bind, so just be aware.

Texturing

The last thing you’ll need to do is texture those shoes. Now, I won’t go into too much length about that because it’s quite the extensive topic, but there are two free extensions that I greatly recommend: Ucupaint and Mio3. Ucupaint uses a layer-based method for texturing that is essentially the same as you’d get in Substance Painter, but without having to interact with Adobe’s rancid ass. Mio3 is extremely helpful in organizing your UVs and straightening them out, which can be incredibly helpful for certain effects, such as when you are using textures made of streaks to have an effect run down the length of a mesh.

Here is a video that showcases Ucupaint. And here is a link to the documentation.

UV unwrapping

For these shoes, you’ll want to UV unwrap them first by placing seams along the portions that need to separate out into flat surfaces. Because our shoe is composed of multiple separate objects, we need to select all of those objects first, and then enter Edit mode so that we’re editing all of them simultaneously.

To add a seam, enter Edit mode, then select Edge mode, and with a set of edges selected, right click and click Mark Seam. Once you have all your seams placed, you’ll want to unwrap your mesh.

Astute readers will notice that the shoes are not the only thing on the texture above.

If your character has multiple clothing objects, you’ll probably want to make them all occupy the same UV space so that you only need one texture for all of the clothes, rather than several textures, which can make render times slower, and are also less optimized for game implementation. To make them occupy the same UV space, all you have to do is select all the objects and enter edit mode to unwrap them all at the same time.

In the case of DD, the shoe body, soles, shoelaces, socks, jockstrap, and gloves all occupy the same UV space.

You’ll also want to use the Pack Islands operator to get them as tight as possible, though with some padding still. I like to first pack the islands, and then move them around so that they’re more organized. I prefer sacrificing some texture space for the sake of having my UV islands easily recognizable and organized in groups that make sense to me, but you can also just keep them packed as tightly as possible, which will lead to greater detail clarity on high resolution textures.

Once your UVs are nice and unwrapped, you can use Mio3 to also straighten out some of the islands with the Gridify operator. For DD’s clothes, I used Gridify on the shoelaces and the jockstrap bands.

Make sure that your UVs are the way you want them to be before you move to texturing with Ucupaint, since moving the UVs in texture space will make the textures on the mesh itself also move, which will require you to repaint things. It’s no cardinal sin to move the UVs once you’ve started painting, since it’s all an iterative process, but just know that if you do, you also change how the texture is mapped onto the mesh.

Texturing with Ucupaint

Then, you’ll have to texture everything using Ucupaint. As I said, I won’t go into great detail on how you should texture your shoes, since they most likely look different from mine, but some important things to keep in mind are:

  • You are using layers, rather than painting color directly onto the layer. You first define what color the entire layer is supposed to be, and then with a black and white mask, you’ll define where that color should apply. This is extremely important to stick to, because if you want to change the color, roughness, metallic, or normal properties of that layer later, you are able to do so very easily with a masking and layer based method, while it will be extremely difficult to change it if you simply painted all the colors directly onto the layer.
  • When defining roughness and metallic values, you can choose between layer color and custom color. I almost always choose custom color, since then I can define how shiny any given area should be separate from the layer’s color. Remember, 1=white, 0=black. Dark values make Roughness become shiny, and metallic to become less reflective, while light values make roughness become less shiny and metallic become more reflective. See the Principled BSDF page for an explanation of these different shading effects.
  • You can paint normals onto your texture to add small bumps and indents. This is a great way to add visual interest to the mesh without adding extra geometry.
  • Any layer in Ucupaint can have any combination of color, roughness, metallic, and normal. That means if you want a detail that is black, very shiny, and should be raised up, you would enable the Color, Roughness, and Normal options for that layer. Then wherever you paint the mask for that layer, a black, shiny, raised up detail will appear.
  • Any layer can use any of the different blending modes, just like in Photoshop, Clip Studio, or Paint Tool SAI. That means that details on layers above another don’t have to necessarily erase the details of the layers below, but rather they can be set to Multiply, or Add, to get you different effects.

Once you’re happy with your texturing, you can bake everything to images and get rid of the Ucupaint node. Just be mindful that it may be handy for you to also save a version of your file that has the Ucupaint node still, as well as save the various masks you created during the texturing process, since you can then create different color variants of the garment you just created.

If you do everything right, you get some really nice shoes!

Game implementation considerations

For games, there are several things that need to be changed here. Before doing any of this, make sure you save your file and create a separate game-oriented .blend, so you don’t lose any of the things you’ve created.

  • First, is that you won’t have access to any Subdivision modifiers in games, so you can cross that out.
  • You will need to apply the Solidify modifiers to turn that generated geometry into real geometry, as Solidify is not a thing that exists in game engines.
  • You will need to join all of the different parts of the shoes into just one single object, as most game engines work better if there are fewer objects in the scene, even if the total polycount doesn’t change.
  • You will need to transfer all the weight painting data from the deform cage onto the shoes. You can use the same Data Transfer method you used to get the body’s weight painting onto the deform cage, but this time from the deform cage to the shoes. Make sure you check if the weights look good, as you may have to do a little cleanup.
  • You will need to delete geometry inside the shoes. While there may be cases where the inner geometry of the shoes matters, for most implementations, you’ll never see it. Doing this will greatly reduce the polycount of the shoes, which will then make them more performant within whatever game engine you’re putting them in.
  • You will need to reparent the shoe to the Armature with the Armature modifier and remove the Mesh Deform modifier, since now the weight painting is directly applied to the shoes, rather than using the deform cage.
  • You may need to reduce texture size. I usually save my textures in 4k resolution, but for games, you really don’t want to be blowing up texture memory up. In VRChat especially, people will not appreciate a super heavy model with really high res textures around them.
  • If your character will never take off their shoes, you can also delete the foot geometry and save even more space.

If anything here is unclear, feel free to leave a comment, or contact me directly on Bluesky or by email!

Download

Posted by

in

,

Leave a Reply

Your email address will not be published. Required fields are marked *