Building hair and beards as parts that fit every head
Eight hairstyles and three beards built from a head's scalp file, one set per race, with a check that refuses a head or a hair that doesn't fit.
The 16 human NPCs now have hair. There are eight styles (crop, part, hair tail, knot, strip, bob, ring and wild), three beards (moustache, full and chin) and six colors. An NPC’s file says what it wears in one string, like "part/black/moustache", and the brows take the hair’s color. It’s only partly done, though. The new beards and the reshaped styles are still waiting for me to look at them, and the elf’s and dwarf’s ears poke through every style.
Why did hair become a separate part?
After the face rebuild I said I wanted different hairstyles on heads the same way heads go on bodies. A trial of it was already built, and I answered nine questions about it. Keep all eight styles, orcs stay bald, a helmet hides the hair and the brows raise and take the hair’s color.
Then I was asked whether the three human heads should share one set of eight hair models. I said yes, and I made it a rule for every head and every race. I didn’t want a pile of extra hairs every time I add a head. Hair that already exists doesn’t change to fit a new head. A new head changes to fit the hair, and new hair has to fit every head it goes on. For races I said to keep the sets separate, so a race can have its own hairstyles and a wider variety of heads.
How is a hairstyle built?
A hairstyle is one sculpted mass, built from a head’s scalp file and nothing else of the head. The scalp file is the skin as a table of distances from the middle of the braincase, plus the hairline, crown, nape, ears, brow, mouth, chin and jaw. Every length is scaled by the head’s size. The head’s .glb is only opened to check the result.
Each style is a function of that scalp, in one kit module. The part is a furrow on the right with the mass swept over it. The tail is a flat tail wider than the neck, swung back off the nape. The ring is a bald crown with the sides standing out over the ears. A model is one mesh with a color on each point, dark at the root and underneath and light on top, with no material, picture or bone. Each is 72 to 278 triangles and about 5 KB. The game gives the mesh one color, and the point colors multiply it.
For several heads at once, the kit makes one scalp of all of them. The outermost skin is what the model has to stand off, and the innermost is what it has to sink under, so what’s built from it fits all of them.
How does the check work?
The check poses the head in every different frame of its clips, which is about 360 poses (the nine face clips frame by frame and the jaw in the body clips). Then it poses the race’s body with the head on in every second frame of every body clip, about 800 poses. In every one of them the hair has to stay under the skin at its edge and off it everywhere it shows.
Whether a point is under the skin is decided by a ray, counting the times it leaves the skin minus the times it enters. I’d first counted odd or even crossings, and that was wrong at the dwarf’s nostril, which has a doubled wall. Two other faults turned up. The file slimmer dropped vertex colors from a file with no material, and hair’s only paint is vertex color, so the hair went flat until the Godot check caught it. And a long triangle diagonal at the temple cut a chord through the skull, so triangulation now takes the shorter diagonal.
Making one set a race hold from both sides
A written rule isn’t enough, so the pipeline enforces it both ways. A data file says which heads’ scalps a race’s set is built from, and a row for each head says which set of hair and which set of beards it wears. A new head is a new row and nothing else.
A new hair or beard is checked on every head that wears it, and its manifest names each head with that head’s hash. If it fails on one, it’s refused. A new or changed head is checked against every installed hair and beard in its row. The hair’s bytes never change. If one doesn’t fit, the head’s record is sealed as failed and the gate refuses it, and the check writes its result next to the head. The model-pipeline test holds everything installed to both sides. I tried it with a beard built from one head only and with a head against another race’s hair, in a scratch folder, and the gate refused both.
My first build was 49 models, one per head per style. Sharing took it to 30: human 8 hair and 3 beards, elf 8, dwarf 8 and 3 beards. The three human beards are built from the foreman’s and cutter’s scalps together and fit both. That’s 892,512 bytes on disk against 1,030,960 for the 49, and 49 of 49 pairings of a model and a head it’s worn on pass.

The sheet I judged the sharing on. The foreman’s head with its own hair on the left and the boy’s hair on it on the right, every style, front, three quarters, side, back and from a distance. It was made before the ear change, so the old cut-outs show.
What went wrong with the ears?
The shared set had a slot cut round each ear, and I called them ridiculous. I said ears can clip out of short hair, and where the hair goes below the earlobe it can just not draw. So no hair is cut round an ear now. Short hair passes over the root of the ear and the ear can come through it. Which hair counts as short is measured, by whether its lower edge at the ear is above the earlobe, not by its name. For those, the check lets only the head’s ear faces cross the hair and nothing else. Long hair, the bob, stands outside the ear and covers it.
That works on the humans, because an ear there stands no more than 36 mm off the skull. The game can’t hide an ear, since an installed head’s ear is part of its one skin. So the elf’s and the dwarf’s ears are too long to cover and come through the bob as well. Hiding them takes a rebuilt head. Every style’s shape changed with the ears, so I only kept my earlier approval on the five models whose bytes didn’t change.

The five heads in profile and three quarters, each style on each, after the cut-outs were removed.
How does the game wear it?
HairPart finds the model by race and style, so every human head shares SM_hair_human_bob.glb. It hangs the model on a bone attachment on the bone its manifest says it rides, with that bone’s rest undone. Hair and the moustache ride the head. The full and chin beards ride the jaw bone, rigid and with no bone in the model, so they follow a mouth opening.
The color is one shared material per color. A corpse’s wash or an NPC’s tint multiplies the hair by what white becomes under the wash, because hair is a color and not a picture. Moving it straight toward the wash would make every head of hair on a tinted body the same as the tint. A file with no hair field stays bald, and "auto" picks a look from the NPC’s name, the same every run. The style tail isn’t the lizard’s tail, so the player is shown it as “hair tail”. A helmet will hide the hair through a switch, and no helmet exists yet.
What’s still wrong?
The rebuilt human beards and the reshaped styles are trials until I’ve seen them. No elf or dwarf NPC wears their hair, because only humans are in the NPC figure’s table. In three clips that play once, the death, the claw attack and the overhead two-handed attack, hair passes through the body, by 4 to 44 mm. I said that’s fine, since nothing clips at rest or in a loop. On the sheets, the tail looks like the crop from the front, a full beard looks like a flat mass up close and the moustaches are thin at 5 m.