snibgo's ImageMagick pages

Making humans

and painting and clothing them.

Note: this page contains too much detail on MakeHuman and Blender operations. They should be summarised.

The goal is to make clothing that is realistic, both physically and photographically.

As a bonus, after the 3D modelling is done, the clothing can then be made of cloth with any pattern, and decorated with any extra images, and this can be done quickly (eg in a client-server web environment with user-supplied images).

References

The physics of clothing

A physical garment has weight, a vertical force acting downwards. If a person is wearing a garment that isn't falling off, there must be an equal and opposite force that prevents it from falling.

The upwards supporting force may be:

In the following, we ignore clothing that is supported only by friction.

Clothing in motion encounters another force:

We model cloth as a finite number of elements with mass, each connected to other elements in a mesh that resists forces in a number of ways: stress/strain (like a spring), stiffness (resistance to bending), and so on.

In the real world, two objects cannot occupy the same space at the same time. We model this with collision detection.

Installation

Blender: Blender homepage

For convenience, the script pathMhBl.bat sets environment variables for MakeHuman and Blender programs and directories.

wget https://github.com/POV-Ray/povray/releases/download/v3.7.1-beta.9/povwin-3.7.1-beta.9-setup.exe

https://github.com/POV-Ray/povray/releases POV-ray v3.7.1, beta release. This is the first version of POV-ray that can read *.obj files and create meshes. But MH includes POV-ray code to do this anyway?

MakeHuman v1.1.1. Sadly, MakeHuman can't be run from the command-line. Or can it? Can we run a Python script that takes a model file, *.mhm, and create .obj and .mtl? See POV-ray scripts in c:\ProgramFiles\mh111\data\povray.

MH is a system for creating 3D humanoids. It is an interactive system: the user can tweak many sliders such as gender, height, weight, shape, angle, size and position of nose, and so on to a fine level of detail. For feedback to the user, MH renders the humanoid in real-time, using a fixed lighting scheme. (However, the user can alter lights under Utilities|Scene editor. Is this just for the "final" rendering?) The user can rotate, move and scale the humanoid. The user can select from a list of poses, but there is currently no interactive facility to modify the pose, eg to move a hand.

MH is primarily for modelling a humanoid. It has a facility for adding clothing, but not changing it. Clothing is designed to follow the contours of the humanoid, or to deliberately separate from it (so skirts etc work properly).

The standard worflow is to use a modelling program such as Blender to design clothing and poses for humanoids, then use MH to design the humanoid checking that it works with selected clothing in a variety of poses, then export the model to a modeller/renderer (such as Blender, again) where a stage can be built and lit and populated with humanoids and other objects as required, and the scene is rendered (ray-traced).

What is the point of MH? Why not do the entire job in Blender? Because MH is a specialist program. It uses high-level abstractions such as the characteristics of African, Asian and Causasian humanoids, and gender and age, and how these affect low-level details, which can then be tweaked further if desired.

MH users have contributed a large number of poses, garments etc, under various licences, eg CC-0 or CC-BY. My interpretation of the legal stuff: we can use these files to make our own models and images, and these images are our copyright and we can do whatever we want with them. But if we distribute our models (as opposed to the images we make from them), those models contain copyrighted material so we must comply with their licences.

A clothing directory contains:

.mhclo, a text file describing an item of clothing. It names an .obj file (.obj) and a material file (.mhmat) A list of mesh vertices that the garment corresponds to? A list of "delete verts".

.mhmat basic colour, transparency etc. Names texture images (PNG or JPG): diffuse, normalmap, specular.

.thumb Thumbnail that will be shown in MH. This always seems to be a 128x128 sRGB PNG file, but with .thumb extension.

Other possible textures: transparency map, bump map, displacement map, ambient occlusion.

.mhpxy Binary. A "proxy" file.

MH garments are cut from the "diffuse texture", an image that represents colour (and opacity) of the cloth. The image contains no other data. Designers will often indicate which pices of the cloth are used in the garment, but that isn't necessary.

White garments cause clipping when MH renders them, so I prefer a light gray.

