Videos / Episode 2
Episode 2 · AI Game Development

Optimizing Characters

On YouTube: AI Game Development - Optimizing Characters Ep2

What the first AI character pipeline got wrong, what we changed, and the cast it produced: an audit, a low-poly rebuild, hair rules and one shared garment kit.

19 minPublished Oct 12, 202615 chaptersUnreal Engine 5.8Blender 5.2MetaHuman budgets

Overview

The first pipeline made good-looking heads. Put twenty of them in one level and the editor slowed to a crawl. This episode is the audit that found out why, and the rebuild that cut every hero roughly in half without changing a face.

Part 1 measures what was wrong: triangle counts, missing levels of detail, hair cards stacked up to ten deep, and the small flaws that only show up close. Part 2 is the fix: a low-poly pass that kept all 52 facial shapes, six hair rules the tools now check on their own, a ten-step review per hero, and a final hair and clothing system built for a crowd.

1.9Mtriangles for 20 characters before
105,670 → 47,344Wulfstan, full character
36,492 → 7,030Wulfstan hair and beard
15outfits from one garment kit

Chapters

Click a chapter to jump the player to that point.

The studio: hardware

Every step in the series runs on one desktop. The game itself targets a standard gaming PC, so all budgets in this episode are set for that standard PC.

PartSpec
GPUNVIDIA RTX 5090, 32 GB VRAM
CPUIntel Core Ultra 9 285K, 24 cores
Memory64 GB DDR5-6000
MotherboardGigabyte Z890
System drive2 TB WD Black NVMe
Project driveSamsung T9 portable SSD, so the project moves between machines
Machine specs slide
The build machine. The audit numbers below were also checked against a laptop, where the slowdown was first noticed.

Software and tools

ToolUsed for
Blender 5.2Modelling, rigging, hair, textures, low-poly reduction, garment building
Unreal Engine 5.8The game: import, materials, levels of detail, in-level review
ClaudeDrives Blender and Unreal through MCP, writes and runs every batch script, keeps the records
Blender MCP and Unreal MCPConnections that let Claude run Python inside the open Blender and Unreal editors
KZ Python toolset (Unreal)Our own editor plugin: run_python, run_python_file, project info, git from the editor
Trellis.2Image-to-3D heads
MeshySource meshes for the base bodies
AI image generatorsPortraits, four-view sheets and hair references
MakeHumanAnimation-ready face topology
Python (numpy, scipy, trimesh)Cloud batch work: audits, shell builder, hair rules, texture fixes
Git with LFSEvery automated batch is committed before and after it runs
Kawaii PhysicsCloak and cape simulation in Unreal
OBS and FilmoraRecording and editing the episodes
Software list slide
Software used so far in the series.

Part 1: what we found

01Where we started

The first pipeline: a four-view reference per character, an AI image-to-3D head, a MakeHuman topology wrap so the face could animate, and hair grown as cards from the reference sheet. Every character shared one standard body. Episode 1 shows this pipeline on Cynan.

It worked. Sixteen heads were built and nine were in Unreal, and up close they looked right. The trouble started with several of them in a level together.

The first character pipeline
The original pipeline, before the audit.
Sixteen heads, nine in Unreal
Sixteen heads built, nine standing in Unreal.

02The audit

The editor slowed down with only a few characters loaded, so everything was counted: every mesh, every texture, every material slot, measured from the export files. The yardstick was Epic's MetaHuman level-of-detail specification, since it is the published budget for realistic characters in Unreal.

ItemOurs (full detail)MetaHuman budgetResult
Body17,422 verts / 34,778 tris, 4 bone influences30,500 verts, 8 influencesPass
Headabout 13,100 verts / 26,000 tris, 52 morphs24,000 vertsPass
Eyes, teeth, gums, tongue, lashes8,400 trispart of headPass, but wasteful at distance
Hair cards9,800 to 26,000 trisabout 10,000 verts1.5 to 3 times over
Beards1,000 to 26,700 tris500 to 10,000 vertsThree characters over
Levels of detail (LODs)none8 head, 4 body, 8 hairMissing
Textures per unique headabout 43 MB at 4096 pxup to 8192 on high-end PCHeavy for 20 characters

