Putting skinned clothes and plate on NPCs in Godot
Ten people in the Breakout Site now wear shirts, lab coats, shifts and plate, 123 models on four races. The lab coat's chest still isn't right.
The people in the Breakout Site are dressed now. Ten NPCs wear the clothes and armor from the wear study, and 123 models are installed for four races. It’s only partly done, because the dwarf and the orc aren’t dressed yet and I sent the lab coat’s chest back after seeing it.
The study built 186 models and installed none of them, because my model pipeline had no category for a single worn piece. I wanted them in the game, worn through the same socket system the orc’s armor already uses.
The three scientists wear a shirt, trousers, shoes and a lab coat. The four patients wear a shift. The orderly has the worker’s apron, gloves and boots, one guard has fitted plate and the night warden has strapped plate. The human, the elf and the lizard have 31 models each and the goblin has 30.
Adding a pipeline category for one worn piece
The new category is called gear_piece. A piece is one mesh with one surface on the theme’s shared palette, with no texture and no animation clip. The target is 240 triangles and the cap is 800. The lab coat was 1,002, so I thinned it to 782.
A piece is carried one of two ways, and its file has to match what its manifest says. A rigid piece has no skin and no bones, and it hangs on one slot’s bone. A garment is skinned to the body it was grown on, and in the game it’s bound to the wearer’s skeleton by bone name. Every piece records which race it was made on, and the install gate refuses a garment for a race with no installed body.
A piece only fails the fit check when skin comes through it in one of the animation clips. A skin point counts when nothing is in front of it, a worn face on the same limb is behind it, and it sticks out more than 4 mm past the nearest worn face. My first measure ran a ray along the point’s normal and counted 4 mm of ray, and that flagged an arm resting in the loose side of a shift. One garment coming through another is recorded but doesn’t fail anything for now.
Why not a second script for cloth?
The first version wore the clothes through a new script next to the socket system, and it put on whole outfits by name. I didn’t want custom scripts for armor. I wanted everything to use the same system, with clothing broken into pieces that fit into slots the way armor does. So I deleted that script and moved it all into the existing dresser.
A piece’s place is now a slot and a layer, written like chest/0. Cloth fills the regions its manifest lists, and a rigid piece fills its slot, on both sides if it’s paired. Putting a piece on takes off whatever already fills the same slot and layer, and nothing else. So a shirt (chest, layer 0) and a lab coat (chest and legs, layer 1) are both worn. A strapped greave replaces a fitted one on the shin at layer 2 and leaves the boot under it.
In Godot a garment is a MeshInstance3D added under the wearer’s Skeleton3D, with the garment’s Skin and its skeleton path set to the parent. A rigid piece is a BoneAttachment3D on the slot’s bone for each side, with the mesh under it scaled per axis by the slot’s size over the size the piece was drawn at.
There are no outfits in the game anymore. An NPC’s file just lists pieces:
"wears": ["shirt", "trousers", "shoe", "lab_coat"]
The content validator rejects a piece that isn’t built, a piece grown on another race, and two pieces that fill the same slot and layer.
Hiding the skin under a garment
Skin poking through cloth at a bent knee or elbow goes away if the game doesn’t draw the skin that’s covered. Each garment’s manifest lists the points of the body, and of any garment worn under it, that are under it at rest.
A point is named by its position in tenths of a millimeter and not by its index. Godot’s import doesn’t keep vertex order, and a point on a seam becomes several, so an index names nothing. When a piece goes on, the dresser collects the points of everything worn and builds an ArrayMesh without the triangles whose three corners are all covered. It checks the rounded cell and the 26 around it to allow for the importer’s rounding. The cut mesh is cached, and the original mesh goes back when the piece comes off.
A tint only washes the skin now too. An NPC’s tint and a dead NPC’s pallor skip any mesh that’s worn, so the dead dietician has gray skin and a white coat.
Why did the shirt and coat look like they had breasts?
After the first film I noticed large looking breasts on several of the clothes, which I hadn’t seen in the study’s pictures. I’d already fixed the same thing on the apron with span, which makes each ring of a garment its convex outline. That fills the hollow between the two pectorals.
It wasn’t enough here, because the problem was the profile. Cloth grown off the skin goes back in to the ribs under the chest, so from the side the chest sticks out over a fold. span works around a ring and doesn’t touch that. The study’s coat had it too. Its pictures only showed front and back, and small.

The human’s shirt and lab coat rendered in game at 2 meters. The top row is before and the bottom row is after. Look at the three-quarter and side views.
I added three numbers to the kit.
tautis the same rule asspanturned ninety degrees. Going down each column of points, any point inside the straight line between a ring above it and a ring below it gets pushed out to that line. At 1 it’s a sheet pulled tight from the breast to the hem.taut_withinlimits that to the columns facing forward, fading out over the next 30 degrees. With it all the way around, the sides of the shirt lifted off the ribs and the upper arm came through in the attacks on five races. 40 degrees is clean.span_acrosstreats a ring that’s open by less than a set angle, like a coat’s front, as closed. Without it the two points at the opening have no neighbor past them, so they stay in the hollow of the breastbone.
The shirt uses span 1, taut 1 and taut_within 40. The coat uses the same plus span_across 70. I left the plate and ceramic chest pieces following the body.
I’m happy with the shirt, but not the coat. It isn’t breasts anymore, but it’s like a huge shelf that bulges out further than anything else. That’s the coat in the bottom row and in the film, and it’s what is in the game right now. I measured it afterwards. The human coat’s front is a flat board 100 mm off the shirt. The fix for that isn’t in yet.
Why did the goblin’s shirt show through the back of its coat?
The goblin’s coat had a dark patch at the small of its hunched back, which was the shirt’s hem coming through.
The kit lifts a garment’s facets clear of every point of whatever is worn under it. But it only asked about a point if the point projected inside the stretch between two rings. On the outside of a bend the slabs of two neighboring stretches spread apart, and a point in the wedge between them got asked about by neither. I added wedge, which is how far past each end of a stretch the kit also asks. The coat uses 0.5. Just pushing the coat further off the body didn’t fix it.

The goblin’s lab coat from behind. The left two use wedge 0.5. The right two only push the coat further out, and the patch is still there.
The fit check never caught this one, because it’s cloth through cloth. I found it by looking at the review sheet. wedge at 0.5 is also 70 mm of the coat’s 100 mm shelf, so it’s part of what I have to fix next.
What’s still wrong?
- The dwarf and the orc aren’t dressed. 39 of their models fail the fit check, 21 on the dwarf and 18 on the orc. The dwarf’s shin comes through the trousers in every walk, and the orc’s waist comes through the shirt in the attacks. Every number in the garment table applies to all six races, so a sleeve number that fixed the lizard broke the human.
- The goblin has no fitted plate shoe. Skin comes through at the foot by 2.8 mm.
- The lab coat’s chest is a shelf.
- A dressed monster’s body isn’t saved dressed, so after loading a save it’s bare.
- A paired piece like a shoe is hung on the right foot as the left one and not mirrored. On the lizard that’s 10.6 mm off.
Also done
- Fixed the pipeline’s comparison step for cloth. It cleared the animation on each model’s skeleton before posing it, and a garment has a skeleton with no clips, so there was nothing to clear and the script stopped without writing a report.
- Traced the lab coat looking green from the front in the first film. It’s the yard’s green ambient light, and a plain neutral box next to the coat is the same color. I kept the light.
- Built the four races’ models twice, and all 124 came out as the same bytes both times.
- Compared a dressed monster’s 58 stats bare and dressed. They match, so dressing only changes looks.