Creating a clothes library: some technical aspects

If your topic doesn't fit anywhere else, put it here.

Moderator: joepal

Re: Creating a clothes library: some technical aspects

Postby duststorm » Tue Feb 14, 2012 5:49 pm

I'm very happy I can help by giving useful feedback.
Even though I'm a programmer myself, I like to approach this from an artist point of view for the moment. I think that is most useful.
I was very happy with the new commits I saw today and yesterday. You and Marc are really close onto this.

I had some time and improved the textures on the shirts a bit. They now have seams on color, sleeves and such. I think I will be focusing now on fully completing the clothes I already made so they can be included in MH if wished. Let's start using your comments as a checklist of what is still to improve ;)
MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Creating a clothes library: some technical aspects

Postby robertltux » Tue Feb 14, 2012 5:57 pm

a couple bits i was thinking about

1 98% of the time when running Make Clothes an object imported with the name BASE.OBJ will be the Human
(and most of the rest of the time somebody was being an idiot) i would think that it is safe to flag that mesh as HUMAN

2 is it possible to have the imported mesh named after the imported file (ie if you import a file named teddy.obj then in blender name the mesh teddy)?

Re: Creating a clothes library: some technical aspects

Postby duststorm » Tue Feb 14, 2012 9:18 pm

Some screenshots of the result.
Improved texture with seams on longsleeved T-shirt

The seams at the end of the sleeves unfortunately mean that separate textures need to be made for the short sleeved version. The same textures cannot be shared anymore between the two.
Shortsleeve version, improved textures

The textures can still be made from the same Gimp source file, however. I made the seams in separate layers which can be overlayed as required.
You might also want to change the opacity shader of the seam layers a bit depending on the used base color. For example, on the white shirt I made the seams a bit brighter too, because too black otherwise.
MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Creating a clothes library: some technical aspects

Postby duststorm » Wed Feb 15, 2012 11:11 am

Here's a new status update.
I've begun sculpting a shirt model. Even though I'm not fully satisfied with the modeling itself, especially collar still needs some work. The nice thing about Blender's multires modifier is that you can still edit the mesh at every subdivision level and all other levels will automatically adapt. Thus you can still edit the low resolution topo without losing your sculpts.
Scupting shirt, work in progress

One of the reasons for my posting is that I wanted to give some advice on what I use for sculpting folds in Blender. The picture shows my main setup. I really like the clay brush as it allows you to easily manipulate the mesh with mutliple strokes. It doesn't require you to be very precise as you can always come back and fix things up.
If you want to draw harder edges, you can use brush or sculpt brush.
One important thing to get the right shape for your folds is to choose a good curve type. The default round form will give you trouble getting convincing folds. Look at the screenshot to see what I'm working with. It's not a preset, but just a curve I defined myself. Unfortunately (to my knowledge) Blender doesn't allow you to define your own presets, so taking a screenshot of it is the best I can do ;)
I could probably experiment some more with the curves and maybe even use textures. I haven't looked into this yet, but it would be cool if you could add your own brushes too, much like those you can download here:
Another feature I use sometimes is the Smooth stroke option, but when fiddling around a lot with clay brush you might want to disable it, as it will slow you down considerably.
The approach I use most often is first use a few additive strokes to get a few folds. These will be the largest and main folds I will be working with. Then I select the Subtract option and draw around the folds I made first. Most of the times I follow along the same stroke, but just above or under it. It's actually a bit like with regular 2D drawing: when additive strokes would be your highlights, you add shadows around them using subtracting brush strokes. The subtract brushes give you the chance to tweak the folds a bit, make them sharper where necessary etc.
After that I often use the Polish brush to fix things up and smooth things out. Also the edges of folds (where they start or end) are often blended with this brush. You can either follow along strokes with this tool, to smoothen them out a bit, or draw across strokes to make creases and bumps less pronounced. Good use of this brush can make a lot of difference.

