Skip to content

Turn any video into a Mixamo-rig animation - GVHMR estimator, spec-driven retarget, FK apply in Blender via MCP. Works with any Mixamo character; built to be operated end-to-end by an AI agent.

Windowed nudges + head_look correctors; textured preview renders

Sacha37f674565a9c
diff --git a/docs/PIPELINE.md b/docs/PIPELINE.md
index 36a9634..f9bd958 100644
--- a/docs/PIPELINE.md
+++ b/docs/PIPELINE.md
@@ -129,6 +129,23 @@ where fast flurries read staccato:
"smooth": [ { "src": [172, 204], "window": 9 } ]
```
+Two more windowed correctors for systematic estimator bias in a phase
+(both ramped, both leave the rest of the clip untouched):
+
+```jsonc
+// Offset an arm chain in the hip basis (x=left, y=back, z=up, meters);
+// segment lengths are re-normalized from the shoulder socket.
+// "arms too high" -> negative z; "shoulder pulls back" -> negative y.
+"nudges": [
+ { "src": [172, 204], "ramp_src": 5, "side": "both", "offset": [0, 0, -0.08] },
+ { "src": [172, 204], "ramp_src": 5, "side": "right", "offset": [0, -0.05, 0] }
+],
+
+// Blend the head's horizontal gaze toward character-forward
+// (amount 0..1) where the estimator's head heading drifts.
+"head_look": [ { "src": [172, 204], "ramp_src": 6, "amount": 0.7 } ]
+```
+
## 4. Lift
```
diff --git a/pipeline/apply_mixamo_fk.py b/pipeline/apply_mixamo_fk.py
index bf97c8e..6fb5125 100644
--- a/pipeline/apply_mixamo_fk.py
+++ b/pipeline/apply_mixamo_fk.py
@@ -452,6 +452,9 @@ def run_stills_render(spec_path: str, dest_frames) -> dict:
old_path = scene.render.filepath
scene.camera = cam
scene.render.engine = "BLENDER_WORKBENCH"
+ old_shading = (scene.display.shading.light, scene.display.shading.color_type)
+ scene.display.shading.light = "STUDIO"
+ scene.display.shading.color_type = "TEXTURE"
scene.render.resolution_x, scene.render.resolution_y = 960, 720
scene.render.resolution_percentage = 100
@@ -475,6 +478,7 @@ def run_stills_render(spec_path: str, dest_frames) -> dict:
finally:
scene.camera = old_cam
scene.render.engine = old_engine
+ scene.display.shading.light, scene.display.shading.color_type = old_shading
scene.render.resolution_x, scene.render.resolution_y, scene.render.resolution_percentage = old_res
scene.render.filepath = old_path
bpy.data.objects.remove(cam)
diff --git a/pipeline/lift_to_mixamo.py b/pipeline/lift_to_mixamo.py
index 5c96ed5..869ae90 100644
--- a/pipeline/lift_to_mixamo.py
+++ b/pipeline/lift_to_mixamo.py
@@ -371,6 +371,55 @@ def main():
rec[f"{s}_elbow"], rec[f"{s}_wrist"] = e, w
rec[f"{s}_hand"] = w + unit(w - e) * LEN[f"{s}_hand"]
+ # Windowed arm-chain nudges (spec "nudges"): offset elbow/wrist/
+ # hand in the hip basis and re-normalize segment lengths from the
+ # socket. Fixes systematic estimator bias in a phase (arms too
+ # high, a shoulder pulled back) without authoring the motion.
+ for nd in spec.get("nudges", []):
+ amt = window_amount(
+ f,
+ [nd["src"][0], nd["src"][0] + nd.get("ramp_src", 5)],
+ [nd["src"][1] - nd.get("ramp_src", 5), nd["src"][1]],
+ src2dest,
+ )
+ if amt <= 1e-4:
+ continue
+ bx, by, bz = rec["basis_x"], rec["basis_y"], rec["basis_z"]
+ ox, oy, oz = nd["offset"]
+ off = (bx * ox + by * oy + bz * oz) * amt
+ sides = ("l", "r") if nd.get("side", "both") == "both" else (nd["side"][0],)
+ for s in sides:
+ sock = np.asarray(rec[f"{s}_arm"], float)
+ e = np.asarray(rec[f"{s}_elbow"], float) + off
+ w = np.asarray(rec[f"{s}_wrist"], float) + off
+ h = np.asarray(rec[f"{s}_hand"], float) + off
+ e = sock + unit(e - sock) * LEN[f"{s}_arm"]
+ w = e + unit(w - e) * LEN[f"{s}_fore"]
+ h = w + unit(h - w) * LEN[f"{s}_hand"]
+ rec[f"{s}_elbow"], rec[f"{s}_wrist"], rec[f"{s}_hand"] = e, w, h
+
+ # Windowed gaze correction (spec "head_look"): blend the head's
+ # horizontal direction toward character-forward. For phases where
+ # the estimator's head heading drifts off the reference.
+ for hl in spec.get("head_look", []):
+ amt = window_amount(
+ f,
+ [hl["src"][0], hl["src"][0] + hl.get("ramp_src", 6)],
+ [hl["src"][1] - hl.get("ramp_src", 6), hl["src"][1]],
+ src2dest,
+ ) * float(hl.get("amount", 1.0))
+ if amt <= 1e-4:
+ continue
+ neck = np.asarray(rec["neck"], float)
+ head = np.asarray(rec["head"], float)
+ v = head - neck
+ flat = np.array([v[0], v[1], 0.0])
+ mag = max(np.linalg.norm(flat), 0.02)
+ fwd = -np.asarray(rec["basis_y"], float)
+ fwd = unit(np.array([fwd[0], fwd[1], 0.0])) * mag
+ new_flat = lerp(flat, fwd, amt)
+ rec["head"] = neck + np.array([new_flat[0], new_flat[1], v[2]])
+
rest_amt = smoother((sf - rb["start_src"]) / max(1.0, rb["full_src"] - rb["start_src"]))
rbs = spec.get("rest_blend_start")
if rbs:
diff --git a/pipeline/render_preview.py b/pipeline/render_preview.py
index 036b7c3..a822505 100644
--- a/pipeline/render_preview.py
+++ b/pipeline/render_preview.py
@@ -67,6 +67,8 @@ try:
cam.location = Vector((0.0, -4.6, 1.05))
cam.rotation_euler = (math.radians(90), 0.0, 0.0)
scene.render.engine = "BLENDER_WORKBENCH"
+ scene.display.shading.light = "STUDIO"
+ scene.display.shading.color_type = "TEXTURE"
scene.render.resolution_x, scene.render.resolution_y = 960, 720
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = "PNG"