Per character: 84,000 triangles (Tudwal, the lightest) to 105,670 (Wulfstan, the heaviest), 93,000 on average. Twenty on screen: about 1.9 million triangles and 120 to 140 draw calls before shadows, plus 0.7 to 1.0 GB of unique textures. The faces, rigs and skin weights all passed. The cost was in hair, missing LODs and textures.

Audit chart of triangles per character
Triangles per character at full detail. Orange and green are head, hair and beard.
What 20 characters cost
What twenty characters cost on screen.

03The cost of hair

Wulfstan's approved hair and beard alone were 36,492 triangles. Hair cards are see-through layers, and ours stacked seven to ten deep over every point of the scalp. Every layer is drawn for colour, for depth and again for shadow, so the cost multiplies. This is called overdraw, and it made hair the most expensive thing on screen.

Why hair cards are expensive
Layered cards: each layer is drawn several times per frame.

04Close-up flaws

Looking closely turned up a second list:

  • A seam at the wrist where the hand texture met the arm, like a bracelet.
  • Hair sitting over the ears instead of around them.
  • Hair edges floating above the skin.
  • Caps that looked like helmets: straight slopes and no natural volume.
  • Gaps between the hair and the back of the neck.
  • Beards covering the mouth opening by up to 2.3 cm.
Wrist seam and hair over the ears
Two of the close-up flaws: the wrist band and hair over the ear.

Part 2: how we rebuilt it

05Lighter characters

The goal: the same faces, with all 52 facial shapes intact, at about half the triangles.

The hair test came first. On Wulfstan, the approved cards (36,492 triangles) were compared with a single textured shell that follows the scalp, at about 4,000. That is about 89 % less, and from normal game distance it holds up. The owner compared three versions (shell with cards, shell with a bottom fringe, shell only) and picked shell only as the new plan at that stage.

Hair cards compared with a single shell
Approved cards (left) against a single textured shell (right).

Then the low-poly pass on the whole character:

  • Head: a morph-preserving reduction that keeps all 52 ARKit keys. Heads settled around 17,700 triangles.
  • Mouth parts: dental arches of 280 triangles each, tongue 150, eyes 736 each, lashes 272.
  • Body: reduced with joint weighting, so elbows, knees and shoulders keep their density. Standard body 34,778 to 22,952.
  • Hair and beard: textured shells, about 2,300 and 1,700 triangles.
CharacterHeadHairBeardTotal with body
Bedwyr17,7142,3161,70047,136
Cynan17,6982,308none45,412
Owain17,6742,324none45,402
Brother Tysilio17,7382,3971,70647,247
Tudwal17,6982,42960846,141
Einion (large body)17,9382,3751,70847,427
Iddon (large body)17,9382,3201,69947,363

Every head export was checked: 7 meshes, 134 bones, 52 keys, at most 4 influences per vertex and 0 unweighted vertices. Wulfstan went from 105,670 to 47,344. A typical hero went from about 93,000 to about 45,000.

Low-poly budget chart
Before and after the low-poly pass.
Original and low-poly faces for Owain and Cynan
The check that mattered: original (left) and low-poly (right) for Owain and Cynan. Same likeness.

Background characters were cut harder, to 66 %: peasants, Neanderthals and the undead. An importance map protects the face (head, jaw, lips and brows weighted at 0.6) while the rest collapses. The full mesh is kept hidden in the file so any character can be reverted.

Background characters after reduction
Background character sets after the 66 % reduction.

06Hair rules

Every flaw from Part 1 became a written rule with a measurement, and the tools check each rule automatically on every cap.

#RuleMeasurement
1Hairline hugs the ear and never covers it0 to 3 mm from the ear outline
2Top and front edges sit on the scalppinned 0.8 mm above the skin
3Volume follows the skull with natural variationno straight slopes
4The back closes cleanly at the napeno gap to the neck
5Long hair rests on the bodyends 1.8 mm above shoulders and back
6Beard mouth opening follows the lipcut on the real lip line
Six rules for every hair cap
The six rules, each tied to a measurement.

Overnight batch. With the rules written down, one night run traced the outline of each character's old hair cards and built 15 new caps with the rules applied, for the standard and the large body. Interior vertices were lifted at least 1.5 mm (hair) or 2.5 mm (beard) above the skin. Every cap came with a review sheet in eight views: front, left, back, right, both ears, three-quarter and three-quarter back.