Personally I would advice against using the Pinch brush. Some tutorials use it to get sharper folds, but I recommend setting a sharper curve shape and touching up with smaller subtractive brush strokes afterwards. The reason for this is that Pinch destroys your topology by pushing vertices close together, which results in polygons of very uneven sizes. This makes it very hard afterwards to edit those pinched areas again. Also you could end up with some very nasty results as the small polygons that were pushed together start intersecting much more easily. So, be careful with that brush.

One final advice, which is actually something you should be mindful of BEFORE you start sculpting, is to make sure you have a good base topo. Try to get your mesh all quads, no triangles, and try to have your quads more or less the same size wherever possible. Also try to keep your quads rather square-shaped and not rectangle-shaped. So keep their length and width more or less the same size. Why this is important? The topo of the basemesh determines what you will have to sculpt with. Much like classic painting in 2D happens on pixels, sculpting happens on vertices and polygons. Even though you subdivide your mesh a few times before sculpting, the initial topology remains, only the polygons are subdivided a few times. When you have strange or uneven sized areas, this problem will become worse when subdividing. The mesh of the sweater that came with MH is a good example of this: subdividing it will create very small polygons around the breast area that move in a radial pattern instead of a regular grid. So why do you want your polygons to be square and equal-sized again? Imagine you would be painting a picture in photoshop that has rectangle shaped pixels that become larger in some areas and smaller in other. It could get pretty difficult to get the result you want in such case. It's the same for sculpting.
To give an example of this: the polys in the arms of my shirts are not optimal, they are a bit too wide so not perfectly square. I notice this when sculpting because sculpting vertically around the arms has more effect than sculpting along the length of the arm. This is actually quite frustrating and a bit limiting. To solve it, I did an additional subdivide going from 4 to 5 subdivisions. This made the polys in the arms small enough to give me enough liberty to do what I wanted.
The reason I kept the topo on the arms like this is to avoid wasting too much polys on the low resolution version.

That's it. For those interested in trying this I have one extra advise. Look at some timelapses or tutorials of people using zbrush, sculpty or mudbox. A lot of the brushes or effects they use are also in blender. Try out and play with some of the settings to see what gives you good results. Blender might be a bit harder to get started with sculpting, but I think given the right settings it can be as effective as the commercial alternatives. There's also a cool timelapse on the website that illustrates the sculpt feature.
MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Creating a clothes library: some technical aspects

Postby duststorm » Wed Feb 15, 2012 8:02 pm

I did some more work on the shirt and I'm happy with the sculpting. I made two textures for it, have a look:
Red/pink shirt

Black striped shirt

Using the template I made I can make different versions really quickly. Couldn't help myself, so here's some more.
Some more alternate textures!

MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Creating a clothes library: some technical aspects

Postby tjindy » Thu Feb 16, 2012 2:47 pm

What can i say.... stunning work!
Posts: 103
Joined: Sun Mar 01, 2009 9:01 pm

Re: Creating a clothes library: some technical aspects

Postby duststorm » Fri Feb 17, 2012 12:39 pm

Hello everyone. I'm writing a new update as I have some thinking patterns to jot down.
For the shirt, I have been thinking what the different LOD levels to choose for it would be. As I already said before, it has a good amount of extra polygons compared to the long sleeved T-shirt. Because of this, I was wondering whether the low poly version would cut it for real low poly use, or that it would be better if I went and retopoed (or reduced) it a bit to make a lower poly version.

Let's have a look at the current situation so far.
Polygon detail comparison between different LODs

As you can see the lowest version weighs in on 398 quads (796 tris) which might be or not be a bit much on lower end platform or for a huge mass of persons seen from a distance.
This is 138 quads (276 tris) more than the long sleeved tshirt.

So where did the extra geometry go into? Well, for one: the collar area. More precisely the back of the collar. The T-shirt actually had some problems there because I didn't have enough geometry to fit it around the back of the neck nicely. This made it stick a bit through the model. Although it became better when subdividing, you would sometimes still have to edit it a bit manually to fit well. Of course, masking the underlying mesh would also solve the problem.
The back of the T-shirt collar sticking through the neck of the basemesh.

