@babylonjs-toolkit/agent 1.2.16 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +1 -1
- package/skills/bt-blender/SKILL.md +386 -0
- package/skills/bt-blender/THIRD_PARTY_NOTICES.md +141 -0
- package/skills/bt-blender/references/art-style-and-genre.md +173 -0
- package/skills/bt-blender/references/characters-and-creatures.md +644 -0
- package/skills/bt-blender/references/environments.md +478 -0
- package/skills/bt-blender/references/game-engine-export.md +284 -0
- package/skills/bt-blender/references/geometry-nodes.md +447 -0
- package/skills/bt-blender/references/hard-surface.md +720 -0
- package/skills/bt-blender/references/procedural-generation.md +358 -0
- package/skills/bt-blender/references/rigging-and-animation.md +1080 -0
- package/skills/bt-blender/references/sculpting-and-retopology.md +544 -0
- package/skills/bt-blender/references/uv-and-pbr-materials.md +381 -0
- package/skills/bt-blender/references/vehicles.md +632 -0
- package/skills/bt-blender/scripts/blender/assembly_check.py +420 -0
- package/skills/bt-blender/scripts/blender/character_blockout.py +462 -0
- package/skills/bt-blender/scripts/blender/construction_kit.py +1710 -0
- package/skills/bt-blender/scripts/blender/environment_kit.py +525 -0
- package/skills/bt-blender/scripts/blender/export_asset.py +623 -0
- package/skills/bt-blender/scripts/blender/geometry_nodes_builders.py +575 -0
- package/skills/bt-blender/scripts/blender/hard_surface_panels.py +374 -0
- package/skills/bt-blender/scripts/blender/hard_surface_trims.py +200 -0
- package/skills/bt-blender/scripts/blender/image_measure.py +568 -0
- package/skills/bt-blender/scripts/blender/materials_pbr.py +439 -0
- package/skills/bt-blender/scripts/blender/measure_stations.py +486 -0
- package/skills/bt-blender/scripts/blender/ortho_views.py +309 -0
- package/skills/bt-blender/scripts/blender/procedural_game_ready.py +258 -0
- package/skills/bt-blender/scripts/blender/procedural_generators.py +842 -0
- package/skills/bt-blender/scripts/blender/qa_check.py +729 -0
- package/skills/bt-blender/scripts/blender/retopology_tools.py +781 -0
- package/skills/bt-blender/scripts/blender/review_render.py +358 -0
- package/skills/bt-blender/scripts/blender/rigging_tools.py +1170 -0
- package/skills/bt-blender/scripts/blender/style_palette.py +190 -0
- package/skills/bt-blender/scripts/blender/tool_common.py +289 -0
- package/skills/bt-blender/scripts/blender/uv_layout.py +555 -0
- package/skills/bt-blender/scripts/blender/vehicle_parts.py +370 -0
- package/skills/bt-blender/scripts/blender/view_consistency.py +133 -0
- package/skills/bt-blender/scripts/blender/world_gate.py +219 -0
- package/skills/bt-blender/scripts/bt-blender.mjs +329 -0
- package/skills/bt-blender/scripts/validate_gltf.mjs +204 -0
- package/skills/bt-gauntlet/SKILL.md +6 -6
- package/skills/bt-gauntlet/references/critic-rubrics.md +71 -4
- package/skills/bt-gauntlet/references/spec-composition.md +13 -0
- package/skills/bt-gauntlet/references/unity-pipeline.md +18 -2
- package/skills/bt-unwrap/scripts/blender/__pycache__/bt_unwrap.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/image_utils.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/mesh_tools.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/model_io.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/previews.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/rasterizer.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/reference_views.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/reference_warp.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/texture_bake.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/texture_compose.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/uv_layout.cpython-313.pyc +0 -0
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
# Characters and creatures: proportions, blockouts, deformation topology, hands, faces, modular parts and LODs
|
|
2
|
+
|
|
3
|
+
**Load this when** the asset has a skeleton or will get one: player characters, NPCs, crowds, mascots,
|
|
4
|
+
animals, monsters, anything with limbs, a head or a tail. Load it for the reference sheet and proportions, the
|
|
5
|
+
blockout, the topology that has to bend, hands and faces at a game budget, modular (swappable) parts and LODs.
|
|
6
|
+
|
|
7
|
+
**What it assumes.** The Agent Reference's Blender guide (`references/unity-blender-cli.md`) covers the basics:
|
|
8
|
+
§8.4b for the brief, the reference registration, `measure-stations` and `world-gate`; §4 for skin weights;
|
|
9
|
+
§8.2a for the Unity export. `art-style-and-genre.md` §2 covers stylised versus realistic in general and §4 the
|
|
10
|
+
genre budgets. `sculpting-and-retopology.md` covers detail, retopology routes and baking; `rigging-and-animation.md`
|
|
11
|
+
covers the skeleton, weights and clips. This file goes deeper on what is specific to bodies.
|
|
12
|
+
|
|
13
|
+
**Helpers.** `scripts/blender/character_blockout.py` provides:
|
|
14
|
+
- `humanoid_chart` (a proportioned biped joint chart with Mixamo / Unity-Humanoid bone names) and `ChartBone`
|
|
15
|
+
for writing your own creature chart;
|
|
16
|
+
- `skin_blockout` and `metaball_blockout` (fused base meshes around a chart), `chart_graph`;
|
|
17
|
+
- `fit_height`, `scale_chart`, `world_extent` and `symmetry_error` for the proof.
|
|
18
|
+
|
|
19
|
+
`scripts/blender/retopology_tools.py` provides `voxel_remesh`, `quadriflow`, `decimate_to`, `topology_report`
|
|
20
|
+
and `surface_deviation`. The same chart builds the skeleton (`rigging_tools.build_armature`), so mesh and bones
|
|
21
|
+
agree by construction.
|
|
22
|
+
|
|
23
|
+
Every recipe below is a complete script. Run it with
|
|
24
|
+
`node <skill>/scripts/bt-blender.mjs run recipe.py <out folder>`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 1. The professional workflow
|
|
29
|
+
|
|
30
|
+
1. **Brief and reference sheet.** Front and side orthographic views at the same scale, in the rest pose the rig
|
|
31
|
+
will use (section 2), one ground line, the height written on the sheet. Register them as in guide §8.4b.
|
|
32
|
+
2. **Proportions as numbers.** Pick the head count and the landmarks (section 2) and write them into the chart.
|
|
33
|
+
Proportion errors cost the most to fix later, and every later stage inherits them.
|
|
34
|
+
3. **Blockout from the joint chart** (Skin modifier, metaballs or `sdf_inflate`), gated with `world-gate` and
|
|
35
|
+
`measure-stations` against the sheet before any detail. Judge the silhouette, not the surface.
|
|
36
|
+
4. **Voxel remesh** the blockout into one closed shell. It fuses overlapping parts and evens the density.
|
|
37
|
+
5. **Detail** (headless: multires plus displacement, `sculpting-and-retopology.md`). Big forms first; pores and
|
|
38
|
+
cloth folds belong in the normal map, not the mesh.
|
|
39
|
+
6. **Retopology to the budget**, with loops where the body bends (section 4). Check poles against the joints.
|
|
40
|
+
7. **UVs, bake, materials** (`sculpting-and-retopology.md` section 6; guide §8.4a).
|
|
41
|
+
8. **Rig and weights** (`rigging-and-animation.md`), then a deformation test: bend every joint to its range
|
|
42
|
+
and look at elbows, knees, shoulders, hips and the neck in `review-render`.
|
|
43
|
+
9. **Modular split and LODs** (section 8), then export (guide §8.2a for Unity, `rigging-and-animation.md` for glTF).
|
|
44
|
+
|
|
45
|
+
**What needs a person.** Headless Blender cannot run sculpt brushes or paint by eye. Faces with likeness or
|
|
46
|
+
expression, hand-placed edge loops on a hero character's shoulders and face, and weight painting judged by eye
|
|
47
|
+
are hand-offs: save the `.blend` at the stage before, name what needs doing (which joint, which loop, what is
|
|
48
|
+
wrong in which render), and continue the pipeline from the file the artist returns. Everything else in this file
|
|
49
|
+
runs headless.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2. Reference sheets and proportions
|
|
54
|
+
|
|
55
|
+
### Head units
|
|
56
|
+
|
|
57
|
+
A figure's height is measured in heads (chin to crown). Draw the sheet in head units, then scale to metres.
|
|
58
|
+
|
|
59
|
+
| Type | Heads tall | Head height (1.75 m figure) | Use |
|
|
60
|
+
|---|---|---|---|
|
|
61
|
+
| Realistic adult | 7.5 | 0.233 m | Realistic games, crowds |
|
|
62
|
+
| Idealised / fashion | 8 | 0.219 m | Heroes, more elegant |
|
|
63
|
+
| Heroic | 8.5 | 0.206 m | Gods and superheroes: the extra length is a bigger chest and longer legs |
|
|
64
|
+
| Stylised / comic | About 6 | 0.29 m | Most stylised action games; reads at distance |
|
|
65
|
+
| Cartoon | 3-5 | 0.35-0.58 m | Platformers, mascots, racers |
|
|
66
|
+
| Chibi / super-deformed | 2-4 | 0.44-0.88 m | Big head, readable face at tiny screen size |
|
|
67
|
+
|
|
68
|
+
The realistic, idealised and heroic counts are canon (Wikipedia, Body proportions; Loomis); the stylised
|
|
69
|
+
counts are conventions that sources disagree on (chibi is quoted as 2-4 and as 3-4).
|
|
70
|
+
|
|
71
|
+
### Landmarks (realistic adult, measured from the floor)
|
|
72
|
+
|
|
73
|
+
| Landmark | Where | Note |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| Half height | Greater trochanters, just above the pubic arch | Legs (floor to crotch) are 3.5-4 heads |
|
|
76
|
+
| Knee pivot | About 2 heads up | `humanoid_chart`: 1.95 body units |
|
|
77
|
+
| Nipples, navel, crotch | 1, 2 and 3 heads below the chin (Loomis) | The elbow sits level with the navel, arms down |
|
|
78
|
+
| Wrist | Level with the crotch, arms down | The hand reaches mid-thigh |
|
|
79
|
+
| Shoulder width | 2⅓ heads (Loomis ideal male); hips 1.5 heads | Clavicles run nearly horizontal |
|
|
80
|
+
| Hand length | The face's height (chin to hairline) | Arms are about 3 heads. Small-screen characters get bigger hands (Android / Arm) |
|
|
81
|
+
| Eye line | Half the head's height | Lower for "cute" (big forehead) |
|
|
82
|
+
|
|
83
|
+
Stylised and cartoon figures keep the head at its stylised size and scale the body as a human body: the chart
|
|
84
|
+
works in body units (floor to chin / 6.5), so a 3-head character gets a big head on a body with human joint
|
|
85
|
+
placement instead of a body inflated to the head size. Then exaggerate deliberately: larger hands and feet,
|
|
86
|
+
shorter upper arms, a wider stance (see `art-style-and-genre.md` §2).
|
|
87
|
+
|
|
88
|
+
### The rest pose on the sheet
|
|
89
|
+
|
|
90
|
+
| Rest pose | For | Against |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| **A-pose, arms 30-45 degrees down** | "May be more suitable for vertex deformation around the shoulders" (Wikipedia, T-pose): the shoulder travels about 45 degrees to either extreme instead of 90, so less crunch in the armpit | Unity Humanoid wants a T-pose for the avatar: set it with Enforce T-Pose or pose it in the avatar configuration |
|
|
93
|
+
| T-pose, arms horizontal | The most common: major parts axis-aligned, easy rigging; Unity Humanoid's reference pose | The shoulder region is modelled stretched; it collapses when the arms are down, which is most of the time |
|
|
94
|
+
| Relaxed bends at elbows and knees | IK solvers need a preferred bend direction; a dead-straight limb can flip | Modelling symmetry is unchanged, so always add a few degrees (`humanoid_chart`: elbow 8, knee 4) |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 3. Blockout: from a joint chart to a clean shell
|
|
99
|
+
|
|
100
|
+
| Method | What it makes | Best for | Measured (Blender 5.3.0) |
|
|
101
|
+
|---|---|---|---|
|
|
102
|
+
| **Skin modifier** (`skin_blockout`) | One fused, mostly-quad hull around a graph of joints with per-joint radii | Bipeds, limbs, tails, anything branching; the chart is also the skeleton | 0.4 s for a biped. Folds at a 4-way junction and up to 4 cm asymmetry on a 1.75 m body: always voxel-remesh after |
|
|
103
|
+
| **Metaballs** (`metaball_blockout`) | A blobby implicit surface, converted to triangles | Soft masses: bellies, cartoon bodies, slimes, muscle groups melting together | Fields grow past the chart: a 1.75 m chart gave a 2.04 m blob. Fit the height after |
|
|
104
|
+
| **SDF inflate** (`construction_kit.sdf_inflate`) | A rounded solid from one side-view mask | Heads, muzzles, shells, carapaces, helmets: forms defined by a profile | Dense: decimate it or use it as a shrinkwrap / bake target |
|
|
105
|
+
| **Primitives + voxel remesh** | Spheres, capsules and loft sections fused by remesh | Quick creature parts, armour plates | Union is free: the remesh fuses overlaps |
|
|
106
|
+
|
|
107
|
+
Then **voxel remesh** at about 1/175 of the height (1 cm on a 1.75 m figure): manifold, even quads, overlaps
|
|
108
|
+
fused. It destroys UVs, vertex groups and shape keys, so remesh before any of those exist. Then retopologise.
|
|
109
|
+
|
|
110
|
+
### Recipe: the character test asset (chart, Skin blockout, remesh, QuadriFlow at 5k)
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
"""Character test asset: a 1.75 m, 7.5-head biped in a 45-degree A-pose. Joint chart -> Skin blockout ->
|
|
114
|
+
voxel remesh -> symmetric QuadriFlow at a 5k-triangle budget -> height fitted, UVs, one material. Saves
|
|
115
|
+
character.blend and prints the topology at each stage."""
|
|
116
|
+
import json
|
|
117
|
+
import os
|
|
118
|
+
import sys
|
|
119
|
+
|
|
120
|
+
import bpy
|
|
121
|
+
|
|
122
|
+
import character_blockout as blockout
|
|
123
|
+
import construction_kit as kit
|
|
124
|
+
import retopology_tools as retopo
|
|
125
|
+
|
|
126
|
+
out_folder = sys.argv[sys.argv.index("--") + 1]
|
|
127
|
+
HEIGHT = 1.75 # metres, floor to the top of the skull
|
|
128
|
+
HEADS = 7.5 # realistic canon; 5-6 stylised, 2-4 chibi
|
|
129
|
+
ARM_ANGLE = 45.0 # A-pose: the shoulders deform better than in a T-pose
|
|
130
|
+
VOXEL_SIZE = HEIGHT / 175.0 # 1 cm: keeps the blockout's forms, fuses every overlap
|
|
131
|
+
TRIANGLE_BUDGET = 5000 # web hero / third-person character, LOD0
|
|
132
|
+
JOINT_RADIUS = 0.03 # a pole closer than this to an elbow, knee, shoulder or hip is flagged
|
|
133
|
+
|
|
134
|
+
kit.clear_default_scene()
|
|
135
|
+
chart = blockout.humanoid_chart(height=HEIGHT, heads=HEADS, arm_angle_degrees=ARM_ANGLE)
|
|
136
|
+
body = blockout.skin_blockout("Body", chart)
|
|
137
|
+
stages = {"skin": retopo.topology_report(body)}
|
|
138
|
+
stages["voxel"] = retopo.voxel_remesh(body, voxel_size=VOXEL_SIZE)
|
|
139
|
+
stages["quadriflow"] = retopo.quadriflow(body, target_triangles=TRIANGLE_BUDGET, symmetry_axes=("X",))
|
|
140
|
+
# Remeshing shrinks or grows the surface a little: fit the measured height back to the brief, and move the
|
|
141
|
+
# chart by the same factor so the skeleton built from it still sits inside the mesh.
|
|
142
|
+
height_factor = blockout.fit_height(body, HEIGHT)
|
|
143
|
+
chart = blockout.scale_chart(chart, height_factor)
|
|
144
|
+
kit.smart_unwrap(body)
|
|
145
|
+
body.data.materials.append(bpy.data.materials.new("Body_Skin"))
|
|
146
|
+
joints = [bone.head for bone in chart if bone.name.endswith(("Arm", "ForeArm", "UpLeg", "Leg"))]
|
|
147
|
+
stages["final"] = retopo.topology_report(body, joints=joints, joint_radius=JOINT_RADIUS)
|
|
148
|
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(out_folder, "character.blend"))
|
|
149
|
+
print(json.dumps({"stages": stages, "height_factor": round(height_factor, 4),
|
|
150
|
+
"symmetry_error_m": blockout.symmetry_error(body),
|
|
151
|
+
"extent_m": [round(value, 4) for value in blockout.world_extent(body).ravel()]}))
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Measured: Skin cage 6,288 triangles (46 poles); voxel remesh 53,928 triangles, manifold; QuadriFlow 4,500-4,600
|
|
155
|
+
triangles, all quads, manifold, symmetric, no pole within 3 cm of a limb joint; height refit by 0.4 %.
|
|
156
|
+
`qa-check --profile web` and `assembly-check` pass on `character.blend`.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 4. Topology that deforms
|
|
161
|
+
|
|
162
|
+
The rules every production follows (Polycount topology pages; the shoulder and face pages):
|
|
163
|
+
|
|
164
|
+
- **Rings around every limb**, perpendicular to the bone. Topology matters most at the hips and groin, the
|
|
165
|
+
shoulders and armpits, the mouth corners and cheeks, knees, elbows and hands (Polycount). The working rule is
|
|
166
|
+
**3 loops** across a joint (one on the pivot, one each side); a common refinement is 2-3 tight rings on the
|
|
167
|
+
crease side and 1-2 broader ones on the stretch side. These counts are practitioner consensus, not a
|
|
168
|
+
published standard. A low-poly mesh can bend on a single edge if the pivot sits exactly on it.
|
|
169
|
+
- **Loops do not fix volume loss.** The inside of a bend loses volume because of linear blend skinning
|
|
170
|
+
itself; production rigs add helper (support) joints and corrective shapes (God of War Ragnarok's joint-based
|
|
171
|
+
deformation talk). glTF and FBX carry linear blend weights only, so Blender's Preserve Volume does not survive
|
|
172
|
+
export.
|
|
173
|
+
- **Density where the shape changes when it bends**: the inside of the elbow and knee, the armpit, the groin,
|
|
174
|
+
the mouth corners. Straight shins and forearms need few loops.
|
|
175
|
+
- **Poles (vertices with 3 or 5+ edges) away from joints.** A pole on a pivot pinches. Put them on flat,
|
|
176
|
+
non-deforming areas: the chest, the back, the side of the skull.
|
|
177
|
+
- **Shoulder**: loops around the arm meet loops running over the deltoid and down the chest; the armpit needs
|
|
178
|
+
a loop that can fold. A-pose modelling halves the stretch.
|
|
179
|
+
- **Hips and groin**: the leg rings must merge into the torso without a pole in the crease.
|
|
180
|
+
- **Face**: edges run parallel and perpendicular to the expected deformation: concentric rings all the way
|
|
181
|
+
around the eyes (at least two: lid border and socket) and the mouth, extra resolution at the nasolabial fold
|
|
182
|
+
and the crow's feet, poles ("stars") walked onto the flat cheek planes (Autodesk, face modelling).
|
|
183
|
+
- **Game reality**: "triangles are fine, but you want every edge to be there for a reason" (Polycount):
|
|
184
|
+
triangles on areas that never deform (a helmet, a buckle), and silhouette edges earn the budget.
|
|
185
|
+
- **Manual retopology costs 16-80 hours per character** (80.lv, Metro Exodus breakdown): that is the hand-off
|
|
186
|
+
this file's headless routes replace for everything short of a hero face.
|
|
187
|
+
|
|
188
|
+
| Route | Where the loops come from | Headless? |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| QuadriFlow (`quadriflow`) | A cross field aligned to curvature: rings around limbs, but no extra loops at joints, and poles wherever the field needs them | Yes. Check `topology_report(joints=...)`: 0 poles at joints on the test asset |
|
|
191
|
+
| Skin cage + shrinkwrap | One ring per chart point, poles only at branch points: the loop layout a rigger wants. Add chart points at joints for more loops | Yes (`sculpting-and-retopology.md` section 4) |
|
|
192
|
+
| Manual retopology | Every loop placed by intent | **No**: hand off the high poly and the cage; continue from the returned mesh |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 5. Stylised versus realistic characters
|
|
197
|
+
|
|
198
|
+
| Decision | Stylised | Realistic |
|
|
199
|
+
|---|---|---|
|
|
200
|
+
| Head count | 2-6 heads; a big head carries the expression at game distance | 7-8.5 heads, from measured reference |
|
|
201
|
+
| Silhouette | Read from the shape alone at play size: exaggerated shoulders, hands, feet, hair masses | Correct anatomy first |
|
|
202
|
+
| Topology | Fewer, cleaner loops; big smooth forms; often under 5k triangles (80.lv, Elwood) | Muscle-following loops, more density at joints |
|
|
203
|
+
| Faces | Painted or texture-swapped eyes and mouths, a few shape keys | Facial rig (bones and/or 50+ blendshapes); hand-off for likeness |
|
|
204
|
+
| Hands | Mittens or 3 fingers and a thumb | 5 fingers, knuckle loops |
|
|
205
|
+
| Detail | In the texture (hand-painted) | In the normal map from a sculpt |
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 6. Creature anatomy
|
|
210
|
+
|
|
211
|
+
Build the creature's skeleton chart from real anatomy, even for a fantasy creature: the eye believes joints that
|
|
212
|
+
fold the way an animal's do.
|
|
213
|
+
|
|
214
|
+
| Stance | Stands on | Examples | Chart consequence |
|
|
215
|
+
|---|---|---|---|
|
|
216
|
+
| Plantigrade | The whole foot, heel down | Humans, bears, apes | Ankle near the ground; human-like leg |
|
|
217
|
+
| **Digitigrade** | The toes, heel (hock) high | Dogs, cats, birds, most fantasy beasts | Three long segments: thigh forward-down, shin back-down, metatarsus nearly vertical to the toes. The "backward knee" is the ankle |
|
|
218
|
+
| Unguligrade | The tip of the toe (hoof) | Horses, deer, goats | Like digitigrade with a longer metatarsus and a single hoof |
|
|
219
|
+
|
|
220
|
+
- **Forelimbs**: the scapula is not fixed; it slides on the ribcage (give it its own bone). The elbow points
|
|
221
|
+
back, the wrist is low; the upper arm is mostly hidden inside the body outline.
|
|
222
|
+
- **The spine** carries the motion: arch and flex, so give it 3-5 segments plus a neck of 2-3 for long necks.
|
|
223
|
+
- **Tails** are chains of 3-8 segments (more for prehensile tails), thick at the root, tapering.
|
|
224
|
+
- **Wings** are arms: humerus, forearm, a long hand. Membrane wings hang between the fingers.
|
|
225
|
+
- **Six limbs and more**: one shoulder girdle per pair; keep pairs mirrored so `mirror_report` still applies.
|
|
226
|
+
- **Size**: the withers (top of the shoulder blades) is the standard height measure for quadrupeds.
|
|
227
|
+
|
|
228
|
+
### Recipe: a digitigrade quadruped from a hand-written chart
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
"""Creature test asset: a digitigrade quadruped (dog-like, 0.6 m at the withers) from a hand-written joint
|
|
232
|
+
chart. Spine, neck, head and tail on the centre line; scapula-humerus-radius-metacarpus-toe forelegs and
|
|
233
|
+
femur-tibia-metatarsus-toe hind legs that stand on the toes with the hock (heel) high. Skin blockout ->
|
|
234
|
+
voxel remesh -> symmetric QuadriFlow at 3k triangles. Saves creature.blend."""
|
|
235
|
+
import json
|
|
236
|
+
import os
|
|
237
|
+
import sys
|
|
238
|
+
|
|
239
|
+
import bpy
|
|
240
|
+
|
|
241
|
+
import character_blockout as blockout
|
|
242
|
+
import construction_kit as kit
|
|
243
|
+
import retopology_tools as retopo
|
|
244
|
+
|
|
245
|
+
out_folder = sys.argv[sys.argv.index("--") + 1]
|
|
246
|
+
WITHERS_HEIGHT = 0.6 # top of the shoulder blades, the standard quadruped size measure
|
|
247
|
+
VOXEL_SIZE = 0.006
|
|
248
|
+
TRIANGLE_BUDGET = 3000 # background creature; a hero creature takes 5-15k
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def joint(x, y, z):
|
|
252
|
+
"""A chart point in withers units: x across, y along the body (head at -Y), z up."""
|
|
253
|
+
return (round(x * WITHERS_HEIGHT, 6), round(y * WITHERS_HEIGHT, 6), round(z * WITHERS_HEIGHT, 6))
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def ring(radius_across, radius_up=None):
|
|
257
|
+
"""A skin radius pair in withers units."""
|
|
258
|
+
return (radius_across * WITHERS_HEIGHT, (radius_up or radius_across) * WITHERS_HEIGHT)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
Bone = blockout.ChartBone
|
|
262
|
+
chart = [
|
|
263
|
+
Bone("Hips", joint(0, 0.45, 0.88), joint(0, 0.2, 0.92), None, False, ring(0.17, 0.2), ring(0.16, 0.2)),
|
|
264
|
+
Bone("Spine", joint(0, 0.2, 0.92), joint(0, -0.05, 0.92), "Hips", True, ring(0.16, 0.2), ring(0.19, 0.25)),
|
|
265
|
+
Bone("Chest", joint(0, -0.05, 0.92), joint(0, -0.3, 0.92), "Spine", True, ring(0.19, 0.25), ring(0.17, 0.26)),
|
|
266
|
+
Bone("Neck", joint(0, -0.3, 0.92), joint(0, -0.5, 1.15), "Chest", True, ring(0.12, 0.15), ring(0.09, 0.1)),
|
|
267
|
+
Bone("Head", joint(0, -0.5, 1.15), joint(0, -0.8, 1.08), "Neck", True, ring(0.14, 0.16), ring(0.07, 0.07)),
|
|
268
|
+
Bone("Tail", joint(0, 0.45, 0.88), joint(0, 0.7, 0.92), "Hips", True, ring(0.06), ring(0.04)),
|
|
269
|
+
Bone("Tail1", joint(0, 0.7, 0.92), joint(0, 0.95, 0.8), "Tail", True, ring(0.04), ring(0.02)),
|
|
270
|
+
]
|
|
271
|
+
for side, sign in (("Left", 1.0), ("Right", -1.0)):
|
|
272
|
+
# Forelimb: the scapula slides on the ribcage, the elbow points back, the wrist sits low.
|
|
273
|
+
chart += [
|
|
274
|
+
Bone(f"{side}Scapula", joint(sign * 0.1, -0.2, 0.92), joint(sign * 0.14, -0.33, 0.68), "Chest", False,
|
|
275
|
+
ring(0.08), ring(0.08)),
|
|
276
|
+
Bone(f"{side}UpperArm", joint(sign * 0.14, -0.33, 0.68), joint(sign * 0.14, -0.25, 0.45), f"{side}Scapula",
|
|
277
|
+
True, ring(0.08), ring(0.06)),
|
|
278
|
+
Bone(f"{side}ForeArm", joint(sign * 0.14, -0.25, 0.45), joint(sign * 0.14, -0.27, 0.12), f"{side}UpperArm",
|
|
279
|
+
True, ring(0.055), ring(0.04)),
|
|
280
|
+
Bone(f"{side}Wrist", joint(sign * 0.14, -0.27, 0.12), joint(sign * 0.14, -0.3, 0.04), f"{side}ForeArm", True,
|
|
281
|
+
ring(0.04), ring(0.045)),
|
|
282
|
+
Bone(f"{side}FrontToe", joint(sign * 0.14, -0.3, 0.04), joint(sign * 0.14, -0.38, 0.03), f"{side}Wrist", True,
|
|
283
|
+
ring(0.045), ring(0.035)),
|
|
284
|
+
]
|
|
285
|
+
# Hind limb (digitigrade): knee forward, hock (heel) high and back, the animal stands on its toes.
|
|
286
|
+
chart += [
|
|
287
|
+
Bone(f"{side}Thigh", joint(sign * 0.12, 0.38, 0.8), joint(sign * 0.14, 0.26, 0.52), "Hips", False,
|
|
288
|
+
ring(0.11), ring(0.07)),
|
|
289
|
+
Bone(f"{side}Shin", joint(sign * 0.14, 0.26, 0.52), joint(sign * 0.14, 0.4, 0.26), f"{side}Thigh", True,
|
|
290
|
+
ring(0.065), ring(0.04)),
|
|
291
|
+
Bone(f"{side}Hock", joint(sign * 0.14, 0.4, 0.26), joint(sign * 0.14, 0.37, 0.04), f"{side}Shin", True,
|
|
292
|
+
ring(0.04), ring(0.045)),
|
|
293
|
+
Bone(f"{side}HindToe", joint(sign * 0.14, 0.37, 0.04), joint(sign * 0.14, 0.29, 0.03), f"{side}Hock", True,
|
|
294
|
+
ring(0.045), ring(0.035)),
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
kit.clear_default_scene()
|
|
298
|
+
creature = blockout.skin_blockout("Creature", chart, root_bone="Hips")
|
|
299
|
+
blockout.fit_height(creature, 1.0 * WITHERS_HEIGHT + 0.25 * WITHERS_HEIGHT) # ears-free head top over the withers
|
|
300
|
+
remesh = retopo.voxel_remesh(creature, voxel_size=VOXEL_SIZE)
|
|
301
|
+
quads = retopo.quadriflow(creature, target_triangles=TRIANGLE_BUDGET, symmetry_axes=("X",))
|
|
302
|
+
kit.smart_unwrap(creature)
|
|
303
|
+
creature.data.materials.append(bpy.data.materials.new("Creature_Fur"))
|
|
304
|
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(out_folder, "creature.blend"))
|
|
305
|
+
print(json.dumps({"bones": len(chart), "voxel": remesh, "quadriflow": quads,
|
|
306
|
+
"topology": retopo.topology_report(creature),
|
|
307
|
+
"extent_m": [round(value, 4) for value in blockout.world_extent(creature).ravel()]}))
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Measured: 25 chart bones; voxel remesh about 70k triangles, manifold; QuadriFlow about 1.9-2.7k triangles,
|
|
311
|
+
manifold. On this shape the symmetric solve sometimes never welds (the seam runs along a thin crest), and
|
|
312
|
+
`quadriflow` then falls back to a whole-mesh solve and reports `"symmetric": false`: still manifold, topology
|
|
313
|
+
only approximately mirrored. Sharp zig-zags between neighbouring chart segments twist the Skin hull; keep
|
|
314
|
+
consecutive segments within about 90 degrees of each other and the radii generous, and look at the review
|
|
315
|
+
render before remeshing.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 7. Hands and faces at game budgets
|
|
320
|
+
|
|
321
|
+
No published source gives hand or face triangle counts; the tiers below are *working defaults*. The data points
|
|
322
|
+
behind them: a 1,420-triangle mobile hand was judged too much for a small on-screen character (Polycount
|
|
323
|
+
forum); mobile characters often have 1 loop per knuckle, mid-poly work 2-3; a face cage of about 2,000
|
|
324
|
+
polygons plus one subdivision, or about 10k quads for quality (Autodesk, face modelling). HUNT: Showdown spends
|
|
325
|
+
a 1024 face texture but 4096 x 2048 on the hands, because hands fill a first-person view (CRYENGINE).
|
|
326
|
+
|
|
327
|
+
| Tier | Hands | Faces | Triangles (both hands / face), *starting point* |
|
|
328
|
+
|---|---|---|---|
|
|
329
|
+
| Far crowd, mobile | Mitten: one block, a thumb | Painted; no mouth geometry | 50-150 / 100-300 |
|
|
330
|
+
| Stylised hero, web | 3 fingers and a thumb, or 4 fingers merged in pairs | Painted or swapped eye / mouth textures, a few shape keys | 300-800 / 500-1,500 |
|
|
331
|
+
| Realistic third person | 5 fingers, 2-3 loops per knuckle | Loops around eyes and mouth, a mouth bag, eyelids | 1,000-2,000 / 2,000-4,000 |
|
|
332
|
+
| Cinematic / first-person hands | 5 fingers with knuckle detail, nails | Full facial loops, 50+ blendshapes or a face rig | 2,000-6,000 / 4,000-20,000 |
|
|
333
|
+
|
|
334
|
+
- **Fingers** need three loops per knuckle on the palm side (the side that folds), fewer on the back. Model
|
|
335
|
+
hands in a relaxed half-curl so both a fist and an open hand deform from the middle.
|
|
336
|
+
- **Finger bones** cost: a 5-finger hand is 15-20 bones per side. Far LODs drop them (section 8) and Unity's
|
|
337
|
+
Humanoid treats fingers as optional.
|
|
338
|
+
- **Eyes** are separate spheres (or textured cards on a stylised face) so they rotate; give them their own bones
|
|
339
|
+
or animate the UV offset. A floating eye sphere is a separate island: bind it rigidly to the head bone
|
|
340
|
+
(`rigging-and-animation.md` section 4 measures bone heat skipping such islands).
|
|
341
|
+
- **Mouths** that open need a mouth bag (an inner cavity) and teeth; mouths that never open are paint.
|
|
342
|
+
- **Headless limits**: `humanoid_chart` ends the arm at the hand; for fingers add `ChartBone`s (3 phalanges per
|
|
343
|
+
finger) to the chart before `skin_blockout`, which then grows them. Facial loops for expressions are a manual
|
|
344
|
+
retopology hand-off on hero faces; shape keys can be generated from offsets (`rigging_tools.add_shape_key`).
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## 8. Modular characters and LODs
|
|
349
|
+
|
|
350
|
+
**Modular parts** (heads, torsos, legs, gear swapped at runtime) must meet without a crack or a shading line:
|
|
351
|
+
|
|
352
|
+
1. **Split on a loop that both parts keep**: neck, waist, wrists, ankles, or a clothing line that hides the seam.
|
|
353
|
+
2. **The seam vertices are identical** in both parts: same positions, same order of edges, same weights.
|
|
354
|
+
3. **Copy the seam normals from the uncut body.** Each part computes its own normals from its own faces, so the
|
|
355
|
+
two sides of a seam disagree. Measured on the test asset: 33 degrees of disagreement at the neck before,
|
|
356
|
+
0.03 degrees after copying.
|
|
357
|
+
4. **One skeleton.** The main mesh carries the full skeleton; parts use the same joints and never add or
|
|
358
|
+
skip one (Unreal's Leader Pose rule). Same bind pose everywhere. BabylonJS and Unity cannot share one
|
|
359
|
+
skeleton across skinned meshes with different transforms, so keep every part at the same transform.
|
|
360
|
+
5. **Hide what clothing covers**: delete body faces under a fixed outfit; mask them per outfit with vertex
|
|
361
|
+
groups when outfits swap. Expect a little clipping at the edges.
|
|
362
|
+
6. **Draw calls**: every part is a draw per material per pass. Unreal's numbers: 3 parts x 50 characters is
|
|
363
|
+
150 draws, merged into one mesh with one atlas material it is 50. Merge parts that never swap.
|
|
364
|
+
|
|
365
|
+
The recipe below fixes the seam in Python. The modifier route does the same: a Data Transfer
|
|
366
|
+
modifier (Face Corner Data, Custom Normals, "Nearest Corner and Best Matching Face Normal") limited to a
|
|
367
|
+
vertex group holding only the seam vertices, with the uncut body as the source (the method the BG3 modding
|
|
368
|
+
wiki documents for head / body neck seams).
|
|
369
|
+
|
|
370
|
+
**LODs** for skinned characters:
|
|
371
|
+
|
|
372
|
+
| Level | Triangles | Bones / influences | What goes |
|
|
373
|
+
|---|---|---|---|
|
|
374
|
+
| LOD0 | Budget (section 9) | All, 4 influences | Nothing |
|
|
375
|
+
| LOD1 | About 50 % | All, 4 (2 is enough far away) | Interior loops, small accessories |
|
|
376
|
+
| LOD2 | About 25 % | Drop finger and face bones | Fingers merged into mittens, mouth geometry |
|
|
377
|
+
| LOD3 / impostor | About 10 % or a billboard | 1-2 per vertex, or none | Everything but the silhouette |
|
|
378
|
+
|
|
379
|
+
Arm's guidance is about 50 % fewer triangles per level; neither Unity nor BabylonJS publishes default switch
|
|
380
|
+
distances. Decimation keeps the vertex groups, so a decimated skinned LOD stays bound; run
|
|
381
|
+
`make_engine_legal` on it. In BabylonJS use `mesh.addLODLevel(distance, lodMesh)` (`useLODScreenCoverage` for
|
|
382
|
+
0-1 screen coverage; `null` culls). In Unity use an LOD Group (it switches on screen-height percentage) with
|
|
383
|
+
one skinned mesh per level: Unity 6's automatic Mesh LOD ignores skin weights and blend shapes and still
|
|
384
|
+
deforms LOD0 on skinned meshes, so it saves nothing on a character.
|
|
385
|
+
|
|
386
|
+
### Recipe: a modular head / body split with matched seam normals, and an LOD chain
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
"""Modular character and LODs. The biped is cut into a swappable head and body at a ring around the neck: both
|
|
390
|
+
parts share the seam vertices exactly, and the seam normals are copied from the uncut body so no shading
|
|
391
|
+
line shows where they meet. Then an LOD chain at 50 % per level. Saves modular.blend."""
|
|
392
|
+
import json
|
|
393
|
+
import math
|
|
394
|
+
import os
|
|
395
|
+
import sys
|
|
396
|
+
|
|
397
|
+
import bmesh
|
|
398
|
+
import bpy
|
|
399
|
+
import numpy as np
|
|
400
|
+
from mathutils import Vector
|
|
401
|
+
|
|
402
|
+
import character_blockout as blockout
|
|
403
|
+
import construction_kit as kit
|
|
404
|
+
import retopology_tools as retopo
|
|
405
|
+
|
|
406
|
+
out_folder = sys.argv[sys.argv.index("--") + 1]
|
|
407
|
+
HEIGHT = 1.75
|
|
408
|
+
TRIANGLE_BUDGET = 5000
|
|
409
|
+
LOD_SHARES = (0.5, 0.25) # LOD1 and LOD2 as shares of LOD0: about 50 % per level
|
|
410
|
+
SEAM_HEIGHT_SHARE = 0.84 # the neck cut, as a share of the height (under the jaw, over the collar)
|
|
411
|
+
SEAM_TOLERANCE = 1e-6 # metres: a seam vertex of one part matches one of the other this closely
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
def build_body():
|
|
415
|
+
"""The character test asset's mesh: chart, Skin blockout, voxel remesh, symmetric QuadriFlow."""
|
|
416
|
+
chart = blockout.humanoid_chart(height=HEIGHT)
|
|
417
|
+
body = blockout.skin_blockout("Body", chart)
|
|
418
|
+
retopo.voxel_remesh(body, voxel_size=HEIGHT / 175.0)
|
|
419
|
+
retopo.quadriflow(body, target_triangles=TRIANGLE_BUDGET, symmetry_axes=("X",))
|
|
420
|
+
blockout.fit_height(body, HEIGHT)
|
|
421
|
+
return body
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
def cut_ring(obj, height):
|
|
425
|
+
"""Inserts one edge ring at a height (a horizontal plane cut), so both parts end on the same vertices."""
|
|
426
|
+
edit_mesh = bmesh.new()
|
|
427
|
+
edit_mesh.from_mesh(obj.data)
|
|
428
|
+
geometry = edit_mesh.verts[:] + edit_mesh.edges[:] + edit_mesh.faces[:]
|
|
429
|
+
bmesh.ops.bisect_plane(edit_mesh, geom=geometry, plane_co=(0.0, 0.0, height), plane_no=(0.0, 0.0, 1.0))
|
|
430
|
+
edit_mesh.to_mesh(obj.data)
|
|
431
|
+
edit_mesh.free()
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
def split_part(source, name, keep_above, height):
|
|
435
|
+
"""A copy of the source keeping only the faces above (or below) the cut height."""
|
|
436
|
+
part = source.copy()
|
|
437
|
+
part.data = source.data.copy()
|
|
438
|
+
part.name = part.data.name = name
|
|
439
|
+
bpy.context.scene.collection.objects.link(part)
|
|
440
|
+
edit_mesh = bmesh.new()
|
|
441
|
+
edit_mesh.from_mesh(part.data)
|
|
442
|
+
doomed = [face for face in edit_mesh.faces if (face.calc_center_median().z > height) != keep_above]
|
|
443
|
+
bmesh.ops.delete(edit_mesh, geom=doomed, context="FACES")
|
|
444
|
+
edit_mesh.to_mesh(part.data)
|
|
445
|
+
edit_mesh.free()
|
|
446
|
+
return part
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
def vertex_normals(obj):
|
|
450
|
+
"""Vertex normals of a mesh (object space), from its own faces."""
|
|
451
|
+
return np.array([vertex.normal[:] for vertex in obj.data.vertices])
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def seam_pairs(first, second):
|
|
455
|
+
"""Index pairs of the vertices the two parts share on the seam."""
|
|
456
|
+
tree_points = np.array([vertex.co[:] for vertex in second.data.vertices])
|
|
457
|
+
pairs = []
|
|
458
|
+
for vertex in first.data.vertices:
|
|
459
|
+
distances = np.linalg.norm(tree_points - np.array(vertex.co[:]), axis=1)
|
|
460
|
+
nearest = int(np.argmin(distances))
|
|
461
|
+
if distances[nearest] <= SEAM_TOLERANCE:
|
|
462
|
+
pairs.append((vertex.index, nearest))
|
|
463
|
+
return pairs
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
def seam_normal_error(first, second, pairs, first_normals, second_normals):
|
|
467
|
+
"""Largest angle, degrees, between the two parts' normals at the shared seam vertices."""
|
|
468
|
+
worst = 0.0
|
|
469
|
+
for first_index, second_index in pairs:
|
|
470
|
+
cosine = float(np.clip(np.dot(first_normals[first_index], second_normals[second_index]), -1.0, 1.0))
|
|
471
|
+
worst = max(worst, math.degrees(math.acos(cosine)))
|
|
472
|
+
return round(worst, 3)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
def open_vertices(part):
|
|
476
|
+
"""Indices of the vertices on open (boundary) edges: the seam of a cut part."""
|
|
477
|
+
edit_mesh = bmesh.new()
|
|
478
|
+
edit_mesh.from_mesh(part.data)
|
|
479
|
+
indices = {vertex.index for edge in edit_mesh.edges if edge.is_boundary for vertex in edge.verts}
|
|
480
|
+
edit_mesh.free()
|
|
481
|
+
return indices
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def copy_seam_normals(part, whole):
|
|
485
|
+
"""Gives every seam vertex of a part the uncut body's vertex normal, as custom split normals."""
|
|
486
|
+
whole_points = np.array([vertex.co[:] for vertex in whole.data.vertices])
|
|
487
|
+
whole_normals = vertex_normals(whole)
|
|
488
|
+
normals = vertex_normals(part)
|
|
489
|
+
for index in open_vertices(part):
|
|
490
|
+
distances = np.linalg.norm(whole_points - np.array(part.data.vertices[index].co[:]), axis=1)
|
|
491
|
+
nearest = int(np.argmin(distances))
|
|
492
|
+
if distances[nearest] <= SEAM_TOLERANCE:
|
|
493
|
+
normals[index] = whole_normals[nearest]
|
|
494
|
+
part.data.normals_split_custom_set_from_vertices([Vector(normal) for normal in normals])
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def corner_normals(obj):
|
|
498
|
+
"""Per-vertex normal as rendered (the first corner's split normal), unit length."""
|
|
499
|
+
normals = vertex_normals(obj)
|
|
500
|
+
for loop in obj.data.loops:
|
|
501
|
+
normals[loop.vertex_index] = loop.normal[:]
|
|
502
|
+
return normals
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
kit.clear_default_scene()
|
|
506
|
+
whole = build_body()
|
|
507
|
+
cut_ring(whole, SEAM_HEIGHT_SHARE * HEIGHT)
|
|
508
|
+
head = split_part(whole, "Head", True, SEAM_HEIGHT_SHARE * HEIGHT)
|
|
509
|
+
torso = split_part(whole, "Torso", False, SEAM_HEIGHT_SHARE * HEIGHT)
|
|
510
|
+
pairs = seam_pairs(head, torso)
|
|
511
|
+
report = {"seam_vertices": len(pairs),
|
|
512
|
+
"seam_error_before_degrees": seam_normal_error(head, torso, pairs, vertex_normals(head), vertex_normals(torso))}
|
|
513
|
+
for part in (head, torso):
|
|
514
|
+
copy_seam_normals(part, whole)
|
|
515
|
+
report["seam_error_after_degrees"] = seam_normal_error(head, torso, pairs, corner_normals(head), corner_normals(torso))
|
|
516
|
+
|
|
517
|
+
lods = {"LOD0": retopo.triangle_count(whole)}
|
|
518
|
+
for level, share in enumerate(LOD_SHARES, start=1):
|
|
519
|
+
lod = whole.copy()
|
|
520
|
+
lod.data = whole.data.copy()
|
|
521
|
+
lod.name = f"Body_LOD{level}"
|
|
522
|
+
bpy.context.scene.collection.objects.link(lod)
|
|
523
|
+
retopo.decimate_to(lod, int(lods["LOD0"] * share), symmetry_axis="X")
|
|
524
|
+
lods[lod.name] = {"triangles": retopo.triangle_count(lod),
|
|
525
|
+
"deviation": retopo.surface_deviation(lod, whole)["high_to_low"]}
|
|
526
|
+
whole.name = "Body_LOD0"
|
|
527
|
+
report["lods"] = lods
|
|
528
|
+
for obj in bpy.data.objects:
|
|
529
|
+
kit.smart_unwrap(obj)
|
|
530
|
+
obj.data.materials.append(bpy.data.materials.get("Body_Skin") or bpy.data.materials.new("Body_Skin"))
|
|
531
|
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(out_folder, "modular.blend"))
|
|
532
|
+
print(json.dumps(report))
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
Measured: 42 shared seam vertices; seam normal disagreement 33.1 degrees before, 0.03 after; LOD1 2,346
|
|
536
|
+
triangles (high-to-low deviation p95 0.7 mm), LOD2 1,172 (p95 2.0 mm, max 5.7 mm) from a 4,696-triangle LOD0.
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## 9. Budgets (web and BabylonJS first)
|
|
541
|
+
|
|
542
|
+
| Item | Web / mobile | Desktop web / console | Notes |
|
|
543
|
+
|---|---|---|---|
|
|
544
|
+
| Hero / player character, LOD0 | 3-10k tris | 10-30k | Stylised characters are often under 5k with 1024 textures (Elwood, 80.lv). Half-Life 2 characters were 2.5-5k, PS3-era 5-7k (Unity 4.6 manual). AAA heroes: 35-70k LOD0, 5-8k LOD3 (CRYENGINE, HUNT: Showdown) |
|
|
545
|
+
| NPC / enemy | 1.5-5k | 5-15k | HUNT grunts 25-35k LOD0. Many on screen: count the total |
|
|
546
|
+
| Crowd member | 300-1,500 | 1-3k | Arm's army demo: 360-triangle soldiers. Instanced or vertex-animated (bt-optimize) |
|
|
547
|
+
| Creature, background / hero | 2-5k / 5-15k | 5-15k / 20-50k | HUNT bosses 25-45k |
|
|
548
|
+
| Deform bones | Under 30 (Unity 4.6, mobile) | 15-60 (Unity 4.6, desktop); 60-100 standard, 100-200+ AAA hero (one industry guide) | Each bone costs: 15 more on a 30-bone rig is 50 % more work (Unity). Mixamo: 65 with fingers |
|
|
549
|
+
| Influences per vertex | 4 (BabylonJS default, glTF JOINTS_0, Unity's default) | 8 maximum in BabylonJS (JOINTS_1) | BabylonJS drops to 3 on low-end hardware |
|
|
550
|
+
| Skinned meshes per character | 1 | 1-2 | Two skinned meshes "could roughly double the rendering time" (Unity) |
|
|
551
|
+
| Materials per character | 1-2 | 2-3 (Unity 4.6) | Each is a draw per pass: shadows draw it again |
|
|
552
|
+
| Textures | 1024 base colour + normal + ORM | 2048 (4096 for a cinematic hero) | Texel density by camera: `art-style-and-genre.md` §4 |
|
|
553
|
+
| Shape keys (morph targets) | A few per mesh | 50+ for a face | WebGL2 stores targets in textures (memory is the limit); WebGL1 attribute mode: 8 active. CPU skinning cannot be combined with morph targets |
|
|
554
|
+
| Vertices per mesh | Under 65,535 | | 16-bit indices |
|
|
555
|
+
|
|
556
|
+
BabylonJS stores bone matrices in a texture by default, so the bone count does not hit a uniform limit (on
|
|
557
|
+
devices that fall back to uniforms, too many bones can make the mesh silently fail to render). Keep the count
|
|
558
|
+
low anyway: every bone is evaluated every frame, and shader skinning reads 16 texels per vertex per instance.
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## 10. Pitfalls
|
|
563
|
+
|
|
564
|
+
| Pitfall | What happens | Fix |
|
|
565
|
+
|---|---|---|
|
|
566
|
+
| Proportions fixed after the rig | Weights, clips and UVs are redone | Gate the blockout with `measure-stations` / `world-gate` first |
|
|
567
|
+
| T-pose modelling | The shoulder collapses with the arms down | Model in an A-pose (30-45 degrees); enforce the T-pose in Unity's avatar |
|
|
568
|
+
| Unity Mesh LOD on a skinned character | LOD0 is still deformed; no saving | Author LOD meshes and use an LOD Group |
|
|
569
|
+
| Skin hull used as the final shell | Folded faces at 4-way junctions, up to 4 cm asymmetry | Voxel remesh, then symmetric QuadriFlow (the result measured 0.0 m asymmetry) |
|
|
570
|
+
| Metaball blockout at the chart's size | Fields grow past the chart: 2.04 m from a 1.75 m chart | `fit_height` after conversion |
|
|
571
|
+
| QuadriFlow on a tiny model | Refuses ("needs to be manifold") | `quadriflow` solves at a 2 m size and scales back |
|
|
572
|
+
| QuadriFlow symmetry | The mirror seam is left open (144 open edges on a biped) | `quadriflow` snaps and welds it, retries other seeds, then falls back to a whole-mesh solve |
|
|
573
|
+
| Poles on joints | Pinching when bent | `topology_report(joints=...)` must show 0 poles at joints |
|
|
574
|
+
| No rest bend in elbows and knees | IK flips the joint the wrong way | Keep a few degrees of bend in the chart |
|
|
575
|
+
| Floating eyes, teeth or gear in one mesh | Bone heat leaves them unweighted | `bind_auto` (proxy fallback) or a rigid bind to one bone |
|
|
576
|
+
| Modular seam lit differently on each side | A visible line where parts meet | Copy seam normals from the uncut body; same weights on seam vertices |
|
|
577
|
+
| Chart edited after the mesh was fitted | The skeleton no longer sits in the mesh | Move the chart with `scale_chart(chart, fit_height(...))` |
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## 11. Verification checklist
|
|
582
|
+
|
|
583
|
+
```bash
|
|
584
|
+
node <skill>/scripts/bt-blender.mjs view-consistency --spec refs/spec.json # sheet views agree
|
|
585
|
+
node <skill>/scripts/bt-blender.mjs world-gate --spec refs/spec.json --model character.blend # blockout >= 0.85 IoU
|
|
586
|
+
node <skill>/scripts/bt-blender.mjs measure-stations --spec refs/spec.json --model character.blend # no WRONG station
|
|
587
|
+
node <skill>/scripts/bt-blender.mjs qa-check --model character.blend --profile web
|
|
588
|
+
node <skill>/scripts/bt-blender.mjs assembly-check --model character.blend
|
|
589
|
+
node <skill>/scripts/bt-blender.mjs review-render --model character.blend --out review --pixel-height 180
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
- [ ] The sheet's height, head count and rest pose are in the brief; the chart uses them.
|
|
593
|
+
- [ ] The blockout passes `world-gate` and `measure-stations` before any detail.
|
|
594
|
+
- [ ] The final mesh is one manifold shell (`qa-check` clean: no boundary, non-manifold or inconsistent edges),
|
|
595
|
+
within the triangle budget, `symmetry_error` under 1 mm unless the design is asymmetric.
|
|
596
|
+
- [ ] `topology_report(joints=...)` shows 0 poles within 3-4 cm of the elbows, knees, shoulders and hips.
|
|
597
|
+
- [ ] Hands and face match the tier in section 7; eyes and other floating parts are separate and bound.
|
|
598
|
+
- [ ] Modular parts share their seam vertices and seam normals (seam disagreement under 1 degree).
|
|
599
|
+
- [ ] LODs are about 50 % per level, named `_LOD0` to `_LODn`, with the same skeleton.
|
|
600
|
+
- [ ] The review render at the gameplay pixel height reads: silhouette, head, hands and pose.
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
## Sources
|
|
605
|
+
|
|
606
|
+
- Blender Manual: Skin modifier; Metaball properties and editing; Remesh modifier; sculpt-mode Remesh; Mirror
|
|
607
|
+
modifier — https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/skin.html ,
|
|
608
|
+
https://docs.blender.org/manual/en/latest/modeling/metas/properties.html ,
|
|
609
|
+
https://docs.blender.org/manual/en/latest/modeling/metas/editing.html ,
|
|
610
|
+
https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/remesh.html ,
|
|
611
|
+
https://docs.blender.org/manual/en/latest/sculpt_paint/sculpting/tool_settings/remesh.html ,
|
|
612
|
+
https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/mirror.html
|
|
613
|
+
- Blender 4.1 release notes, modelling (Auto Smooth replaced, custom normals) —
|
|
614
|
+
https://developer.blender.org/docs/release_notes/4.1/modeling/
|
|
615
|
+
- Polycount wiki: Topology; Polygon Count; Shoulder Topology; Face Topology — http://wiki.polycount.com/wiki/Topology ,
|
|
616
|
+
http://wiki.polycount.com/wiki/Polygon_Count , http://wiki.polycount.com/wiki/ShoulderTopology ,
|
|
617
|
+
http://wiki.polycount.com/wiki/FaceTopology
|
|
618
|
+
- Wikipedia: Body proportions; T-pose; Digitigrade; Clavicle — https://en.wikipedia.org/wiki/Body_proportions ,
|
|
619
|
+
https://en.wikipedia.org/wiki/T-pose , https://en.wikipedia.org/wiki/Digitigrade , https://en.wikipedia.org/wiki/Clavicle
|
|
620
|
+
- Proko, Loomis ideal proportions notes — https://www.proko.com/course-lesson/human-proportions-idealistic-figures/notes
|
|
621
|
+
- Unity Manual: Modeling optimized characters (current and 4.6); LOD Group; Mesh LOD —
|
|
622
|
+
https://docs.unity.com/en-us/engine/current/manual/assets-and-media/asset-types/models/creating-dccassets/modeling-optimized-characters ,
|
|
623
|
+
https://docs.unity3d.com/462/Documentation/Manual/ModelingOptimizedCharacters.html ,
|
|
624
|
+
https://docs.unity.com/en-us/engine/current/manual/analysis/graphics-performance-profiling/lod/lod-group/class-lodgroup ,
|
|
625
|
+
https://docs.unity.com/en-us/engine/current/manual/analysis/graphics-performance-profiling/lod/mesh-lod/mesh-lod-introduction
|
|
626
|
+
- CRYENGINE, character budgets (HUNT: Showdown) —
|
|
627
|
+
https://www.cryengine.com/docs/static/engines/cryengine-5/categories/23756816/pages/23307976
|
|
628
|
+
- Epic Games, Working with modular characters —
|
|
629
|
+
https://dev.epicgames.com/documentation/en-us/unreal-engine/working-with-modular-characters-in-unreal-engine
|
|
630
|
+
- Android developers (Arm), Geometry optimization — https://developer.android.com/games/optimize/geometry
|
|
631
|
+
- BabylonJS: Levels of detail; Bones and skeletons — https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD ,
|
|
632
|
+
https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
|
|
633
|
+
- 80.lv: Stylization in video games; Optimization of stylized game assets (Elwood); Topology for game characters —
|
|
634
|
+
https://80.lv/articles/stylization-in-video-games-a-deep-dive-analysis/ ,
|
|
635
|
+
https://80.lv/articles/optimization-of-stylized-game-assets ,
|
|
636
|
+
https://80.lv/articles/topology-for-game-and-game-based-characters
|
|
637
|
+
- School of Motion, How to rig quadrupeds — https://schoolofmotion.com/blog/how-to-rig-quadrupeds-animation
|
|
638
|
+
- Autodesk Softimage 2014, Modeling the head —
|
|
639
|
+
https://download.autodesk.com/global/docs/softimage2014/en_us/files/face_modeling_ModelingtheHead.htm
|
|
640
|
+
- Game Developer, Y. Oliveira, "Your problems are not always what they seam" —
|
|
641
|
+
https://gamedeveloper.com/programming/your-problems-are-not-always-what-they-seam-combining-different-meshes-into-seamless-procedural-characters
|
|
642
|
+
- BG3 wiki, Modding: fixing neck seams — https://bg3.wiki/wiki/Modding:Fixing_neck_seams
|
|
643
|
+
- GDC Vault, T. Wang, "Joint-Based Skin Deformation in God of War Ragnarok" —
|
|
644
|
+
https://gdcvault.com/play/1029203/Joint-Based-Skin-Deformation-in
|