Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix: hair and headwear never occlude the scalp

nirholas35c8cae074cc
diff --git a/api/garment-forge.js b/api/garment-forge.js
index 87f7e6b78..e52e012fc 100644
--- a/api/garment-forge.js
+++ b/api/garment-forge.js
@@ -59,7 +59,7 @@ async function startJob(req, res, cfg) {
if (prompt.length < 3 || prompt.length > 500) {
return json(res, 400, {
error: 'invalid_prompt',
- message: 'Describe the garment in 3–500 characters (e.g. "a white oxford dress shirt").',
+ message: 'Describe the garment in 3 to 500 characters (e.g. "a white oxford dress shirt").',
});
}
if (!GARMENT_SLOTS.includes(slot)) {
diff --git a/workers/garment-forge/README.md b/workers/garment-forge/README.md
index c1a17f222..05b56f1ef 100644
--- a/workers/garment-forge/README.md
+++ b/workers/garment-forge/README.md
@@ -72,8 +72,9 @@ pure glTF work in between:
6. **Validate + publish**: skin-weight statistics produce the bind coverage,
the `occludes` declaration (any REGION_BONES region carrying ≥ 10% of the
garment's skin weight, then clamped to the slot's plausible region set,
- `SLOT_OCCLUDABLE` — a shirt's waistband graze must not amputate the
- avatar's legs), and the manifest's `rig.bones`. All 6 manifest validation rules run in-process;
+ `SLOT_OCCLUDABLE`: a shirt's waistband graze must not amputate the
+ avatar's legs, and headwear/hair may occlude nothing at all), and the
+ manifest's `rig.bones`. All 6 manifest validation rules run in-process;
any failure fails the job. On success `garment.glb`, `manifest.json`, and
`thumb.webp` (from the reference image) land in
`garments/<slot>/<id>/v<version>/` and the manifest is appended to
diff --git a/workers/garment-forge/garment_glb.py b/workers/garment-forge/garment_glb.py
index b591a6224..70aae1e01 100644
--- a/workers/garment-forge/garment_glb.py
+++ b/workers/garment-forge/garment_glb.py
@@ -70,8 +70,11 @@ SLOT_OCCLUDABLE = {
"outerwear": ("torso", "upperArms", "lowerArms", "neck", "hips", "upperLegs"),
"bottom": ("hips", "upperLegs", "lowerLegs"),
"footwear": ("feet", "lowerLegs"),
- "hair": ("scalp",),
- "headwear": ("scalp",),
+ # scalp is NEVER occludable: it resolves to the Head bone, and Head-bone
+ # occlusion cannot separate scalp from face, so culling it deletes the
+ # avatar's face. Caps and hair simply cover; they hide nothing.
+ "hair": (),
+ "headwear": (),
"glasses": (),
"accessory": (),
}
diff --git a/workers/garment-forge/test_garment_glb.py b/workers/garment-forge/test_garment_glb.py
index 5625d34f1..ea5d420e8 100644
--- a/workers/garment-forge/test_garment_glb.py
+++ b/workers/garment-forge/test_garment_glb.py
@@ -271,6 +271,17 @@ check("slot clamp: top keeps its evidenced regions", occ_top == occ, f"{occ_top}
trace = {"Spine": 0.97, "Hips": 0.03}
occ_trace = derive_occludes(trace, 1.0, slot="top")
check("3% hip graze does not hide the pelvis", occ_trace == ["torso"], str(occ_trace))
+# scalp is categorically un-occludable: it resolves to the Head bone, and
+# Head-bone culling cannot separate scalp from face. A cap or hairstyle whose
+# weight sits 100% on Head must still declare occludes=[] or the avatar loses
+# its face at attach time.
+head_only = {"Head": 1.0}
+check("headwear on Head occludes nothing",
+ derive_occludes(head_only, 1.0, slot="headwear") == [],
+ str(derive_occludes(head_only, 1.0, slot="headwear")))
+check("hair on Head occludes nothing",
+ derive_occludes(head_only, 1.0, slot="hair") == [],
+ str(derive_occludes(head_only, 1.0, slot="hair")))
bones = weighted_bones(stats["bone_mass"], stats["total_mass"])
check("rig.bones in canonical order", bones == ["Hips", "Spine", "LeftArm"], str(bones))