The reason I left it at this is because fixing it would require at least 1 or 2 extra edgeloops running across the back of the shirt all to the bottom. This would account for quite a lot of extra polygons.

Because the collar area is more important for a shirt, I made the extra edgeloops at the back which solves the aforementioned problem.
Topology of the back-of-neck area for the shirt

As you can see, I introduced two extra edgeloops of faces by splitting the middle two polygon rings in two.

A second reason for the polygon increase is the added collar itself, which consists of 42 faces. This might be a good candidate to easily reduce for a lower poly version. There are a lot of polygons you can remove that will otherwise only be noticeable when looking at the model from extreme angles, thus not such a big problem. Maybe I just make it a closed simplified mesh like I've seen some others do it.
The collar at original LOD, one and two subdivisions

Then finally, the third reason for the increase is at the end of the sleeves.
Closing the gap at the end of the sleeves

As you can see on this picture (and on the general wireframe picture) I've made edges with thickness on the sleeves, and made one edgeloop go inward the sleeve, right up to a point where it will certainly intersect the arm. This makes sure that the mesh is closed and you cannot look into the sleeves and get a strange see-through effect (because polygons usually have only one side). On a game model I would probably delete the non-visible part of the arm and try to connect this inward-going piece of sleeve to the remaining arm vertices. This was not a big problem with the T-shirt since the sleeves were a lot tighter to the body.
Additionally, giving some thickness to the end of the sleeves accentuates the typical type of sleeves that a shirt has better.

So far for the analysis of the topo of the shirt. When thinking about what polycounts would do and what would be too much, I went back to the three proxy meshes that come with MH and made a more detailed comparison. I made some pictures for myself to make it easier to compare (I like making this kind of pictures because somehow I find it much easier to evaluate things). I will share these with the rest of you, as well as my thoughts on them. For anyone of the MH documentation team or otherwise, feel free to use them if you think they are good.
The pictures are in order of increasing polygon counts:
Rorkimaru proxy. The lightest of them all.

Rorkimaru's proxy is a wonderful mesh for use when you have to save agressively on polygons. It fits well if you want to render 100s of character on the same screen, especially if these characters are further away from the camera. It can also serve well to make a lower resolution version of a character to which you can transition to dynamically when it gets further away from the camera. Being such a minimalistic version, I think it does very well at keeping a convincing human form.
Up until now, I tried to imagine this model as a reference for the polycount I want for my low resolution clothes.

Even though the clothes (at least the jeans and the example clothes that are in MH at this time) are based on the wonderful all-quads topology of ascottk's proxy.
Ascottk's proxy model. My personal favourite.

This is personally my favourite of the three. It comes in at second place in the polycount rank because it has slightly less polygons than forsaken's proxy. Yet, that does not mean forsaken's proxy is a better or more detailed model. I'd argue that on the contrary, ascottk's is the best attempt of mimicking the topology and detail of the MH basemesh at a lower detail level. It is all quads with evenly spaced polygons, making it a very suitable candidate for subdividing and sculpting using Z-brush. The flow of topology lines is also very good, and is comparable (though less detailed) to that of MH. This makes it extremely suitable for animating, because deformations at joint areas like shoulders and hips won't result in strange behaviour in extreme poses. It's because of that very good topology that it got chosen as a base for the original clothes. This attempt also has to be applauded for its efficient use of polygons. For example the face and hand areas have more polygons than other areas. Especially of note is the nose, that thanks to enough polygonal detail is still sharp and detailed. The topology of the hands also is a real work of art. They just look so smooth and organic, even though they contain less polygons than forsaken's mesh.
This model is my first choice for use in realtime applications and games. It offers a very good base to create game characters that fit today's standards in polygon counts. (being character models of between 2000 and 5000 polygons) Because most of the times you will want to clothe this model before you use it, you still have a lot of control over what the final detail will be.

Then we have the proxy with the highest poly count, being forsaken's.
Forsaken's proxy model. At 1832 polygons it contains most geometry, however it is a mix of tris and quads.