Fifteen hair caps built overnight
Night run output: 15 caps, standard body and large body.

Iteration. The batch was a starting point. Bedwyr's cap went from the overnight version 1 to an approved version 24, and Cynan's was approved at about 1,200 triangles. Every version kept its own number, so any of them could be restored.

Bedwyr hair cap version 1 and version 24
Bedwyr: overnight version 1 (top) and approved version 24 (bottom).

07Review pass

Ten steps per hero, one hero at a time, and nothing is exported until it passes.

  1. Head check in Blender
  2. Hair cap check
  3. Beard check
  4. Mouth and eyes check
  5. Body joints check
  6. Blender sign-off
  7. FBX export
  8. Unreal import
  9. In-level check: a walk, a face check and a back view
  10. Approval

Characters go into the test level one at a time and come out after review. Owain was the first to pass.

Ten-step review checklist
The per-hero review checklist.

The wrist fix came out of this pass. The hand and forearm textures had a tone step, a ring of strong tilt in the normal map, and a roughness step at the join. The fix rebuilt the textures only: base colour and roughness crossfade over about 11 cm of the forearm, and the low-frequency tilt in the normal map was removed around the seam. The mesh did not change.

Wrist seam before and after
Wrist join before and after the texture crossfade.
In-level review in Unreal
Every hero gets a walk, a face check and a back view in Unreal before approval.

08Final hair and clothes

Hair version 7: shell plus strand cards. The shell-only hair saved the most, but lost detail at the hairline and edges up close. The final hair is a hybrid: the shell covers the head, and a small number of strand cards sit only where they show (hairline, edges, beard). Each character gets a procedural 2048 px strand atlas with clumps, waves, frizz and curl.

Approved cards, shell only and final hybrid
Top: approved cards. Middle: shell only. Bottom: shell plus strand cards.
Wulfstan hair and beardTriangles
Approved cards (start)36,492
Shell only3,754
Shell plus strand cards (final)7,030

That is about a fifth of the starting cost, with the close-up detail kept. Across the cast, the final hair runs from about 4,000 to 9,000 triangles per character.

Levels of detail. Every skeletal mesh now has four LODs at 100, 50, 25 and 10 % of the triangles, switching at screen sizes of about 1.0, 0.5, 0.25 and 0.1. Facial shapes are kept on the first two LODs only; mouth parts and lashes drop from LOD 2. Strand cards are used at full detail only, and further away the character drops to the shell.

Hair cost per level of detail
Hair cost at each level of detail for every hero, on a log scale.

One garment kit. Instead of modelling clothes per character, one kit was built for the whole cast. Each piece is shaped from the body surface itself: body faces in the region are copied, pushed out along the normals by a fixed clearance, smoothed and cut at the hems. Then each piece is recoloured per character with a material tint.

GarmentTriangles (standard body)Offset from skin
Under-tunic9,3751.2 cm
Tunic9,0632.1 cm
Padded tunic8,8633.2 cm
Trousers5,3950.5 to 1.5 cm
Drawers2,7110.3 to 0.55 cm
Leg wraps2,1581.05 cm
Turnshoes2,4960.9 cm
Belt692on the tunic
Cloak3,452body plus clothing, +2 cm
The shared garment kit
One garment kit, shaped from the body surface.
Fifteen characters in casual and work outfits
The kit dressed fifteen characters, with a casual and a work outfit each.

Cloaks hang on five bone chains and run on Kawaii Physics in Unreal (damping 0.2, stiffness 0.08, gravity -350, angle limit 45 degrees, collision from the body physics asset). Hidden skin under clothing is masked out so the engine does not draw what nobody can see.

Cloaks and hidden body layers
Cloak simulation and the body regions hidden under clothes.

Prompts and instructions used

These are the instructions behind the overnight cap rebuild and the review loop, condensed from the session records.

