Friday, March 23, 2012

Blog moved!!!!

The new, updated, makehuman blog is here:

http://makehuman.org/blog

Best,

Manuel Bastioni
(MakeHuman BDFL)

Thursday, February 9, 2012

Recovering a lost target

Maketarget uses a set of properties to maintain its internal state. The script will not work if its internal state is messed up. However, your elaborately crafted target needs not be lost.

1. Assume that you have loaded the base mesh and added some targets. Press the Apply targets button to get a clean mesh. You may need to reload maketarget and/or press the Initialize button first.


2. All shapekeys are applied to the mesh. The mesh is no longer recognized by maketarget. Import base.obj again.


3. With the base mesh active and the morphed mesh selected, press the Load target from mesh button.


4. The morped mesh disappears, but the morph is loaded into the base mesh as a shapekey. Now it should be possible to save the target by pressing Save target as. The target file is saved with the extension .target, irrespective of the extension specified in the file selector.


5. The newly created target can be loaded into maketarget. If you put it in the makehuman/custom folder in your home directory (typically ~/makehuman/custom on Linux and My documents/makehuman/custom on Windows), it should appear under the Modelling > Custom tab.

Sunday, February 5, 2012

Making a skirt with makeclothes.

There have been a lot of changes to makeclothes recently, and the documentation is somewhat outdated. I will do something about that soon, but in the meantime this post will illustrate some of the changes. I will also show a different way to import the base mesh into Blender, by using maketarget.

The biggest change is that single file make_clothes.py is obsolete. It has been replaced by the python package makeclothes, located directly under the MH/utils folder. Copy the entire makeclothes folder to Blender's addons folder, typically Blender/2.61/scripts/addons. Also copy maketarget_b25x.py from MH/utils/maketarget to addons. Alternatively, you can execute maketarget from Blender's text editor window. This is not possible for makeclothes, which now is a multi-file package; it must be copied to the addons folder before Blender is started. Moreover, the files must be copied again every time either Blender or makeclothes is updated. Sorry for the inconvenience.

The reason for this change is that a package can contain several files. In particular, makeclothes maintains its own UV coordinates for the helper geometry. The helper UVs in base.obj are located in a small region with alpha=0 in the upper-right corner, to ensure that helpers are invisible in MH. But the helper UV coordinates for masking need to match the UVs of the underlying body. Therefore a different UV set is necessary.


The fake UVs for the skirt helper geometry are located in an alpha=0 region, because a skirt does not always cover the legs completely. Point made.


Unless your clothing is supposed to fit very snugly to the body, it is best to relate it to the helper geometry - it is there for this reason. Consider e.g. the female chest, shown schematically in the figure above. If we model a coat on a male base mesh, the breast will be too obvious when it is applied to a woman. Conversely, a coat modelled on a female will have a strange protusion in the middle when applied to a man. In this case, the mhclo file may say that the coat is 1 cm in front of the nipple but 10 cm in front of the chest bone, which is realistic for a female but not for a male. The helper geometry will be morphed correctly and take care of this problem.


At this time the only helper geometry is a tight overall and a long, tight skirt. More will be added in the future.

In Blender, enable the Make Target and Make Clothes add-ons. They are found in the MakeHuman category.


Load the human base mesh with make_target_b25x. Press Import base obj with Load materials from Materials. Select the base mesh MH/data/3dobjs/base.obj in the file selector. This is the unique base mesh file.


Load neutral-female-young.target from the MH/targets/macrodetails directory.


Apply the shapekeys. First select Basis and press the - button, the select neutral-female-young.target and press -. We now have a good human mesh to attach clothes to.


Model a skirt. Set mesh type to Clothing for the skirt and mesh type to Human for the human. Rename the object to Skirt. This is important because this name will show up in MakeHuman.


Auto create vertex groups for the human. With the flag set to Helpers, only helper geometry is included in vertex groups. Then select further vertices to ignore, and press Remove vertex groups with the flag set to Selected. The picture below shows the Left vertex group at different stages of the process.


Also auto create vertex groups for the skirt. The flags are ignored for clothing, and the Left vertex groups looks like this:


Create two UV Maps. Call the first one Mask and the second Texture. Make some nice UV layout for the texture.


Now it is time to make the clothes. With both the human and the clothing selected (in either order), press the Make Clothes button. The UV layers properties are set to: Mask:0, Texture:1, Obj:1, to match order of the UV maps. The texture map will be included in the exported obj file, the mask map in the mhclo file. The mhclo file is created in a subdirectory of the directory specified just below Settings.

Export the obj file. With the clothing selected, press Export Obj file. It ends up in the same folder as the mhclo file.

Whereas we can choose any UV layout for the texture, the mask UVs must match the UVs of the underlying body. This is because there can be several clothes that partially cover the body and each other. When a clothed character is imported with mhx, the masks of one clothing covers both the body and the clothes beneath it, i.e. make them invisible in that region. This requires that all clothes have compatible UVs.

To automatically generate a compatible UV layout, press the Project UVs button. The clothing must have seams in approximately the same place as the body. This result is very good in the bulk, but UV vertices close to seams may be misplaced.


Fortunately, it is quite easy to fix misplaced UVs manually, using a trick that I figured out only recently. Select faces on one side of the seam only. It is usually clear where the misplaced vertices need to go. Repeat for the other side of the seam.