Weighing only 48 faces more than ascottk's, it's fair to say that the difference in detail level is minimal. The catch is in how this geometry is used. Unfortunately I'm a bit dissapointed in this attempt. That is to say, it's certainly not a bad model, it's just that there is a much better alternative (being ascottk's). Looking at the images you just can't deny that it looks a lot less smooth than it's competitor. Take note of the difference in the nose geometry, it's an interesting case. Most important is that the edgeflow or topology of this model is just not that good. It contains a lot of areas where the lines just get lost, like under the breast area and the middle of the back. This could give trouble when the model has to form some extreme body types, as you could get messy overlapping triangles. Another important fault is the joint areas between hips and legs and at the armpit areas. There are no smooth lines transitioning from the body to the arm and instead a lot vertices of vertices converge there and form a rat's nest, which will give you problems when animating or posing the arms and legs. The hands are just not as smooth as the alternative, and their topology has some strange areas, which serve no purpose other than to make it look weird when animated.

One additional interesting comparison is that of the mouth and eyes area of both ascottk and forsaken's proxies.
The mouth and eyes areas of forsaken and ascottk's proxies

There's an interesting difference between the two where forsaken keeps the upper and lower parts of the inner mouth area, while ascottk doesn't. Both have teeth and a tongue. Ascottk's model has cleaner lines on the teeth and a smoother tongue, while forsaken's is a bit jagged and messy. I don't know which of the two would give the most realistic effect or be easiest to work with.
These parts can be fairly simple for realtime use, and they are in fact only important when doing talking and lipsync animations. You can't open the mouth unless there are at least teeth and a tongue, or it will look weird. Those tongue and teeth, however, do not need to be too detailed. I am not sure whether the insides of the mouth are visible or not. Maybe only when opening the mouth wide open?

Forsaken's maybe has too pointy eyes, as the eyes look somewhat weird on the face.

So, my choice rests with ascottk's model for regular use, although forsaken's mouth area might give some suggestions on how to improve it (if it would be visible). For creating reduced LOD meshes I love the work rorkimaru has done. These two will serve as subjects to be clothed with respectively my "low" and "game" versions of the clothes meshes. I will aim their polycount to be more or less in sync with the polycounts of those models.

To put some more numbers to this: since in almost all realtime renderers meshes are converted entirely to tris, the sizes of the proxies in such an engine are:
rorkimaru: 1476 tris
ascottk: 3534 tris
forsaken: 3662

I want to add an extra remark on forsaken's mesh: I told you that it had mixed quads and tris. It actually used to have more tris, but the MH crew requested that he did it all in quads. Therefore he converted his model to quads, and it was supposed to be all-quads. Except for 2 little triangles that he forgot on the feet. So those 2 polygons from the 1832 in total is the reason why forsaken's proxy is not considered "all-quads".
The party poopers

Lastly I'm going to end with saying that a decision was made together with Manuel about which versions of my clothes will be distributed with MH. We are going to make packages for the low, game and medium sizes. The high versions will not, as they are rather too large to be practical. Because of this, in the future I will probably be renaming game into medium and medium into high, so low - game - medium becomes low - medium - high (hope you can still follow ;)).
Since the sculpts are really only well visible on the highest detail level, we will have to resort to some hacks to get that detail back in again. I will compensate for this by supplying normal and displacement maps for them.
The render setup should thus support normal and displacement mapping. I'm also hoping we can get some realtime normal mapping and displacement mapping shaders into the makehuman program.
Work is under way to create a clothes library on the website where clothes can be downloaded and uploaded by users. The "medium" version of my clothes will probably go into the main MH distribution so everyone who updates to the latest version will have them by default. The other versions can be downloaded from the website.
MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Creating a clothes library: some technical aspects

Postby duststorm » Sun Feb 19, 2012 2:18 pm

Creating masking maps for the clothes is still giving me a headache. I've solved some problems in my workflow but there a lot left unsolved.
I've been experimenting with getting a good mask texture for the shirt. I found a solution to the problem I previously had where due to fuzzy imprecise mask painting I had masked a little too much of the base mesh.
I refer to the picture thomas posted that points out this problem.
This was because I used Blender's texture paint to paint the mask. This obviously does not work very well, because even with a sharp brush you can easily have bleeding across polygons, resulting in the messed-up result I ended up with.

