Skip to content

Commit 7adac7c

Browse files
committed
feat: add pelvis rotation compensation guidelines for accurate leg positioning
1 parent d0f53db commit 7adac7c

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

src/DesktopApp/ImageToPose.Desktop/Assets/step_2_prompt_generate_bone_rotations.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,33 @@ The MPFB rig's T-pose has inherent bends that must be compensated:
7373
- **TRIGGERS for applying compensation**: "straight arm", "extended arm", "nearly straight", "elbow locked", "arm trailing behind", "arm hanging down", "arm at rest"
7474
- These compensations are ONLY applied when the pose requires straight/extended arms
7575

76+
# PELVIS ROTATION COMPENSATION (CRITICAL)
77+
**IMPORTANT**: The pelvis bone is the root of the entire skeleton. Any rotation applied to the pelvis affects the **entire body** (both upper and lower halves), not just the torso.
78+
79+
To compensate for the effect of pelvis rotation on the legs, you **MUST** apply counter-rotations to `thigh_l` and `thigh_r`:
80+
81+
- **For pelvis.X** (forward/back lean):
82+
- If `pelvis.X = +15` (body leans forward) → **subtract 15** from `thigh_l.X` and `thigh_r.X`
83+
- If `pelvis.X = -15` (body leans back) → **add 15** to `thigh_l.X` and `thigh_r.X`
84+
- Formula: `thigh.X = desired_leg_angle - pelvis.X`
85+
86+
- **For pelvis.Y** (body turns left/right):
87+
- **DO NOT USE pelvis.Y** - this axis is extremely difficult to compensate correctly
88+
- **Always set pelvis.Y = 0**
89+
- Use spine_01/spine_02/spine_03 Y-rotations for torso turning instead
90+
91+
- **For pelvis.Z** (body tilts left/right):
92+
- If `pelvis.Z = +10` (body tilts right) → **subtract 10** from `thigh_l.Z` and `thigh_r.Z`
93+
- If `pelvis.Z = -10` (body tilts left) → **add 10** to `thigh_l.Z` and `thigh_r.Z`
94+
- Formula: `thigh.Z = desired_leg_position - pelvis.Z`
95+
96+
**Example**: If the character leans forward 20° at the hips while keeping legs straight down:
97+
- Set `pelvis.X = 20`
98+
- Set `thigh_l.X = -20` and `thigh_r.X = -20` (to compensate)
99+
- Result: Upper body leans forward, legs remain vertical
100+
101+
**Always apply this compensation** when setting non-zero pelvis.X or pelvis.Z rotations to maintain correct leg positioning relative to the ground or intended pose.
102+
76103
# ANCHOR-DRIVEN ESTIMATION WORKFLOW (INTERNAL – do not output)
77104

78105
## PHASE 1: TORSO ORIENTATION (CRITICAL)
@@ -140,19 +167,28 @@ The MPFB rig's T-pose has inherent bends that must be compensated:
140167
- Negative X = leg forward
141168
- Typical range: -135° (high knee) to -10° (slight forward)
142169
- **Don't over-flex**: -90° is extreme, most poses use -30° to -60°
170+
- **CRITICAL**: Apply pelvis compensation: `thigh.X = desired_leg_angle - pelvis.X`
171+
- Example: If pelvis.X = 20 and you want legs vertical, set thigh.X = -20
143172

144173
2. **Hip abduction** (leg sideways):
145174
- Positive Z = leg moves outward
146175
- Typical range: -10° to +30°
147176
- **Don't ignore this**: Seated poses often have 15-25° abduction
177+
- **CRITICAL**: Apply pelvis compensation: `thigh.Z = desired_leg_position - pelvis.Z`
178+
- Example: If pelvis.Z = 10 and you want neutral stance, set thigh.Z = -10
179+
180+
3. **Hip rotation** (leg turning):
181+
- Use thigh.Y for individual leg rotation (turning in/out)
182+
- Typical range: -20° to +20°
183+
- **NOTE**: pelvis.Y should ALWAYS be 0 (no compensation needed)
148184

149-
3. **Knee bend**:
185+
4. **Knee bend**:
150186
- 0° = straight (locked knee)
151187
- Positive X = bent
152188
- Typical values: 5° (nearly straight), 30° (slight), 60° (moderate), 90-100° (sharp), 135° (full)
153189
- **Match thigh flexion**: If thigh=-80°, calf should be 70-100° to keep foot reasonable
154190

155-
4. **Foot/ankle**:
191+
5. **Foot/ankle**:
156192
- Small adjustments for plantarflexion (X) and rotation (Y/Z)
157193
- Usually -10° to +15°
158194

@@ -172,7 +208,9 @@ Run these checks on your estimated dictionary:
172208
7. **Leg Abduction**: If seated, straddling, or wide stance → thigh.Z should be non-zero
173209
8. **Magnitude Reality**: Values should vary (avoid all 0, 10, 20, 90 patterns)
174210
9. **Hinge Compliance**: lowerarm and calf have Y=0, Z=0 always
175-
10. **Range Validation**: Check values against limits below
211+
10. **Pelvis Y-Lock**: Verify pelvis.Y = 0 (never use this axis)
212+
11. **Pelvis Compensation**: If pelvis.X or pelvis.Z are non-zero, verify thighs have compensating counter-rotations applied
213+
12. **Range Validation**: Check values against limits below
176214

177215
# JOINT RANGE CONSTRAINTS
178216
Respect these anatomical limits unless pose explicitly exceeds them:
@@ -198,6 +236,8 @@ Respect these anatomical limits unless pose explicitly exceeds them:
198236
8. ❌ Using negative lowerarm values for bent elbows
199237
9. ❌ Using only round numbers (0, 10, 20, 90)
200238
10. ❌ Forgetting clavicle rotations when shoulders are protracted/elevated
239+
11. ❌ Using pelvis.Y rotation (always set to 0; use spine rotations instead)
240+
12. ❌ Forgetting pelvis compensation on thighs when pelvis.X or pelvis.Z are non-zero
201241

202242
# OUTPUT RULES (HARD)
203243
- Respond with **one** fenced code block only, language tag `python`.

0 commit comments

Comments
 (0)