If we are creating a new colour for a garment, the simple method is to overwrite the diffuse texture image file. But then the thumnail will be misleading. So the proper method is to copy the .mhmat to a new file, naming a new file for the new diffuse texture. Create the new diffuse file the same dimensions as the previous one. (However, the dimensions are not critical, and it can be 1x1. The pixels are accessed from u,v coordinates, ranging 0 <= u,v <=1. With interpolation or nearest pixel? I don't know.) Similarly, create a new thumb file.

A clothing modeller would include collision detection (so clothing doesn't disappear inside the body), and an energy minimizer that understood weight and stretching. MH doesn't do this.

OBJ format

Wikipedia

Text. "#" at start of line is a comment.

mtllib arg1obj.mtl
v 0.2936 8.6603 3.8001
v 0.2574 8.0220 3.1198

v is geometric vertex: x,y,z,w coords. w is optional; default 1.0.

vt 0.438694 0.913757
vt 0.432285 0.918199

vt is texture coordinate: u,v,w coords. 0 <= u,v <= 1. w is optional; default 0.0.

vt 0.618300 0.001700
vt 0.699700 0.220700
usemtl middleage_caucasian_female
g female_muscle_13442.obj.sub
f 78/1 27229/28144 13515/14632 27045/28145
f 75/2 27048/28148 13515/14632 27229/28144

vn is vertex normal: x,y,z coords; possibly unit vectors.

vp is parameter space vertex : u,v,w coords; v and w are optional.

f is polygonal face element: Three or more vertex indices; first is "1". (Can be negative, eg -1 is last in list, -2 is second from last.) Each optionally followed by "/" and optional texture coord index. Each optionally followed by another "/" and vertex normal index.

l (lower-case letter) followed by vertex indices that define a polyline.

mtllib filename external material file, each file containing one or more named material definitions.

usemtl material_name a name from an external material file.

o object_name following are in named object.

g group_name(s) following are in named group(s). This is used by MH to distinguish the faces of the main mesh from the hair, eyes, eyebrows, teeth, and each garment.

s switch Switch smooth shading on/off (0/1).

All indices can be negative; -1 is last in list.

MTL format

# MakeHuman exported MTL
# www.makehuman.org


newmtl middleage_caucasian_female
Kd 1 1 1
Ks 0.06275 0.05098 0.05098
d 0
map_Kd textures\middleage_lightskinned_female_diffuse.png
map_D textures\middleage_lightskinned_female_diffuse.png

newmtl ponytail01
Kd 1 1 1
Ks 0.04706 0.04706 0.04706
d 0
map_Kd textures\ponytail01_diffuse.png
map_D textures\ponytail01_diffuse.png

newmtl Eye_brown
Kd 1 1 1
Ks 1 1 1
d 0
map_Kd textures\brown_eye.png
map_D textures\brown_eye.png

newmtl eyebrow002
Kd 1 1 1
Ks 0 0 0
d 0
map_Kd textures\eyebrow002.png
map_D textures\eyebrow002.png

newmtl bodyMaterial
Kd 1 1 1
Ks 0 0 0
d 0
map_Kd textures\eyelashes01.png
map_D textures\eyelashes01.png

newmtl teethMaterial
Kd 0.64 0.64 0.64
Ks 0.8549 0.8549 0.8549
d 0
map_Kd textures\teeth.png
map_D textures\teeth.png

newmtl materialMaterial
Kd 0.64 0.64 0.64
Ks 0 0 0
d 0
map_Kd textures\textures7.png
map_D textures\textures7.png

POV-ray mesh2 objects

POV-ray mesh2 elements are triangles. MH writes quads to .obj files.


Setting up MakeHuman

Files, Export, Scale units has options decimeter, meter, inch, centimeter. Why not millimeters? Sigh.

We make new materials for skin.

  1. Dispmap: We paint the skin with an identity displacement map, and render it with no lighting. After slight dilation, we can then use this to displace any required image, so that image is effectively painted on the skin.
  2. Gray: We will use this to create a lighting map. The skin is nominally white, so the greyscale rendering gives the created shading.
  3. Mask: This makes all skin exactly white. We will use it to make a mask that is white where we have skin, and otherwise black (with antialiasing between the two).
  4. Transp: This makes skin invisible. MH always shows the humanoid, but when we want just the clothing, we can make the skin and eyes transparent, and turn off hair and eyebrows etc.

We make new materials for eyes.

  1. Transp: This makes eyes invisible. MH always shows the eyes, but when we want just the clothing, we can make the eyes transparent. (We will use this when the skin is also transparent.)
  2. Black: This makes eyes exactly black. This is for making the white=skin mask. We would prefer transparent eyes, but then we see through the eye sockets to the inside back of the head.

Skin materials

Eye materials

Using MakeHuman

Make a humanoid painted with a displacement map

dispmap.mhmat has ambientColor and diffuseColor all ones, specularColor zeros, shininess zero, emissiveColor zero, shadeless True, castShadows False, receiveShadows False. Set diffuseTexture ../textures/dispmap.png Remove all tags, and add tag snibgo.

Rendering scene is Argamb, which has ambient only. [But this doesn't matter?]

Render settings: resolution 1600x1200, anti-aliasing on. Options lightmap SSS off. Rendering methods: Advanced Render (not Quick). Hit the render button, and save the PNG file.

Make a gray shaded humanoid

gray.mhmat has ambientColor all ones, diffuseColor all zeros, specularColor zeros, shininess zero, emissiveColor zero, shadeless False, castShadows True, receiveShadows True. Remove diffuseTexture. Remove all tags, and add tag snibgo.

Rendering scene is whatever you want.

Render settings: resolution 1600x1200, anti-aliasing on. Options lightmap SSS off. Rendering methods: Advanced Render (not Quick). Hit the render button, and save the PNG file.

In MH, we can choose whether to have clothing, hair etc. But we can't choose whether to have the humanoid. Can we make the humanoid transparent? All white?

Applying an image to clothing

Applying an image to skin

Applying a displacement map to clothing

Applying a displacement map to skin

We will make a tee-shirt and skirt for a (female) humanoid. First, we make a humanoid in MakeHuman. To keep this website fit for family viewing, we dress her in a swimsuit. She has eyelashes, eyebrows and hair. In a render from within MakeHuman, she looks like this:

set WEBSIZE=-resize 600x600

%IM%convert ^
  %MHUSR%\render\snibfem.png ^
  -background White ^
  -layers Flatten ^
  -trim ^
  %WEBSIZE% ^
  mh_snibfem.jpg
mh_snibfem.jpg

Some dimensions of this humanoid, from MH Modelling Measure:

Height 1578mm [rather short]
Chest 838mm
Waist 717mm
Hips 959mm
? ?
? ?

[[In MakeHuman, we export the humanoid as snibfem.obj and snibfem.mtl. So this contains data about the surface of the humanoid.]]

In MakeHuman, Pose/Animate, Skeleton, Rig presets, click on "Cmu mb" (or other if you prefer). Export as Collada (dae), with options: Feet on Ground, Helper geometry, Facial pose-units, Orientation Z up face -Y, Bone orientation Along local Y, Scale units centimeter.

Blender basics

By default, Blender shows three main menus. Each of them can be changed. At the top, we have an "info" menu (symbol is an "i" in a circle). Near the bottom we have a "3D View" (symbol is a 3D cube). At the bottom is a "timeline" menu (symbol is a clock).

File, Open, snibstd.blend.

In Properties, Scene, Units, set "Unit of measure" to "Centimeters" Length to Metric, and Unit Scale to 1.0.

Blender has a distinctive UI. In most programs, to delete a lamp we would select it, hit the "delete" key, and confirm we really want to. In Blender, we select the lamp, ensure we can see the Tool Shelf (the one that has a "Tools" tab, not any other Tool Shelf), click the Tools tab, find the Delete button on the shelf, click it, and click the confirmation. Then check the lamp has gone. Oh, it hasn't gone? Why not? Blender doesn't say. Hmm, we have restricted the lamp's viewport visibility and rendering. Re-enable those, and try deleting again. Yeah, now it works.

Blender has an "undo" facility: Tool shelf, Tools, Undo. Experienced users will use keyboard shortcuts, like Ctrl-Z.

In a view, we can select an object with RMB (right mouse button). We can add to a selection with shift-RMB.

Blender: importing the static humanoid

[[File, Import, Wavefront (.obj), find the MakeHuman exports directory. Import snibfem.obj. This also imports data from the linked materials file, snibfem.mtl.

The imported objects ("data-blocks") have names something like:

File, Import, Collada (dae), find the MakeHuman exports directory. Import snibfem.dae. This has imported an object named "tpose", which is the parent to various objects. The imported figure should nearly 2m high. Verify this by transforming it by 1m.

Expand "tpose". On "Animation", RMB, Clear Animation Data.

Camera, properties, Object: the default Camera object is at location (7.5m,-6.5m,5.3m), rotation (63.6°,0°,46.7°). Change these to (0m,-3m,0.8m) and (90°,0,0). The camera faces the humanoid, far enough away to not get severe perspective. Properties data, Lens, Clipping, defaults to 1m, so objects further away won't be "seen" be the camera. Change to 100m. Properties data, Display, Size, change to 100mm so it is large enough to see.

Camera properties, data, Camera, change to "Full Frame 35mm camera".

Middle menu, View, View All. Now we can see the entire humanoid, and the camera.

By default, Blender renders each face according to its normal. This creates a 2D "jaggy" appearance, analogous to 1D aliasing. We can reduce this in two ways, which both apply to a selected object:

  1. smooth: Shelf Tools, Edit, Shading: choose "Smooth" instead of "Flat".
  2. subdivide: In the object list, find the object, click on the triangle of dots to select the mesh. Shelf Tools, Mesh Tools, Add, press Subdivide. This opens a panel; the "Number of Cuts" defaults to 1, so this roughly multiplies the number of vertices, edges and faces by four, increasing the memory and time by the same. By default, smoothness is zero, so each new vertex is linear interpolation of adjacent vertices. Set smoothness to 0.5.

As a rule, I figure out the process I want before any subdivision. Then I go back, subdivide, and apply those processes.

Blender: importing the posable humanoid

Imort the .bvh file.

Outliner: expand the bvh, Pose, Hips etc. Click on a bone. Middle (3D) menu, change "Object Mode" to "Pose Mode". Now, translate/rotate/scale affects that bone.

Adjusting for transparency

See Moving assets into Blender and Blender for Dummies: Coloring the Eye.

For hair, eyelashes, eyebrows and eyes:

Properties, Object (symbol cube), Display panel, tick Draw All Edges and Transparency. [This make no difference?]

Properties, Material, Transparency: tick this, and set Alpha and Specular to zero.

Properties, Material, Shadow: tick Receive Transparent.

Properties, Texture, Influence, Diffuse: tick Alpha, leaving value at 1.0. [This helps massively.]

The skin: Properties, Material, Shadow: tick Receive Transparent. [No noticeable difference.]

Create a hierarchy

Middle menu (3D view), View, Properties (shortcut N). This toggles the Properties menu at the right of the window. 3D Cursor: ensure it is at zero.

Create an Empty. Rename it "snibfem". From the middle menu, select all the objects that are to be parented. Then select the new "snibfem" object. Middle menu, Object, Parent, Object. This will change the Outliner (top-right), showing the hierarchy. If too many objects are in the hierarchy, select each one (in the Outliner), then middle menu, Object, Parent, Clear Parent.

Lighting

Properties, World, Environment Lighting, Energy, set this to 0.05. This supplies a small amount of ambient lighting, so shadows from lights are not entirely black.

[[The lamp is too close to the origin. Change its location to (4m,-2m,6m).]]

Add two lamps: a sun and a hemishere. These two types of lamp are infinitely far away, so there is no fall-off. For the sun: properties Data, Shadow, click "Ray Shadow". Samples 4, Soft Size 0.5m, Adaptive QMC, Threshold 0.001.

Shelf Create, Lamp, Sun. Set the rotation to (30°,30°,0°). (In the real world, the direction of sunlight is determined by its location in the sky, irrespective of its apparent rotation. In the Blender world, the location of the sun is irrelevant, and the direction comes from its rotation.) Set the engergy to 0.8.

Similarly, add a hemisphere lamp, with location and rotation all zeros, and energy 0.15.

I have set the lighting energies so they sum to 1.0, to use the full range of reflected luminosity without clipping. An energy can be negative, so the lamp subtracts light instead of adding. For daylight simulation the fill lights can be bluer, eg RGB(0.5,0.5,1.0).

Make a trial render: ensure we are using the camera (middle (3D) menu, View, Camera), then top menu, Render, Render Image. (This should be done at various stages, to check the work.) We save this result: middle menu, Image, Save As Image, "snibfem01.png".

%IM%convert ^
  %BLUSR%\snibfem1.png ^
  -background White ^
  -layers Flatten ^
  -trim ^
  %WEBSIZE% ^
  mh_snibfem_bl1.jpg
mh_snibfem_bl1.jpg

If we want, we can add a rimlight, eg as another sun, energy about 1.2, rotation (-110°,0°,30°), or as a point lamp at XYZ(-2m,2m,3m). I'm not a big fan of rimlights because (a) they add an artificial "made-forTV-movie" feel, and (b) they illuminate the rear of the object, so create problems if we move the camera. Animation can be organised to keep the sun stationary but move rim lights when the camera moves, and the rim light can be set to not create shadows.

To use just ambient lighting: For all Lamp objects, turn off "Restrict rendering" (the camera symbol). Properties, Type of active data: World. (The objects should be totally black.) Environment lighting: tick, factor 1.00.

Changing the texture

How do we change the texture of a material of an object? Select the object, properties Texture, panel Image, Source: find the image you want. Here, we use dispgrid.png.

%IM%convert ^
  %BLUSR%\snibfem2.png ^
  -background White ^
  -layers Flatten ^
  -trim ^
  %WEBSIZE% ^
  mh_snibfem_bl2.jpg
mh_snibfem_bl2.jpg

The image dispgrid.png is divided into a grid of same-size squares. When wrapped around this mesh, the squares at the face and neck are smaller than the squares at the stomach. This is because of the mapping that MakeHuman has between the mesh and the diffuse image. More detail is wanted on the face and neck than on the stomach, so a variable scale is used.

If we want a conformal mapping:

Paint the image on the skirt, aka UV mapping. See Blender 3D: Noob to Pro/UV Map Basics. In the 3D window, set to Edit Mode. In the 3D window, top-right corner, click-drag the lined triangle to create a new window. Bottom-left, set "editor type for this area" to UV/Image Editor. In 3D view window, select all vertices. Unwrap: shelf Shading/UVs, UV Mapping, click on "Unwrap" and in drop-down menu choose "Cube Projection". That will open a panel "Cube Projection"; set Cube Size to 0.006 (so entire humanoid fits in the reqird image). In UV window, Image, Open Image, open the required image. If needed, translate rotate and scale so the image fits over the vertices. In 3D window, select Object Mode. Next option is "Viewport Shading"; set it to Textures.

This is neat stuff. Notice that different parts of the humanoid map to different parts of the image, but at the borders in the humanoid, the grid lines match across boundaries, more or less. The boundaries are jagged. The jagginess is reduced if we subdivide first.

Animating a rotation

If we rotate the camera, this will simply point it in a different direction. So we first make a camera crane, at the world origin. Then when we rotate the crane, the camera will move in a circle.

Create an empty, rename it "CamCrane", and ensure it is at zero. Make CamCrane the Camera's parent.

We could add a rimlight to CamCrane.

[This selection busines is a real pain. I can't find a list of all the items I currently have selected, I just have to guess based on what is outlined. And usng the last object selected as the parent is hopeless if I can't see what the last one was, nor rearrange the order. This is answered here. For the child-to-be, goto Properties, Object (cube symbol), Relations, Parent, and choose the parent. Alternatively, in the outliner, drag-n-drop the child to the parent.]

We will rotate the humanoid through 360° over 72 frames, so that is 5° per frame. In Blender, the first frame is number 1.

In the timeframe (near the screen bottom), ensure we are at frame 1. Select the "CamCrane" object, goto Properties, Object (cube symbol), rotation Z, which should be zero. RMB, Insert Single Keyframe. In the timeframe, goto frame 73. "CamCrane", rotation Z, set to 360, and RMB, Insert Single Keyframe. Set the Timeline End to 72. Play the animation: the humanoid spins.

The motion has a smooth start and stop. How do we make the rotational speed constant? Create a new view window, set it to Graph Editor. Menu option Key, Interpolation Mode, set to Linear.

For the web, we make an animated GIF:

if exist c:\tmp\0001.png (
  call %PICTBAT%frTrim c:\tmp\0*.png

  %IM%convert ^
    c:\tmp\0*.png ^
    -crop !ftrTRIM! +repage ^
    -layers optimize ^
    mh_rotcam.gif
)
mh_rotcam.gif

Making a skirt

See Blender 3D: Noob to Pro/Simple Cloth Animation.

Fire up Blender. The cube is selected; delete it (Tools tab, button Delete). Shelf Create, Add Primitive, Mesh, Circle. [Add default UV map.] In object list top-right, rename "Circle" to "Skirt". The circle is shown in orange, meaning it is selected. At bottom-left, set Vertices 72, Radius 1.0. Select all the vertices (top-right, in the list of objects, find "circle" and click on the triangle of dots.) In the view, each vertex will be shown in orange. Shelf Tools, Mesh Tools, Extrude Region. Moving cursor will show new z-position, but press S then shift-Z, so moving cursor up will scale it within the z-plane (ie x and y are scaled). Scale to radius about 4, then left-click. Ctrl-shift RMB on edges until all vertices are selected.

Subdivide the radius lines: select the edges that join the two circles. (Middle menu, click Edge Select, then Select, Circle Select and/or Border Select.) Shelf Tools, Mesh Tools Add, Subdivide, set Number of Cuts to 10.

[[Properties, material, add new material. Textures, add new texture, Image, from file.]]

Paint the image on the skirt, aka UV mapping. See Blender 3D: Noob to Pro/UV Map Basics. In the 3D window, set to Edit Mode. In the 3D window, top-right corner, click-drag the lined triangle to create a new window. Bottom-left, set "editor type for this area" to UV/Image Editor. In 3D view window, select all vertices. Unwrap: shelf Shading/UVs, UV Mapping Press U for Unwrap. In UV window, Image, Open Image, open the required image. If needed, translate rotate and scale so the image fits over the vertices. In 3D window, select Object Mode. Next option is "Viewport Shading"; set it to Textures.

For the waist: select vertices in central ring (put mouse inside the ring but near the edge, then alt-shift-RMB). Properties panel (at right), select Object Data (triangle of dots). Vertex Groups panel, click "+" to create a new group. Rename it "Waist". Click Assign to put the selected vertices in this group.

Menu near the bottom has option for "Sets the object interaction mode". Change this from "Edit Mode" to "Object Mode". Properties Window, Physics icon. (On my laptop, I need to widen the window to see this icon.) "Enable physics for:", press Collision and Cloth buttons. Cloth presets, choose Cotton. Click "Pinning" checkbox. Click in its field, and select the only option, "Waist". In Cloth Collision panel, tick Self Collision.

Check 3D view is in Object Mode. Run the animation: in bottom menu, find right-pointing triangle, "Play animation", and click it. The vertices, except for the waist, will fall by gravity, eventually reaching a stable condition.

Top menu, File, User Preferences, tab Add-ons, find "Animation: Corrective shape keys", click "Enable an add-on" checkbox.

Properties, mesh data tab (triangle of dots), Shape Keys, Create duplicate for editing.

We now have two skirts, and can delete the original one.

File, Save As, "skirt.blend". This is a binary file.

Adding wind

Now, we add some wind.

Shelf Create, Other, Empty. Set the location (X,Y,Z) to (0,-4,-1). Rename this to "Wind01". In the Physics panel, click Force Field, type Wind.

For the skirt, in physics, "Enable physics for" Soft Body. This adds six new panels for soft body parameters. We will leave them all alone.

Now when we animate, the skirt doesn't stabilise to a position. Even though the force (from gravity and the wind) is constant, the movement is chaotic. [But the waist also moves? Why? Isn't pinning effective in a wind?]

Smoothing the edges: Shelf Tools, Shading, options are Smooth and Flat. (It doesn't tell you which one is active.) Click on "Smooth".

To get a transparent background: Properties, world, use WorldBlank (which has Horizon Color and AmbientColor set to black.) Properties, render, Shading panel, change Alpha from Sky to Transparent and ensure Output panel has PNG set to RGBA (and Color Depth 16). Can be TIFF 16, or OpenEXR Float (Half) or Float (Full).

(This is another way of masking white object against black background: set Horizon Color to black, and AmbientColor to white.)

Making a poncho

A large circle with head-size hole. Initial position: horizontal, above the humanoid. Then let it fall by gravity.

Better: it is an ellipse. Scale X by 0.8, scale Y by 1.2.

Properties, Physics, Enable physics for Collision and Coth. Cloth panel: Preset Coton, but set Mass to 1.0. Cloth Collision: enable, distance 0.001, tick Self Collision, set Friction to 50. Collision panel: set Outer and Inner to 0.020.

For any other clothing that is attached to the body: properties, Physics, Enable physics for Collision.

More complex: as previous, but with two armholes. Humanoid initially has arms vertically up, so hands go through armholes.

Making a top

Loose top; tight tee-shirt.

Posable clothing

Object arg1-female-muscle-13442, properties Physics, Enable physics for collision, Collision panel: Soft Body and Cloth: Outer 0.010, Inner 0.200.

Object arg1-short_tail_cameo_tee, properties Physics, Enable physics for: Collision and Cloth. Collision panel: Outer 0.020, Inner 0.010 Cloth panel: Presets: Cotton. Cloth Collision panel: enable; Distance 0.001 (this can't be set to zero). Tick Self Collision.

With animation, the cloth settles down on the skin. After a few frames, the cloth crumples at the sleeves and waist, perhaps due to repulsion between the cloth and skin. Setting Cloth Stiffness Scaling doesn't seem to help. The best cure seems to be change Cloth Mass from 0.3 to between 1.5 and 2.0 (max value is 10.0). [And Cloth Collision Friction is at 50.]

While figuring out animation, it can be useful to temporarily move objects to other layers: properties, Object (cube symbol), Relations.

Making a long-sleeved or tee-shirt

In Blender, take a humanoid. Chop off the parts that won't be covered by the shirt. Fatten the remainder.

For UV mapping: Create seams: from shoulder to armpit, bottom of both sleeves, both sides of torso. Unwrap the vertices. Apply the required image (eg an identity displacement map).

This will create a mesh. To make it move with body movements, use physics.

Dress.

Scarf.

Boiler-suit.

Overalls.

Jackets (like buttoned shirts, but with lapel collars).

Halter-neck backless dress.

For wrinkled clothing, anti-aliasing, samples per pixel 16, filter Gaussian.

Questions

Can we give Blender a black and white mask, and tell it to make a flat mesh of that shape?

Preferences, Add-ons, Import Images as Planes. Doesn't help: we get a rectangular mesh, with image as texture, with transparency. No apparent method of removing transparent parts.

Make an SVG with Inkscape. Blender, Import SVG. That gives us a curve.

Properties, Data, Geometry, Extrude and Bevel as desired.

In Object Mode, middle (3D) menu, Object, Convert to, Mesh from Curve

Program: mkshirt.c

This makes an SVG file for a shirt pattern. (Or directly writes .obj?) There are one or two front panels, one back panel, two optional sleeves (short or long), two optional cuffs, an optional collar, with or without buttons. Dimensions: chest, waist, height, sleeve length, cuff length. If we make an SVG, we need to sew it together somehow. If we make on .obj, we can leave faces open at the neack, waist and arms, then let physics adapt it to the body. But that creates another problem, of associating with the texture (UV mapping).

Run mkshirt /p0 >%BLUSR%\test.obj

In Blender, open snibclo3.blend, and import test.obj.

Subdivide the test object.

Set the test object physics: Enable Physics for Collision, Cloth and Soft Body. Cloth panel: Preset Coton, needs damping. Cloth collision panel: Distance 0.001. Tick self collision. Collision panel: Set Outer and Inner to 0.001. Soft Body: no changes.

Adjust the clothing that came with the humanoid, physics, Enable physics for Collision, set Outer and Inner to 0.005.

Caution: if the test garment isn't subdivided, and softbody is enabled, Blender will spend a very long time making rubbish results.

Belt

A belt:

Panel: Cloth Sewing Springs, Sewing Force 0.5; for Shrinking select Waist group; Min 0.2, Max 0.0.

Physics, enable Soft Body, panel Soft Body Edges, enable, set Length to 50, set Spring (vertex group) to "Waist".

Select the skin mesh. View Front, orthographic projection. Object mode, Duplicate (not Linked), press return so it isn't moved. Select the new copy. Rename it "belt". Move the copy explicitly 1 metre. Select all faces. Edit mode, Tools, Add, Bisect. Move cursor to left side, press LMB, drag to right side. To remove from bottom (top), tick Clear Inner (Outer). (Inner = behind the plane, outer = in front of the plane). But Bisect doesn't create new edges, so we get a ragged boundary. Bummer.

Knife project: in Object Mode, RMB select the cutting object (which must have no thickness), shift-RMB add object to be cut. In Edit Mode: Tool Shelf, Knife Project. This will add new vertices, edges and faces, but by default only to the front of the object to be cut. To cut all through, tick "cut through" bottom-left.

Edit mode: Face Select, Select Inverse. Tools, Remove, Delete. This has removed all non-belt faces. 3D menu: Mesh, Clean up, Decimate Geometry, Ratio 0.05.

Give the belt a new material with new colour. (Don't merely alter its material, because that will also change the skin.)

3D menu Edit mode: Mesh, Vertices, Convex hull. This has also created faces at top and bottom; remove them.

Edit mode, select all, extrude, "S", shift-Z. Select sharp edges, Mesh Edges Bevel, params Type Width, Amount 0.3, Segments 2.

Blah

3D menu, Mesh, Add duplicate. But this creates "linked" copy? Better: Object mode, Tool shelf, Tools, Edit, Duplicate.

3D menu, Select, Inverse to select the other vertices etc.

Split a skirt: Edit mode, select the vertices. 3D menu, mesh, Vertices, Rip.

Keeping the folds: assuming "Animation Corrective shape keys" addon: goto a good frame, properties, Mesh, panel Shape Keys, click the down-arrow, choose "Create duplicate for editing". This has created a second copy "baked" in the position. Original can be deleted.

DropSplash

DropSplash: domain, fluid and obstacle. Domain has Diffuse Intensity 0, Specular instensity 0.2, Transparency set, Raytrace, with Alpha 0, Specular 0, IOR 1.3. Obstacle is red cube, with motion eastwards and downwards. Underpainting has Shading Emit 0.5, Ambient 1.0.

Scripts

For convenience, .bat scripts are also available in a single zip file. See Zipped BAT files.

pathMhBl.bat

set MHDIR=C:\ProgramFiles\mh111\
set MAKEHUMAN=%MHDIR%makehuman.exe
set MHUSR=%USERPROFILE%\Documents\makehuman\v1\
set BLDIR=C:\ProgramFiles\BlenderFoundation\Blender\
set BLENDER=%BLDIR%blender.exe
set BLUSR=%USERPROFILE%\Documents\blender\

identAbsDispMap.bat

setlocal

set WW=%1
set HH=%2

set OUT_FILE=%3

if "%OUT_FILE%"=="" (
  echo %0 needs 3 parameters: width height outfile
  exit /B 1
)

set cBlue=%4
if "%cBlue%"=="." set cBlue=
if "%cBlue%"=="" set cBlue=8

%IM%convert -size %WW%x%HH% xc: ^
  -sparse-color Bilinear ^
0,0,#00%cBlue%,^
%%[fx:w-1],0,#f0%cBlue%,^
0,%%[fx:h-1],#0f%cBlue%,^
%%[fx:w-1],%%[fx:h-1],#ff%cBlue% ^
  %OUT_FILE%

All images on this page were created by the commands shown, using:

%IM%identify -version
Version: ImageMagick 6.9.9-50 Q16 x64 2018-06-02 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib
%BLENDER% --version
Blender 2.79 (sub 0)
	build date: Mon 09/11/2017
	build time: 07:44 AM
	build commit date: 2017-09-11
	build commit time: 10:43
	build hash: 5bd8ac9
	build platform: Windows
	build type: 
	build c flags: /W3 /w34062 /wd4018 /wd4146 /wd4065 /wd4127 /wd4181 /wd4200 /wd4244 /wd4267 /wd4305 /wd4800 /we4013 /we4431 /DWIN32 /D_WINDOWS /W3 /nologo /J /Gd /MP /openmp     
	build c++ flags: /W3 /w34062 /wd4018 /wd4146 /wd4065 /wd4127 /wd4181 /wd4200 /wd4244 /wd4267 /wd4305 /wd4800 /we4013 /we4431 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /nologo /J /Gd /MP /EHsc /openmp     
	build link flags: /MACHINE:X64 /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO  /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib  /ignore:4049 /ignore:4217 /ignore:4221
	build system: CMake
MakeHuman v1.1.1.

To improve internet download speeds, some images may have been automatically converted (by ImageMagick, of course) from PNG to JPG.

Source file for this web page is makhum.h1. To re-create this web page, execute "procH1 makhum".


This page, including the images, is my copyright. Anyone is permitted to use or adapt any of the code, scripts or images for any purpose, including commercial use.

Anyone is permitted to re-publish this page, but only for non-commercial use.

Anyone is permitted to link to this page, including for commercial use.


Page version v1.0 5-January-2018.

Page created 26-Jan-2019 18:54:34.

Copyright © 2019 Alan Gibson.