To solve this, I only did the UV mapping in blender. I did this thanks to the "project UVs" feature of the clothes script, and then fixing up the loops around seams (because my seams are different from the basemesh)
The big problem with mapping the UVs is that it's often not clear what part of the body you're actually masking. I found no real good tool or workflow to be able to see what you're doing, without guessing in the dark.
Then, to keep the sharp edges of the UV map, instead of texture painting, I export the UV reference using UVs>Export UV Layout, open it up in Gimp, select the transparent part with the magic wand tool, create new layer, fill selection with black, invert selection and fill it with white. This is my mask.

Now, to see what I've actually done (because I still have no clue) I import this created image back into Blender. Assigning the mask to the human basemesh gives you a good idea of what is actually masked. Again I must witness how I've failed miserably. Let's have a look:
This is masking done the wrong way

Obviously this is not what we want. The reason that the UVs where assigned to those parts is because the collar partly covers those areas, from certain viewing angles. The collar's verts are assigned to those parts for fitting because they are closest together, which is correct. Yet for masking we need manual intervention from the artist.
More precisely, you want to unmask every part of the body that is visible through the collar opening.
My big problem: how to do this easily and precisely.
The most obvious would be painting. Just texture paint on the model. But here we have the problem of the edge bleeding. Texture painting is just not a good way to do it well. Besides, there are some other problems. To make this work you need to make both human model and clothes visible, to have a reference. For texture painting, of course, you need solid view, as with wireframe you don't see what you paint. Yet a lot of these areas that have to be corrected are difficult to view. For example in the neck area the head is constantly blocking the view.

Apart from this issue, there is another very interesting issue. As Thomas already pointed out in his blog post for a lot of clothes like a skirt you want to deviate from a UV map that resembles the body map closely. For example to have legs underneath the skirt. A big problem here is deciding what parts to keep and what parts to mask.
Take this example:
The stomach under the shirt is made invisible

This mask will prevent you to view the model from this angle correctly

Common sense might make you hide the stomach part under the shirt. But since a shirt is not extremely tight fitting around some parts of the body you can look in and see skin at some extreme angles.
A careful artist would probably hide this stomach to be sure that whatever the anatomy of the human, the skin will not poke through the shirt. However this makes rendering at some angles impossible.

This rises an important question I think: where do we draw the line? Is there a certain distance that a cloth has to be removed from the skin before the skin does not need masking? Do we only mask possible trouble areas where skin could poke through, or do we hide as much as possible so it still works in most common angles?

Also up for discussion is: masked areas of the masking texture do not have to be the same as the UV mapping boundaries. The UV map could be meant to show around which are of the body the cloth is located. It's absolutely necessary that we stick to this scheme if we intend to reuse those masks when layering clothes on top of each other.
For example, the UV map for the mask Thomas made for the skirt is useless for anything else except for the body and maybe a shirt that your character is wearing. This might suffice in most regular cases, but I think this approach is a bit flawed, and I'm sure we will hit the restrictions this system poses soon. (as soon as we release artistic creativity on it) Just something that comes to mind: a girl wearing a long jacket over that skirt could have the skirt poking through her jacket. If we start allowing fantasy or sci-fi clothes I guess we're really screwed ;) (unless we assume that most designers will only be making tight-fitting costumes that reveal lots of skin -- this might not be such an inaccurate assumption by the way ;))
In the example of the skirt we could have the UV map go along the legs of the character, like if it were a pair of trousers. The masking texture would be painted white only at the area that fits tightly to the skirt.

Personally I'm not too fond of the masking concept. It's difficult to do because we lack a decent painting tool, it's very confusing (and it will probably be more so to artists) and easy to mess up because you cannot see in realtime what you're doing. I personally prefer exporting my clothed character from MH and fixing up the few body vertices that poke through the clothing, as this gives you a lot more control.
Of course, we need something like masking if we want to make something that's useable out of the box for rendering.

