Skip to main content

4. Loosen the fit

The fitted tee looks right on the female body. Put the same method on the male body and you get a painted-on shirt with every ab showing through. Not the vibe.

A relaxed T-shirt does three things a fitted one doesn't: it falls from the chest instead of following the waist, it has ease (room between cloth and body), and it doesn't show small bumps like pecs and abs.

The loose tee and jeans on the male body

LOOSE = dict(GAP=0.012, R=0.04, HEM_Y=0.955, HANG_FROM=1.32, HANG_K=0.15, EASE=0.022, BLUR=0.012)

A bigger gap (12 mm), a bigger closing (4 cm), a lower hem, and three new tricks.

Hang​

Below the chest, go down the grid one horizontal slice at a time. Each slice can only come in a little further than the slice above it: 15 cm per metre dropped. So the cloth falls from the widest point of the chest and can't tuck in at the waist.

def hang(D, lo, from_y, k):
out = D.copy()
j0 = int(np.floor((from_y - lo[1]) / H))
for j in range(min(j0, D.shape[1] - 1) - 1, -1, -1):
out[:, j, :] = np.minimum(out[:, j, :], out[:, j + 1, :] + k * H)
return out

k = 0 would be a straight drop, like a curtain.

Ease and blur​

Subtract 2.2 cm everywhere (that's the ease), then blur the field with a 1.2 cm gaussian so the muscles stop reading through. Blurring rounds bulges inward, though, so finish with a floor: the cloth may never come closer to the skin than the gap.

F = np.minimum(F, hang(Dt, lo, LOOSE["HANG_FROM"], LOOSE["HANG_K"]) - LOOSE["EASE"])
F = ndimage.gaussian_filter(F, LOOSE["BLUR"] / H)
F = np.minimum(F, D - GAP)

The trap: a curtain off the arm​

The hang should only apply to the torso. If the arms are in the field, the shirt hangs down off them too. So the first try used a distance field to the torso alone, arms removed.

It hung a sheet of cloth off the arm anyway.

Here's why. The torso without arms is an open surface: it has holes where the arms were. The sign trick (which side of the nearest normal am I on?) breaks near a hole. Points inside the arm see the edge of the hole as nearest, get "inside" as their sign, and the hang drags that inside-ness straight down.

The fix is to take the sign from the whole body, and only count a point as inside when its nearest body point is torso, never arm:

arm = arm_dominant(bone_index, bone_weight, names) # vertices whose main bone is an arm or hand bone
# ... sample the torso alone, and label every whole-body sample as torso or not ...
dt, _ = cKDTree(torso_samples).query(P, workers=-1)
Dt = np.where(is_torso[i] & (D.ravel() < 0), D.ravel(), dt).reshape(shape)

D is the whole body's signed distance, i the nearest whole-body sample. Inside the torso we keep the true signed distance. Everywhere else we use the plain (unsigned) distance to the torso, which can't leak.

Jeans​

tools/make_jeans.py is the same method with different numbers. Fitted, the jeans sit 3 mm off the skin, under the tee's 6 mm, so the tee hem lies over the waistband instead of flickering through it. A smaller closing (1.2 cm) bridges the crotch but keeps the legs apart below it.

Loose, the waistband stays fitted. Each leg hangs from just below the crotch (6 cm per metre taper), the ease grows to 1.6 cm by the knee, and the legs are kept 8 mm apart so they never merge. Straight legs, no traced knees.

Female, fittedMale, loose
Fitted jeans, backLoose tee and jeans, back
py -3.12 tools/make_tee.py <ref> - male loose
py -3.12 tools/make_jeans.py <ref> female
py -3.12 tools/make_jeans.py <ref> male loose

:::tip Keep the layers apart When two pieces overlap (tee over jeans), keep a real gap between them in the overlap band. On the male body the jeans sit at least 16 mm inside the tee there. Two surfaces a millimetre apart will z-fight in game. :::