Night run rules (given before leaving)
1. No review or approval needed until finished.
2. Apply the hairline-around-ears rule and the natural-volume rule to every character.
3. Use the trace method: trace the volume of the original approved hair cards so the cap matches their outline.
4. Cap edges that meet the skull or face bend down and touch, or almost touch, the head. No floating edges. The bottom and back get more transparent toward the tips so they look organic and broken up.
5. No spikes on moustaches. Trace the cards for moustaches and beards too.
Why it works: every rule is something you can check on the mesh, and the owner answered the planning questions before leaving.
Answers to Claude's planning questions
Scope: the 15 heroes after Owain. No background characters.
Wulfstan: fix only where he breaks the rules.
Blender only. No FBX export and no Unreal. I review first.
Keep the old meshes hidden in the file for comparison.
Triangle budget stays close to the current one.
Ears: cover an ear only where the original cards covered it. Never put hair on the ear surface.
Result: 15 caps and review sheets waiting in the morning. Nothing stalled, because every decision was made before the run started.
Review loop (one hero at a time)
For each hero:
1. Open the right file. Show only body, head, eyes, lashes and the new hair.
2. Show me the review sheet plus the known issue for that hero.
3. Wait for my call: Approve, Edit, or Revert.
4. On Approve: tick the checklist, add a dated note, save, open the next hero.
5. On Edit: change the new hair object only, re-render as a new version, show it, wait again.

Rules:
- Do not export FBX or touch Unreal until all 15 are approved, unless I say so.

What we took from it

  1. Measure before you polish. The audit found what looking could not.
  2. Give every part a budget. Body, head, hair and beard each get a number.
  3. Turn every mistake into a rule, and let the tools check the rule.
  4. Review one character at a time, and export nothing that has not passed.
  5. Keep the old version until the new one is approved. Every master was backed up and every original mesh kept hidden in the file.
Lessons slide
Five lessons from the rebuild.

Try it yourself: checklist

  • Pick a published budget (MetaHuman LOD spec works for Unreal) and measure every mesh against it.
  • Count hair layers as well as triangles. Overdraw is the hidden cost.
  • Reduce heads with a method that preserves shape keys, then check likeness side by side.
  • Give background characters a harder cut with the face protected.
  • Build LODs for every skeletal mesh; keep morphs on the first two only.
  • Write each flaw as a rule with a number, and check it in code.
  • Run batches unattended only after every decision is written down.
  • Shape clothes from the body surface and recolour them per character.

Episode narration

Show the narration (condensed)

IntroWelcome back to KnightZ. In Episode 2 we look at the first way we built our characters, what went wrong once we put them all in the game, and how we rebuilt the process to make the cast you see today.

The auditEach character came in at about 93,000 triangles at full detail, and full detail was the only level we had. We measured against Epic's MetaHuman budgets. Twenty characters on screen came to 1.9 million triangles before shadows. Our hair was one and a half to three times over the card budget. There were no levels of detail. And each head carried about 43 megabytes of unique 4K textures.

Hair costWulfstan's approved hair and beard alone were 36,492 triangles. Hair cards are see-through layers, and ours stacked seven to ten deep. Every layer gets drawn for colour, for depth and for shadow, so the cost multiplies.

Close-up flawsThe wrist had a visible seam like a bracelet. Hair sat over the ears. Hair edges floated above the skin. Some caps looked like helmets. There were gaps at the back of the neck. Some beards covered the mouth by up to 2.3 centimetres.

Lighter charactersWe started with one test on Wulfstan: approved cards at 36,492 triangles against a single textured shell at about 4,000. Then the low-poly pass. Wulfstan went from 105,670 to 47,344. A typical hero went from about 93,000 to about 45,000. Background characters were cut harder, to 66 percent.

Hair rulesEvery mistake became a rule, and the tools check each rule automatically. With the rules written down, an overnight batch built fifteen new caps. Bedwyr went from his first overnight cap to version 24, the one we approved.

Review passTen steps per hero, one hero at a time. Five checks in Blender, a Blender sign-off, FBX export, Unreal import, an in-level check, and approval. The wrist seam was fixed here: three textures crossfade over 11 centimetres of the forearm, and the mesh did not change.

Final hair and clothesThe final hair is a hybrid: a shell plus strand cards only where they show. Wulfstan: approved cards 36,492, shell only 3,754, shell plus cards 7,030. One garment kit dressed fifteen characters. Cloaks run on Kawaii Physics, and covered skin is masked out.

LessonsMeasure before you polish. Give every part a budget. Turn every mistake into a rule. Review one character at a time. Keep the old version until the new one is approved.