It's hard..
MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium

Re: Creating a clothes library: some technical aspects

Postby ThomasL » Mon Feb 20, 2012 1:37 pm

I am not terribly fond of the masking concept neither.

The obvious alternative is to always maintain the clothes above the body. However, this is not so easy, because the clothing must remain on top for all morph targets and for all poses. A necessary condition for this to work is probably that the clothes are at least as dense as the body. If the garment is more sparse than the body, it can happen that the middle of a face is below the body even if all corners are above it. This happened to me when I was making the low-poly test clothes, and this is why I introduced the masks.

If you know that your character will always wear the same set of clothes, you can delete hidden vertices in you imported mesh afterwards. (You cannot add verts or faces, because that will ruin uv coordinates and shapekeys, but deletion is ok.) This also yields a performance boost, but the problem with the boundaries of the visible region remains. In fact, it becomes even worse than with masking, since it is not possible to hide part of a face with this method.

Deleting vertices is also problematic if you character will wear different sets of clothing in different scenes; basically you need to maintain separate copies of the character for each outfit. Personally I hate keeping redundant information; it always goes out of sync sooner or later.

It is possible that the clothing problem lacks a single good solution, and that one should use a combination of ideas: masks, deleting verts below, and a sufficiently dense clothing mesh which stays above the character (but not so dense that it hurts performance). And in the end one probably needs to make some tweaking in Blender or whatever tool you use.
Posts: 1139
Joined: Tue Sep 15, 2009 2:46 am

Re: Creating a clothes library: some technical aspects

Postby duststorm » Mon Feb 20, 2012 3:33 pm

For regular (non-advanced) MH use we should probably aim for one clothes resolution, being one that has similar resolution to the MH character.
Then it is possible to make clothes fit above the character in most cases.
I think that the standard MH character should work out-of-the-box with a good set of clothes and without needing tweaking in an external 3D editor. So it should be possible to create a character in MH, choose clothes for it, pose it in MH, and then just render it with one of the renderes MH supports. We need to account for the fact that not everyone will use blender.

As for lower resolution meshes, well I think that people using those will almost certainly be doing "more advanced" things with them. Like creating game characters in Blender or another 3D editor. For this I think it's a reasonable assumption that they won't mind to do a little tweaking and editing.

I've experimented a bit with fitting my jeans better today, because it did not fit perfectly around the hips. Unfortunately this also is a tedious and labour-intensive task. Well, at least if the helpers do their work well, it will only have to be done once. I will make another post with my workflow and some guidelines soon.

One thing I'm not sure about: With the jeans, what is the recommended way to fit it perfectly? Do I need to make sure that I stay outside of the helpers everywhere, without any triangles intersecting it? Or is it enough if I fit the jeans around the character model itself without making it overlap, and then fit the jeans to the helper mesh using the clothes script?
What is the exact meaning of the helper mesh? Is it just a better less error-prone reference for fitting vertices to, or is it really a guideline saying: do not get closer to the body than this or you will get in trouble?
I think this is an important point to clarify.

I also had a discussion with Manuel about this on IRC. We were comparing the separate clothes approach and the approach of making "outfits", which are a full set of clothes that are fitted around the character. This avoids having to do complex clothes masking and also lets the artist create nice touches. For example make a jeans fit around shoes with the typical folds this causes, or fitting a shirt or T-shirt around the pants in an interesting way. This also makes it easier to layer clothes on top of each other, for example jacket on top of shirt. I, however, like the flexibility that separate clothes pieces give you, but I always stated that you would need to do some manual fixes and touches to get a less generic result.
As for my contributions, I think I will continue making separate pieces. There will come a time that I will want to create some interesting characters with them. If I create interesting combinations of the clothes I can always share them back to MH as outfits instead of separate clothes.
MakeHuman™ developer
User avatar
Posts: 2566
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium


Return to General discussions about makehuman

Who is online

Users browsing this forum: No registered users and 1 guest