3D Cloth Textures in Blender - Part 1

This video, the first in the 3D Cloth Textures in Blender series, starts with Marvelous Designer. The script of the video is below.

Video Script

Recently I was employed to create virtual fabric from images of real fabrics used in manufacturing. It is critical in this type of work that the rendered garments match what the customer will receive. The fabric is a huge part of this, perhaps as important as the garments themselves.

I'll teach you how to work with photos of fabric to create tiles needed for use in 3D in this series. We will also create our own fabric from scratch. Blender will be the program we use to bring everything together and make our final renders. I'll teach you how to get Blender set up so you can work quickly and efficiently. You'll also learn about the node system in Cycles and how to use it to your advantage.

This video, the first in the series, starts with Marvelous Designer. MD is very important and necessary to the creation of your garments. However, it isn't the major focus in these tutorials. We're not going to be creating any garments, we'll be working with existing ones and making any modifications necessary for better renders.

Please remember that I am completely self-taught and I don't always use the correct terms or industry standards. I explain things in a way that I can understand them, in hopes that this benefits other inexperienced users.

Each of you will have different goals with your texture work. In some cases, you may be working on only a handful of game assets. In this case, perhaps you can take the time to hand paint a texture map for each piece of clothing.

In my case, I have been recreating hundreds of garments for a clothing manufacturer. There is no way I could possibly hand paint a texture map for each. It is very important that my workflow allows me to process each garment as quickly as possible, yet retain a high degree of detailed accuracy.

The best way to accomplish this is to create a library of textures that can be used over and over again. Many fabrics are similar to others with just minor changes. If you have a library, you can start with an existing material and make only small changes to make it usable.

I will teach you how to create and use this library as part of a complete workflow that I've developed for my own use. We will start in MD and work our way through to the final renders with Cycles in Blender.

In order to work with textures, you have to understand what UV mapping is. I'm not going to get into unwrapping UVs on various objects, we will be focused on MD patterns only, which is much easier to understand and explain.

A UV map is a flat representation of a 3D object for the purpose of applying color and texture. We can use the MD program as a reference. The 3D window shows your garment as a 3D object. It has dimension in every axis, side-to-side, top to bottom and front to back.

In the 2D window the pattern is flat. It has no depth whatsoever. MD is really unique in this way because we create the flat pattern and then we make it 3D with sewing.

In most other 3d graphics programs, you create your 3D object first and then you unwrap the UV's to make a flat representation. Since MD works opposite of this, we already have perfectly shaped UV maps to use in another 3D graphics program, like Blender.

When you export your garments, MD includes a UV map for you. You do not have to unwrap UV's on MD clothing. This is a huge time saver and also increases the realism, as I'll show you later.

There is only one problem with MD's UV maps and that is scale. Here is a leotard that I created in MD. I have converted it to quads and exported it as an OBJ. Here is a top that was created by cutting off the bottom of the leotard. Again, I have converted it and exported. Note that these are two different MD projects and they have been exported separately. Here are both of the garments in Blender. I imported them in separately and I have applied a simple gingham texture to illustrate my point.

See how the squares of the full leotard are larger than the top? This is a scaling issue. MD creates a perfect square UV map and inserts the patterns. Here is a screen shot of the top and the leotard side by side.

MD tries to use as much of the UV map as possible, so the patterns are scaled to fill the space. The top pattern is much larger by itself than the top part of the leotard. That is what caused the sizing difference of the gingham in Blender.

If you don't do something about this, you will have to adjust the size of your pattern UV maps in Blender to make your texture library work the same way across various garments. Not only is this very time consuming, it is also imprecise. You have no way to know what size your patterns will be and how much scaling is needed.

I figured out a solution to this problem. Create a rectangle of fabric that is as tall as your avatar and as wide. Use an arrangement point to make it into a tube and set it over to the side. Freeze the tube.

Here is how it looks in MD. Leave the particle distance very high on the tube, you will never sew anything to it. Since it is frozen, it won't eat up your computer resources when you are working in MD.
Save just the tube as a garment and import it into every scene. Here is the tube added to the top project.
Here are screen shots of the new UV maps with the tube. You can see that the scaling is the same now.

The tube makes the UV map quite large and any patterns in the map will stay a consistent scale.
Here is the top and leotard that were imported. I left the tubes here so you can see them. They are easily deleted, once the garments are in place.

Now you can see that our gingham squares are the same size. It wouldn't matter if we were making a small detachable collar or a full-length coat, our UV maps will be scaled alike. Once we get our textures dialed into this scale, we can change materials easily with little or no adjustment necessary to the UV maps.

I am sure there are CG artists out there that are cringing at what I've just done. This is not how most of you work. I know it is a strange way to do this, but it does work very well for MD garments.
Now that we have the scaling issue out the way, let's take a look at some other things you'll want to consider before exporting your garments.

In MD you can simulate stitching with internal lines and fold angle. This is fine if you are going to render your final images in MD, but it doesn't help at all when exporting.

We are going to export our garments without thickness and use Blender to add our depth. We are also going to apply a subdivision surface modifier to smooth our garments in Blender, so some of the subtle details in MD will be lost.

If we want stitching, we need to add it with a material in Blender. If you were hand drawing the UV map, you would draw in some stitches where you wanted them. We're not doing that here. We are going to add our stitches separately and consistently.

Here is the leotard again. This is a really great garment to use for testing materials, so we will continue to work with it.

I have added very small bands everywhere I want to add stitches. There is a band for the neck, around the wrists and the ankles.

Notice that the bands are created separately and they are perfectly horizontal. This is very important. Do not create stitching bands that curve because you can't apply the tiled stitch material to them.
This has been finalized and I've lowered the particle distance to 10 and simulated. Now is a good time to save the project.

We need to export this garment out. To do that, we need to turn the mesh from triangles into quads. MD triangles are not the best choice for Blender. We have many more options, if we convert to quads.
Let's switch over the material view to mesh, so you can see the conversion. Now I select the garment in the 2D window, right click in the 3D window and choose quadrangulate. Notice that I did not select the tube. There is no reason to convert it.

After you convert to quads, the patterns can come apart at the seams. You have to simulate to pull everything back together. But I need to caution you about this. Quads do not simulate nicely in MD, even with a low particle distance. Do not let the simulation run very long with the mesh in quads.
This is the biggest reason why I always save the file before I convert. If it makes a mess of things, I can always open up my original work and do it again.

To export to Blender, select File > Export > OBJ. Type in a name for the export and hit the Save button. Now you have a full list of options. I don't use the avatar, so I uncheck Select All Avatars. I want the patterns to be Multiple Objects with the Thin option. Make sure Unified UV Coordinates is checked. MD to Blender is a Scale of Feet. Leave everything else unchecked and click OK.

Here is the final render of the leotard with the stitching and knit material applied. In this render, the stitching looks like it was done to the fabric edge. The stitching patterns have been adjusted to extend beyond the body in thickness. This makes it appear to be banded. These types of changes are easy and quick to make in Blender. This highlights why I choose to export as Thin and add thickness with Blender instead of MD.

Getting your garments ready for export in MD is very simple. Now you understand what you need to do to create consistently scaled garments all ready for texture in Blender.

In the next tutorial, I'll teach you how to create tileable textures based on photos of real fabric.


blender marvelous designer