The previously exported mhclo file does not contain the correct mask UVs. To fix this, we could press Make Clothes again, and this time the correct UVs will be exported. However, making clothes is a rather time-consuming process, and it is not necessary just to export the right UVs. With the skirt selected, press Reexport Mhclo file. The existing mhclo file is updated with the correct UVs.

The tailor finally has to make the mask, texture and thumbnail images and save them in the same folder. You can look at the top of the mhclo file to get the expected file names. Or, if you prefer some other file names, change in the mhclo file.


The new skirt shows up in MakeHuman, in the Libraries > Clothes section. Without a thumbnail, because we have not made any. Select the skirt and export it as an mhx file. Using the right setting in mh_export.config, we can equip the skirt with an experimental rig. The skirt rig does not work terribly well, but something like it is necessary if we want to imitate the Marilyn pose above.

Wednesday, February 1, 2012

Clothes with multiple UV layers

Make_clothes now supports multiple UV layers.

Give your character a nice sweater (Libraries > Clothes > Sweater). The sweater has some non-trivial texture, visible both in MH and in Blender after export with MHX. In particular, note that the collar is black but the cloth under the collar is green; they are located in different positions in texture space.



The loaded file has two UV layers. The Mask UV layer must conform to the body mesh. It is used by masks coming from other clothes, to ensure that obscured parts of the sweater are invisible. Unfortunately, this means that the collar will share UV space with the part of the sweater below it. If we added a scarf, say, it must obscure both the collar and the upper part of the sweater.


The Texture UV layer can be chosen at will. It is used to texture the sweater, but it does not affect any other object. In this UV layer the collar does not coincide with other faces. Thus the collar can be black and the rest of the sweater green.


In make_clothes, there are three new properties to control which UV layer is used for the mask, the texture, and for export to the obj file. The UV maps are numbered starting with 0. This is a bit rough, and I may do something more user-friendly later, but it works if you do it right. The obj layer is used by obj and collada export and by the MH gui. Typically the obj and texture layers are the same.


It is possible to use more than two UV layers, if you check the Blender materials option. That will use the settings of the material in the Blender file. However, this is still a rather uninvestigated topic and may contain bugs.

Monday, January 2, 2012

New site 2012!!!

Hi guys,
happy new year!

An important update for our community: a new site, with more services, more transparency and better illustration of processes, code, policy, bugs...

Some parts are not completed yet, and there are some bugs here and there, but most of it already works and you can enjoy:

1) a better view on the hard work we have done, with a detailed todo list, updated very often.

2) Unify all documents in one unique place.

3) Now you can see the faces of the people that are donating their time to the makehuman community.

4) A clean and immediate way to communicate with the team, using the form here

5) Finally an official gallery, with selected images.

6) A clear and easy download interface.

7) Our dear old forum, resurrected on a much more powerful server.

8) A clear description of makehuman features.

We are still working on it, hoping to improve the services and offer more and more to our community.

Tuesday, December 20, 2011

Helper geometry for clothes

Clothes and hair are morphed based on the targets for the underlying skin. This algorithm was originally intended for the creation of low-poly proxy meshes, for which is works well, but there are two problems for clothes:

  • Most clothes do not follow the body shape exactly, e.g. a coat has very little depression between a woman's breasts.

  • What to do if there is no underlying skin, as in the middle of a skirt?

  • To solve these problems, we have added some very basic clothes as part of the mesh, and are updating the targets for the new geometry. Currently the targets have been generated automatically, but the major ones needs manual tweaking, as we can see in the figure. Once targets for the helper geometry is in place, we can make clothes that adapt to that rather than to the body.


    The helper geometry does not normally show up in MH, because it is assigned UV coordinates in a region with alpha = 0. It is removed on mhx import unless the Helper Geometry option (formerly known as Diamonds) is checked.

    Sunday, November 20, 2011

    Texture projection

    This weekend I spent some time implementing a rough version of the texture projection for MakeHuman alpha7. The ultimate goal is to be able to create a texture from the different reference pictures used to create a model. Currently it only uses the current reference picture, even when you have several pictures assigned to different views. While the projection code from Saturday still had a lot a lot of seams in the rendering, the one from Sunday fixes this, as you can see in the rendering below.

    (In case you are wondering what image I used to project, it's one of the wallpapers from the local burger chain: http://www.mos.co.jp/)

    There are still a few points which can be improved. The most noticeable in the rendering below is the texture sampling. I currently use nearest neighbor instead of bi-linear sampling, so it looks a bit aliased in places where the texture surface is much lower than the object surface. If you use a higher resolution picture, this shouldn't be such a problem.
    Another improvement would be speed. Since 99% of the projection is implemented in python, it is rather slow at the moment. However I plan to write an OpenGL version once I have some time to add FBO (framebuffer object) support to our render engine.
    Besides these two technical problems, there is the GUI aspect. As I mentioned before, we will need to combine projections, for example front and side view, to obtain a more usable texture as currently polygons orthogonal to the projection plane will have very washed out texturing.
    We will also need to add a way to mask area's in the source image to avoid that the entire texture gets projected. Right now you need to erase the unneeded regions in Gimp or Photoshop and save the image with an alpha channel.
    I haven't tried the projection with a real photograph of a face yet, as I was more interested in coding the projection than actually using it. But I'm sure some of you will try it soon.
    © MHteam 2001-2010