Subagent: Two-handed longsword clips
agent (cont.)
+59:20Bashcd ~/Projects/lowmarch-fable52/tools/whole && sed -i 's/fwd=0.16, hip=10.0/fwd=0.13, hip=10.0/; s/drop=0.12, fwd=0.17/drop=0.12, fwd=0.13/g; s/drop=0.11, fwd=0.16/drop=0.11, fwd=0.13/g' clips2h.py && grep -c "fwd=0.13" clips2h.py && cd ~/Projects/lowmarch-fable52/review/out/whole-clips && sed -i "s/ank L{feet\['L'\]\[0\]\[1\]:5.3f}/ank L{feet['L'][0][1]:5.3f} R{feet['R'][0][1]:5.3f}/" t.py && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py attack 2>&1 | grep -v "^ [~]" | grep -v "^idle" | grep -o "^attack [0-9.]*\|^wren.*\|clear [A-Za-z_]* *-*[0-9.]*\|hipext.*ank L[0-9. R]*\|drift.*\|legs *[0-9.]*" | paste -d' ' - - - - - | head -40
command
cd ~/Projects/lowmarch-fable52/tools/whole && sed -i 's/fwd=0.16, hip=10.0/fwd=0.13, hip=10.0/; s/drop=0.12, fwd=0.17/drop=0.12, fwd=0.13/g; s/drop=0.11, fwd=0.16/drop=0.11, fwd=0.13/g' clips2h.py && grep -c "fwd=0.13" clips2h.py && cd ~/Projects/lowmarch-fable52/review/out/whole-clips && sed -i "s/ank L{feet\['L'\]\[0\]\[1\]:5.3f}/ank L{feet['L'][0][1]:5.3f} R{feet['R'][0][1]:5.3f}/" t.py && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py attack 2>&1 | grep -v "^ [~]" | grep -v "^idle" | grep -o "^attack [0-9.]*\|^wren.*\|clear [A-Za-z_]* *-*[0-9.]*\|hipext.*ank L[0-9. R]*\|drift.*\|legs *[0-9.]*" | paste -d' ' - - - - - | head -40result, 27 lines
5 wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it attack 0.00 legs 41.7 clear L_UpperArm 1.1 hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 R0.107 attack 0.10 legs 45.3 clear L_UpperArm 0.9 hipext L -32 R -13 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.20 legs 45.3 clear L_UpperArm 2.8 hipext L -28 R -12 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.26 legs 48.8 clear L_UpperArm 2.0 hipext L -26 R -14 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.32 legs 52.0 clear L_UpperArm 3.1 hipext L -26 R -16 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.38 legs 52.3 clear L_UpperArm 2.5 hipext L -26 R -18 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.44 legs 51.9 clear L_UpperArm 1.7 hipext L -26 R -18 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.47 legs 58.9 clear L_UpperArm 5.6 hipext L -39 R -10 | toe y L0.087 R0.036 ank L0.143 R0.107 drift L6.4 R0.0 attack 0.50 legs 65.3 clear L_UpperArm 2.4 hipext L -51 R 6 | toe y L0.117 R0.036 ank L0.173 R0.107 drift L9.8 R0.0 attack 0.53 legs 62.5 clear L_UpperArm 1.5 hipext L -52 R 12 | toe y L0.091 R0.036 ank L0.147 R0.107 drift L8.8 R0.0 attack 0.56 legs 57.0 clear L_UpperArm 1.8 hipext L -45 R 14 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L7.4 R0.0 attack 0.59 legs 49.6 clear R_UpperArm 2.7 hipext L -44 R 13 | toe y L0.054 R0.036 ank L0.110 R0.107 drift L1.0 R0.0 attack 0.62 legs 37.4 clear R_UpperArm 2.8 hipext L -51 R 11 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L1.0 R0.0 attack 0.65 legs 15.8 clear R_UpperArm 0.7 hipext L -52 R 10 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.68 legs 6.7 clear L_UpperArm 0.9 hipext L -52 R 9 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.78 legs 8.6 clear R_UpperArm 0.7 hipext L -49 R 10 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L0.0 R0.0 attack 0.90 legs 13.0 clear R_UpperArm 0.3 hipext L -46 R 11 | toe y L0.058 R0.036 ank L0.114 R0.107 drift L0.1 R0.0 attack 1.05 legs 13.0 clear R_UpperArm 0.3 hipext L -46 R 11 | toe y L0.058 R0.036 ank L0.114 R0.107 drift L0.0 R0.0 attack 1.10 legs 16.1 clear R_UpperArm 0.7 hipext L -53 R 11 | toe y L0.065 R0.036 ank L0.121 R0.107 drift L2.1 R0.0 attack 1.15 legs 27.1 clear L_UpperArm 0.6 hipext L -54 R 10 | toe y L0.077 R0.036 ank L0.133 R0.107 drift L4.2 R0.0 attack 1.20 legs 32.3 clear L_UpperArm 0.8 hipext L -53 R 5 | toe y L0.091 R0.036 ank L0.147 R0.107 drift L5.3 R0.0 attack 1.25 legs 34.2 clear L_UpperArm 0.8 hipext L -51 R -0 | toe y L0.097 R0.036 ank L0.153 R0.107 drift L4.9 R0.0 attack 1.35 legs 38.2 clear L_UpperArm 0.8 hipext L -43 R -8 | toe y L0.081 R0.036 ank L0.137 R0.107 drift L7.6 R0.0 attack 1.42 legs 40.5 clear L_UpperArm 1.0 hipext L -38 R -12 | toe y L0.066 R0.036 ank L0.122 R0.107 drift L4.7 R0.0 attack 1.50 legs 41.7 clear L_UpperArm 1.1 hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 R0.107 drift L2.4 R0.0 [This command modified 2 files you've previously read: ../../../tools/whole/clips2h.py, ../whole-clips/t.py. Call Read before editing.]
Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 python3 -c "
command
cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 python3 -c " import h; v,shape=h.load() import sys; sys.path.insert(0,h.ROOT+'/tools/whole') import clips2h, poses as P f=clips2h.Fighter(v,shape); r=f.rig for p,n in ((dict(),'rest'),(P.BUST,'bust'),(f.base,'base')): print(n,[ (s, r.pos(p,f'J_Bip_{s}_Foot').round(3), r.pos(p,f'J_Bip_{s}_ToeBase').round(3)) for s in 'LR']) " 2>&1 | tail -3result, 3 lines
rest [('L', array([-0.098, 0.103, -0.021]), array([-0.098, 0.027, -0.153])), ('R', array([ 0.098, 0.103, -0.021]), array([ 0.098, 0.027, -0.153]))] bust [('L', array([-0.098, 0.103, -0.021]), array([-0.098, 0.027, -0.153])), ('R', array([ 0.098, 0.103, -0.021]), array([ 0.098, 0.027, -0.153]))] base [('L', array([-0.167, 0.113, -0.131]), array([-0.171, 0.057, -0.273])), ('R', array([0.167, 0.107, 0.037]), array([ 0.173, 0.036, -0.097]))]Bashcd ~/Projects/lowmarch-fable52/tools/whole && grep -n "self.foot = \|self.toe = " clips2h.py && python3 - <<'EOF'
command
cd ~/Projects/lowmarch-fable52/tools/whole && grep -n "self.foot = \|self.toe = " clips2h.py && python3 - <<'EOF' s=open('clips2h.py').read() a=''' self.foot = {s: rig.pos(self.base, f"J_Bip_{s}_Foot") for s in "LR"} self.toe = {s: rig.pos(self.base, f"J_Bip_{s}_ToeBase") - self.foot[s] for s in "LR"}''' b=''' # the stance's feet: where the battle idle puts them, at the rest pose's height and flat as in the rest pose # (the idle's own feet float a centimetre, the lead one toe up) self.foot = {s: rig.pos(self.base, f"J_Bip_{s}_Foot") * [1, 0, 1] + [0, rig.pos({}, f"J_Bip_{s}_Foot")[1], 0] for s in "LR"} self.toe = {s: rig.pos({}, f"J_Bip_{s}_ToeBase") - rig.pos({}, f"J_Bip_{s}_Foot") for s in "LR"}''' assert s.count(a)==1; s=s.replace(a,b) open('clips2h.py','w').write(s) EOF cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py 2>&1 | grep -v "^ [~]" | grep -o "^[a-z]* [0-9.]*\|^wren.*\|clear [A-Za-z_]* *-*[0-9.]*\|hipext.*ank L[0-9. R]*\|drift.*\|legs *[0-9.]*" | paste -d' ' - - - - - | head -40result, 39 lines
194: self.foot = {s: rig.pos(self.base, f"J_Bip_{s}_Foot") for s in "LR"} 195: self.toe = {s: rig.pos(self.base, f"J_Bip_{s}_ToeBase") - self.foot[s] for s in "LR"} solve 13.6 wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it idle 0.00 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 idle 0.20 legs 42.1 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 0.40 legs 42.6 clear L_UpperArm 1.0 hipext L -31 R -12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 0.60 legs 43.4 clear L_UpperArm 1.0 hipext L -29 R -10 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 0.80 legs 44.0 clear L_UpperArm 1.0 hipext L -27 R -8 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 1.00 legs 44.0 clear L_UpperArm 1.0 hipext L -27 R -8 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 1.20 legs 43.9 clear L_UpperArm 1.0 hipext L -28 R -8 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 1.40 legs 42.7 clear L_UpperArm 1.0 hipext L -31 R -12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 1.60 legs 42.0 clear L_UpperArm 1.0 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 1.80 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 2.00 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.00 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 attack 0.10 legs 45.4 clear L_UpperArm 0.9 hipext L -30 R -12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.20 legs 45.4 clear L_UpperArm 2.8 hipext L -25 R -12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.26 legs 48.8 clear L_UpperArm 2.0 hipext L -24 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.32 legs 52.0 clear L_UpperArm 3.1 hipext L -23 R -15 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.38 legs 52.4 clear L_UpperArm 2.5 hipext L -24 R -17 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.44 legs 51.9 clear L_UpperArm 1.7 hipext L -24 R -18 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.47 legs 59.0 clear L_UpperArm 5.6 hipext L -36 R -10 | toe y L0.057 R0.027 ank L0.133 R0.103 drift L6.4 R0.0 attack 0.50 legs 65.5 clear L_UpperArm 2.4 hipext L -50 R 7 | toe y L0.087 R0.027 ank L0.163 R0.103 drift L9.8 R0.0 attack 0.53 legs 63.0 clear L_UpperArm 1.5 hipext L -50 R 13 | toe y L0.061 R0.027 ank L0.136 R0.103 drift L8.8 R0.0 attack 0.56 legs 58.0 clear L_UpperArm 1.8 hipext L -41 R 15 | toe y L0.033 R0.027 ank L0.108 R0.103 drift L6.9 R0.0 attack 0.59 legs 49.9 clear R_UpperArm 2.7 hipext L -43 R 14 | toe y L0.031 R0.027 ank L0.106 R0.103 drift L0.8 R0.0 attack 0.62 legs 39.4 clear R_UpperArm 2.8 hipext L -43 R 12 | toe y L0.028 R0.027 ank L0.104 R0.103 drift L0.6 R0.0 attack 0.65 legs 18.5 clear R_UpperArm 0.7 hipext L -44 R 11 | toe y L0.028 R0.027 ank L0.104 R0.103 drift L0.0 R0.0 attack 0.68 legs 7.7 clear L_UpperArm 0.9 hipext L -45 R 10 | toe y L0.029 R0.027 ank L0.105 R0.103 drift L0.1 R0.0 attack 0.78 legs 8.9 clear R_UpperArm 0.7 hipext L -45 R 11 | toe y L0.033 R0.027 ank L0.108 R0.103 drift L0.4 R0.0 attack 0.90 legs 13.0 clear R_UpperArm 0.3 hipext L -45 R 12 | toe y L0.036 R0.027 ank L0.111 R0.103 drift L0.3 R0.0 attack 1.05 legs 13.0 clear R_UpperArm 0.3 hipext L -45 R 12 | toe y L0.036 R0.027 ank L0.111 R0.103 drift L0.0 R0.0 attack 1.10 legs 17.2 clear R_UpperArm 0.7 hipext L -49 R 13 | toe y L0.035 R0.027 ank L0.110 R0.103 drift L1.5 R0.0 attack 1.15 legs 28.2 clear L_UpperArm 0.6 hipext L -52 R 11 | toe y L0.047 R0.027 ank L0.123 R0.103 drift L4.2 R0.0 attack 1.20 legs 33.1 clear L_UpperArm 0.8 hipext L -51 R 6 | toe y L0.061 R0.027 ank L0.136 R0.103 drift L5.3 R0.0 attack 1.25 legs 34.9 clear L_UpperArm 0.8 hipext L -48 R 1 | toe y L0.067 R0.027 ank L0.143 R0.103 drift L4.9 R0.0 attack 1.35 legs 38.7 clear L_UpperArm 0.8 hipext L -41 R -7 | toe y L0.051 R0.027 ank L0.127 R0.103 drift L7.6 R0.0 attack 1.42 legs 40.9 clear L_UpperArm 1.0 hipext L -35 R -11 | toe y L0.036 R0.027 ank L0.111 R0.103 drift L4.7 R0.0 attack 1.50 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L2.4 R0.0 total 20Bashcd ~/Projects/lowmarch-fable52/tools/whole && sed -i 's/lead=0.30/lead=0.26/g; s/lead=0.24, lift=0.02/lead=0.21, lift=0.02/; s/lead=0.15, lift=0.06/lead=0.13, lift=0.06/; s/lead=0.14, lift=0.04/lead=0.12, lift=0.04/' clips2h.py && grep -c "lead=0.26" clips2h.py && cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py attack 2>&1 | grep -v "^ [~]" | grep -o "^[a-z]* [0-9.]*\|^wren.*\|clear [A-Za-z_]* *-*[0-9.]*\|hipext.*ank L[0-9. R]*\|drift.*\|legs *[0-9.]*" | paste -d' ' - - - - - | sed -n '1p;10,26p'
command
cd ~/Projects/lowmarch-fable52/tools/whole && sed -i 's/lead=0.30/lead=0.26/g; s/lead=0.24, lift=0.02/lead=0.21, lift=0.02/; s/lead=0.15, lift=0.06/lead=0.13, lift=0.06/; s/lead=0.14, lift=0.04/lead=0.12, lift=0.04/' clips2h.py && grep -c "lead=0.26" clips2h.py && cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py attack 2>&1 | grep -v "^ [~]" | grep -o "^[a-z]* [0-9.]*\|^wren.*\|clear [A-Za-z_]* *-*[0-9.]*\|hipext.*ank L[0-9. R]*\|drift.*\|legs *[0-9.]*" | paste -d' ' - - - - - | sed -n '1p;10,26p'
result, 20 lines
5 solve 13.4 wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it idle 0.00 legs 42.0 clear L_UpperArm 1.1 drift L0.0 R0.0 idle 1.80 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 idle 2.00 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.00 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 attack 0.10 legs 45.4 clear L_UpperArm 0.9 hipext L -30 R -12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.20 legs 45.4 clear L_UpperArm 2.8 hipext L -25 R -12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.26 legs 48.8 clear L_UpperArm 2.0 hipext L -24 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.32 legs 52.0 clear L_UpperArm 3.1 hipext L -23 R -15 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.38 legs 52.4 clear L_UpperArm 2.5 hipext L -24 R -17 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.44 legs 51.9 clear L_UpperArm 1.7 hipext L -24 R -18 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.47 legs 59.0 clear L_UpperArm 5.6 hipext L -36 R -10 | toe y L0.057 R0.027 ank L0.133 R0.103 drift L5.7 R0.0 attack 0.50 legs 65.5 clear L_UpperArm 2.4 hipext L -49 R 7 | toe y L0.087 R0.027 ank L0.163 R0.103 drift L8.7 R0.0 attack 0.53 legs 62.8 clear L_UpperArm 1.5 hipext L -51 R 13 | toe y L0.061 R0.027 ank L0.136 R0.103 drift L7.8 R0.0 attack 0.56 legs 56.4 clear L_UpperArm 1.8 hipext L -47 R 15 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L6.6 R0.0 attack 0.59 legs 48.4 clear R_UpperArm 2.7 hipext L -49 R 14 | toe y L0.024 R0.027 ank L0.099 R0.103 drift L0.9 R0.0 attack 0.62 legs 37.0 clear R_UpperArm 2.8 hipext L -52 R 12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.9 R0.0 attack 0.65 legs 15.3 clear R_UpperArm 0.7 hipext L -53 R 11 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.68 legs 6.5 clear L_UpperArm 0.9 hipext L -53 R 10 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 [This command modified 1 file you've previously read: tools/whole/clips2h.py. Call Read before editing.]
Bashcd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF'
command
cd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF' s=open('clips2h.py').read() a=''' def tan(j): if keys[j][2] or j == 0 or j == len(keys) - 1: return {n: 0 * np.asarray(v, float) for n, v in keys[j][1].items()} (tp, kp, _), (tn, kn, _) = keys[j - 1], keys[j + 1] return {n: (np.asarray(kn[n], float) - np.asarray(kp[n], float)) / (tn - tp) for n in kp}''' b=''' def tan(j): if keys[j][2] or j == 0 or j == len(keys) - 1: return {n: 0 * np.asarray(v, float) for n, v in keys[j][1].items()} (tp, kp, _), (tn, kn, _) = keys[j - 1], keys[j + 1] return {n: 0 * np.asarray(kp[n], float) if n in STEADY else (np.asarray(kn[n], float) - np.asarray(kp[n], float)) / (tn - tp) for n in kp}''' assert s.count(a)==1; s=s.replace(a,b) a='''def hermite(keys, t): """The keys' numbers at time t: cubic Hermite, tangents from the neighbours (zero on held keys)."""''' b='''STEADY = ("lead", "lift") # eased to a stop at every key: a foot that overshoots slides or sinks def hermite(keys, t): """The keys' numbers at time t: cubic Hermite, tangents from the neighbours (zero on held keys and for STEADY)."""''' assert s.count(a)==1; s=s.replace(a,b) open('clips2h.py','w').write(s) EOF cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py attack 2>&1 | grep -v "^ [~]" | grep -o "^[a-z]* [0-9.]*\|^wren.*\|clear [A-Za-z_]* *-*[0-9.]*\|hipext.*ank L[0-9. R]*\|drift.*\|legs *[0-9.]*" | paste -d' ' - - - - - | sed -n '1p;17,40p'result, 22 lines
solve 7.0 wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it idle 0.00 legs 42.0 clear L_UpperArm 1.1 attack 0.38 legs 52.4 clear L_UpperArm 2.5 hipext L -24 R -17 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.44 legs 51.9 clear L_UpperArm 1.7 hipext L -24 R -18 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.47 legs 59.0 clear L_UpperArm 5.6 hipext L -37 R -10 | toe y L0.057 R0.027 ank L0.133 R0.103 drift L7.2 R0.0 attack 0.50 legs 65.5 clear L_UpperArm 2.4 hipext L -49 R 7 | toe y L0.087 R0.027 ank L0.163 R0.103 drift L7.2 R0.0 attack 0.53 legs 62.9 clear L_UpperArm 1.5 hipext L -50 R 13 | toe y L0.057 R0.027 ank L0.133 R0.103 drift L7.2 R0.0 attack 0.56 legs 56.4 clear L_UpperArm 1.8 hipext L -47 R 15 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L7.2 R0.0 attack 0.59 legs 47.7 clear R_UpperArm 2.7 hipext L -51 R 14 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.62 legs 37.0 clear R_UpperArm 2.8 hipext L -52 R 12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.65 legs 15.3 clear R_UpperArm 0.7 hipext L -53 R 11 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.68 legs 6.5 clear L_UpperArm 0.9 hipext L -53 R 10 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.78 legs 8.4 clear R_UpperArm 0.7 hipext L -52 R 11 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 0.90 legs 12.3 clear R_UpperArm 0.3 hipext L -50 R 12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 1.05 legs 12.3 clear R_UpperArm 0.3 hipext L -50 R 12 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L0.0 R0.0 attack 1.10 legs 15.8 clear R_UpperArm 0.7 hipext L -54 R 13 | toe y L0.037 R0.027 ank L0.113 R0.103 drift L2.7 R0.0 attack 1.15 legs 27.8 clear L_UpperArm 0.6 hipext L -53 R 11 | toe y L0.047 R0.027 ank L0.123 R0.103 drift L2.7 R0.0 attack 1.20 legs 33.3 clear L_UpperArm 0.8 hipext L -50 R 6 | toe y L0.057 R0.027 ank L0.133 R0.103 drift L4.6 R0.0 attack 1.25 legs 34.9 clear L_UpperArm 0.8 hipext L -48 R 1 | toe y L0.067 R0.027 ank L0.143 R0.103 drift L4.6 R0.0 attack 1.35 legs 38.5 clear L_UpperArm 0.8 hipext L -42 R -7 | toe y L0.053 R0.027 ank L0.129 R0.103 drift L4.5 R0.0 attack 1.42 legs 40.9 clear L_UpperArm 1.0 hipext L -36 R -11 | toe y L0.037 R0.027 ank L0.112 R0.103 drift L5.1 R0.0 attack 1.50 legs 42.0 clear L_UpperArm 1.1 hipext L -32 R -13 | toe y L0.027 R0.027 ank L0.103 R0.103 drift L3.1 R0.0 total 12
BashTAG=g ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh 2>&1 | grep -v "png" && NOBUILD=1 TAG=gh SPEC='{"hide":["dress"]}' ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh 2>&1 | tail -1 && cd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 sheet.py g shots/sheet.png 1.0 && python3 sheet.py g shots/g_sheet.png 0.6 && python3 sheet.py gh shots/sheet_no_dress.png 0.6
command
TAG=g ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh 2>&1 | grep -v "png" && NOBUILD=1 TAG=gh SPEC='{"hide":["dress"]}' ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh 2>&1 | tail -1 && cd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 sheet.py g shots/sheet.png 1.0 && python3 sheet.py g shots/g_sheet.png 0.6 && python3 sheet.py gh shots/sheet_no_dress.png 0.6result, 9 lines
wren.glb 4.5 MB, 163s wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it -> ~/Projects/lowmarch-fable52/review/out/whole-clips/site 163s build 164s shoot 41s shoot 39s shots/sheet.png (1926, 2178) shots/g_sheet.png (1158, 1314) shots/sheet_no_dress.png (1158, 1314)
Read~/Projects/lowmarch-fable52/review/out/whole-clips/shots/g_sheet.png
input
{ "file_path": "~/Projects/lowmarch-fable52/review/out/whole-clips/shots/g_sheet.png" }result
no output
Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips/shots && python3 -c "
command
cd ~/Projects/lowmarch-fable52/review/out/whole-clips/shots && python3 -c " from PIL import Image a=Image.open('g_idle_0.0.png').crop((250,150,550,350)).resize((600,400)) b=Image.open('g_attack_0.38.png').crop((250,80,550,280)).resize((600,400)) c=Image.open('gh_attack_0.68.png').crop((250,180,550,380)).resize((600,400)) s=Image.new('RGB',(1800,400)); [s.paste(x,(600*i,0)) for i,x in enumerate((a,b,c))]; s.save('zoom.png')"result, 1 line
(Bash completed with no output)
Read~/Projects/lowmarch-fable52/review/out/whole-clips/shots/zoom.png
input
{ "file_path": "~/Projects/lowmarch-fable52/review/out/whole-clips/shots/zoom.png" }result
no output
Read~/Projects/lowmarch-fable52/tools/whole/clips2h.py
input
{ "file_path": "~/Projects/lowmarch-fable52/tools/whole/clips2h.py" }result, 302 lines
1 """Two-handed longsword clips for a whole character (tools/whole/build.py, WHOLE_STANCE=longsword). 2 3 clips(vrm, shape) -> {"idle": [(t, pose), ...], "attack": [(t, pose), ...]} 4 5 The sword is rigid on the right hand (outfit.sword); the left fist closes on the same grip SPAN further 6 down, toward the pommel. A clip is a few keys of plain numbers (how low and turned the body is, where the 7 lead foot is, where the right fist sits from the chest, where the blade points), eased between with 8 Hermite curves and solved at every sample: feet planted or stepped with leg IK and kept flat, both hands 9 gripped with duel.clear_grip (the elbows tried until the arms clear the body), the head turned back level 10 toward the enemy. Solving every sample rather than blending a few solved poses keeps both fists on the 11 grip and the hands on arcs between keys. 12 13 Guard: a middle guard, left foot forward, hips bladed and sunk, the fists before the navel and the point 14 up at the enemy's face. Attack: the blade drawn up and back over the right shoulder as the weight settles 15 back, a descending diagonal cut from the right shoulder through the enemy with a lunge of the lead foot 16 and the hips and shoulders turning the right side through, a follow-through low on the left, then a step 17 back up into the guard. 18 """ 19 import numpy as np 20 from scipy.spatial.transform import Rotation 21 22 import poses as P 23 from clips import sink 24 from rig import Rig, grip_points, rot_between 25 26 SWORD_FIST = (0.045, -0.018, 0.0) # outfit.sword: the grip's axis in the right hand's frame 27 SPAN = 0.095 # the left fist this far down the grip from the right (duel.py) 28 29 # A key: hips down (drop) and forward (fwd), the hips' and the shoulders' turn (degrees, + brings the right 30 # side forward), forward lean, the lead (left) foot's step and lift, the right fist from the upper chest in the 31 # chest's own frame (+x her right, -z forward, turned and leaned with her), the blade's direction in model 32 # space, each elbow's preferred direction, and how far down the gaze tips. 33 GUARD = dict(drop=0.06, fwd=0.0, hip=-22.0, turn=-8.0, lean=6.0, lead=0.0, lift=0.0, 34 fist=(0.02, -0.15, -0.38), blade=(-0.05, 0.55, -0.83), 35 poleR=(1.0, -0.4, 0.0), poleL=(-0.8, -1.0, 0.2), gaze=-0.06) 36 BREATH = dict(drop=0.075, lean=8.5, fist=(0.02, -0.16, -0.375), blade=(-0.05, 0.50, -0.86)) # the low end 37 IDLE_LOOP, IDLE_STEP, BLADE_LAG = 2.0, 0.2, 0.1 38 # elbow directions tried after a key's own when its arm meets the body (right arm; mirrored for the left) 39 POLES = [(1.0, -0.5, 0.0), (1.0, -0.2, -0.5), (0.6, -1.0, -0.4), (1.0, -0.2, 0.4), (1.0, 0.3, -0.2)] 40 41 42 def key(**kw): 43 return dict(GUARD, **kw) 44 45 46 # (time, key, hold): a held key eases in and out (no velocity through it) 47 ATTACK = [ 48 (0.0, key(), True), 49 (0.2, key(drop=0.065, fwd=-0.02, hip=-26.0, turn=-26.0, lean=3.0, fist=(0.12, 0.0, -0.22), 50 blade=(0.38, 0.82, 0.42), poleR=(1.0, -0.6, 0.2), poleL=(-0.2, -0.8, -1.0)), False), 51 (0.32, key(drop=0.07, fwd=-0.05, hip=-30.0, turn=-38.0, lean=0.0, fist=(0.042, 0.08, -0.25), 52 blade=(0.30, 0.70, 0.65), poleR=(1.0, -0.6, 0.2), poleL=(-0.2, -0.8, -1.0)), False), 53 (0.44, key(drop=0.08, fwd=-0.06, hip=-32.0, turn=-42.0, lean=-1.0, fist=(0.07, 0.10, -0.23), 54 blade=(0.32, 0.55, 0.77), poleR=(1.0, -0.6, 0.2), poleL=(-0.2, -0.8, -1.0)), True), 55 (0.5, key(drop=0.08, fwd=0.06, hip=-4.0, turn=-10.0, lean=4.0, lead=0.13, lift=0.06, fist=(0.067, 0.141, -0.307), 56 blade=(0.15, 0.90, -0.40)), False), 57 (0.56, key(drop=0.11, fwd=0.13, hip=10.0, turn=22.0, lean=14.0, lead=0.26, fist=(0.15, 0.05, -0.42), 58 blade=(-0.30, -0.40, -0.87)), False), 59 (0.62, key(drop=0.12, fwd=0.13, hip=13.0, turn=24.0, lean=17.0, lead=0.26, fist=(0.07, -0.05, -0.36), 60 blade=(-0.45, -0.70, -0.50)), False), 61 (0.68, key(drop=0.12, fwd=0.13, hip=14.0, turn=34.5, lean=19.7, lead=0.26, fist=(0.004, -0.194, -0.232), 62 blade=(-0.47, -0.58, 0.53), poleL=(-1.0, -0.4, 0.4)), False), 63 (0.9, key(drop=0.11, fwd=0.13, hip=13.0, turn=21.3, lean=21.0, lead=0.26, fist=(-0.020, -0.135, -0.289), 64 blade=(-0.60, -0.54, 0.70), poleL=(-1.0, -0.6, -0.3)), True), 65 (1.05, key(drop=0.11, fwd=0.13, hip=13.0, turn=21.3, lean=21.0, lead=0.26, fist=(-0.020, -0.135, -0.289), 66 blade=(-0.60, -0.54, 0.70), poleL=(-1.0, -0.6, -0.3)), True), 67 (1.15, key(drop=0.10, fwd=0.12, hip=4.0, turn=16.0, lean=15.0, lead=0.21, lift=0.02, fist=(0.016, -0.129, -0.362), 68 blade=(-0.50, -0.42, -0.22), poleL=(-1.0, 0.0, 0.0)), False), 69 (1.25, key(drop=0.08, fwd=0.06, hip=-8.0, turn=6.0, lean=10.0, lead=0.12, lift=0.04, fist=(0.03, -0.17, -0.36), 70 blade=(-0.45, 0.10, -0.85)), False), 71 (1.5, key(), True), 72 ] 73 SAMPLES = [0.0, 0.1, 0.2, 0.26, 0.32, 0.38, 0.44, 0.47, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, 0.78, 0.9, 1.05, 74 1.1, 1.15, 1.2, 1.25, 1.35, 1.42, 1.5] 75 76 77 STEADY = ("lead", "lift") # eased to a stop at every key: a foot that overshoots slides or sinks 78 79 80 def hermite(keys, t): 81 """The keys' numbers at time t: cubic Hermite, tangents from the neighbours (zero on held keys and for STEADY).""" 82 ts = [k[0] for k in keys] 83 i = max(0, min(len(keys) - 2, int(np.searchsorted(ts, t, side="right")) - 1)) 84 (t0, a, h0), (t1, b, h1) = keys[i], keys[i + 1] 85 s = (t - t0) / (t1 - t0) 86 87 def tan(j): 88 if keys[j][2] or j == 0 or j == len(keys) - 1: 89 return {n: 0 * np.asarray(v, float) for n, v in keys[j][1].items()} 90 (tp, kp, _), (tn, kn, _) = keys[j - 1], keys[j + 1] 91 return {n: 0 * np.asarray(kp[n], float) if n in STEADY else (np.asarray(kn[n], float) - np.asarray(kp[n], float)) / (tn - tp) 92 for n in kp} 93 m0, m1 = tan(i), tan(i + 1) 94 h00, h10, h01, h11 = 2 * s ** 3 - 3 * s * s + 1, s ** 3 - 2 * s * s + s, -2 * s ** 3 + 3 * s * s, s ** 3 - s * s 95 dt = t1 - t0 96 return {n: h00 * np.asarray(a[n], float) + h10 * dt * m0[n] + h01 * np.asarray(b[n], float) + h11 * dt * m1[n] 97 for n in a} 98 99 100 class FastRig(Rig): 101 """Rig.world without vroid_portrait.bone_pose's walk over every node per call (most of a solve's time): 102 where a shape only adds a fixed adjustment before each bone's pose (arm_out, shoulder_w; no scales or 103 curl), the posed matrices are that adjustment times the pose, over cached rest matrices. Checked against 104 the slow path on two poses; any mismatch keeps the slow path.""" 105 106 def __init__(self, vrm, shape=None): 107 super().__init__(vrm, shape, ortho=True) 108 nodes = vrm.j["nodes"] 109 self._rest = [vrm.local_matrix(i, None) for i in range(len(nodes))] 110 self._name = [n.get("name") for n in nodes] 111 order, seen = [], set() 112 113 def visit(i): 114 if i in seen: 115 return 116 if i in self._par: 117 visit(self._par[i]) 118 seen.add(i) 119 order.append(i) 120 for i in range(len(nodes)): 121 visit(i) 122 self._order = order 123 self._pre = {k: P.as4(m) for k, m in self._bp(vrm, self.shape, {}).items()} 124 self.fast = False 125 probe = [P.BATTLE_IDLE, P.merge(P.BUST, {"J_Bip_C_Hips": P.move(0.01, -0.05, 0.02, P.rot((0, 1, 0), 20)), 126 "J_Bip_R_LowerArm": P.rot((1, 1, 0), 40)})] 127 slow = [Rig.world(self, p) for p in probe] 128 self.fast = True 129 self.fast = all(max(np.abs(a[i] - b[i]).max() for i in a) < 1e-9 130 for a, b in zip(slow, (self.world(p) for p in probe))) 131 132 def world(self, pose): 133 if not self.fast: 134 return Rig.world(self, pose) 135 out = {} 136 for i in self._order: 137 nm = self._name[i] 138 m = self._rest[i] 139 adj = pose.get(nm) 140 pre = self._pre.get(nm) 141 if adj is not None: 142 adj = P.as4(adj) 143 m = m @ (pre @ adj if pre is not None else adj) 144 elif pre is not None: 145 m = m @ pre 146 out[i] = out[self._par[i]] @ m if i in self._par else m 147 return out 148 149 150 def grip(rig, pose, side, ref, fist, D, pole, local=(0, 0, -1), iters=4): 151 """rig.grip in a few world solves: aim the hand, then move the wrist by the fist's miss and re-solve the arm 152 (analytic IK), a few rounds; the hand's aim is restored after each (the arm's turn carries it off).""" 153 hd = f"J_Bip_{side}_Hand" 154 T = np.asarray(fist, float) 155 fr = ref[f"fist_{side}"] 156 W0 = rig.world(P.BUST)[rig.names[hd]] 157 off0 = fr - W0[:3, 3] # the fist from the wrist, in the reference pose 158 R0 = W0[:3, :3] 159 wrist = T - (rig.held(pose, hd, P.BUST, fr) - rig.pos(pose, hd)) 160 for _ in range(iters): 161 pose = rig.arm_ik(pose, side, wrist, pole) 162 W = rig.world(pose)[rig.names[hd]] 163 pose = rig.rotate_world(pose, hd, rot_between(W[:3, :3] @ np.asarray(local, float), D)) 164 W = rig.world(pose)[rig.names[hd]] 165 f = W[:3, :3] @ np.linalg.solve(R0, off0) + W[:3, 3] 166 miss = T - f 167 if np.linalg.norm(miss) < 1.5e-3: 168 break 169 wrist = W[:3, 3] + miss 170 return pose 171 172 173 def clear_grip(rig, body, pose, side, ref, fist, D, poles, need=0.012): 174 """grip, trying elbow directions in turn until the arm clears the body by `need` (else the clearest).""" 175 limbs = [f"{side}_UpperArm", f"{side}_LowerArm", f"{side}_Hand"] 176 best = None 177 for pole in poles: 178 p = grip(rig, pose, side, ref, fist, D, pole) 179 cl = body.worst(p, limbs) 180 if cl >= need: 181 return p 182 if best is None or cl > best[0]: 183 best = (cl, p) 184 return best[1] 185 186 187 class Fighter: 188 def __init__(self, vrm, shape=None): 189 from checks import Body 190 self.rig = FastRig(vrm, shape) 191 self.body = Body(vrm, shape) 192 rig = self.rig 193 self.base = P.merge(P.BATTLE_IDLE, P.fist("L")) 194 W = rig.world(P.BUST)[rig.names["J_Bip_R_Hand"]] 195 R = W[:3, :3] / np.linalg.norm(W[:3, :3], axis=0) 196 self.ref = dict(ref_pose=P.BUST, fist_R=W[:3, 3] + R @ np.array(SWORD_FIST), 197 fist_L=grip_points(vrm, rig.shape, P.BUST)["L"]["point"]) 198 # the stance's feet: where the battle idle puts them, at the rest pose's height and flat as in the rest pose 199 # (the idle's own feet float a centimetre, the lead one toe up) 200 self.foot = {s: rig.pos(self.base, f"J_Bip_{s}_Foot") * [1, 0, 1] + [0, rig.pos({}, f"J_Bip_{s}_Foot")[1], 0] 201 for s in "LR"} 202 self.toe = {s: rig.pos({}, f"J_Bip_{s}_ToeBase") - rig.pos({}, f"J_Bip_{s}_Foot") for s in "LR"} 203 self.chest0 = self._rot(rig.world(P.BUST)[rig.names["J_Bip_C_UpperChest"]]) 204 Wh = rig.world(P.BUST)[rig.names["J_Bip_C_Head"]][:3, :3] 205 Q = self._rot(Wh) 206 self.head_f, self.head_u = Q.T @ np.array([0, 0, -1.0]), Q.T @ np.array([0, 1.0, 0]) 207 208 @staticmethod 209 def _rot(M): 210 u, _, vt = np.linalg.svd(M[:3, :3]) 211 return u @ vt 212 213 def sword(self, pose): 214 """The grip's axis point under the right fist and the blade's direction, in model space.""" 215 rig = self.rig 216 a = rig.held(pose, "J_Bip_R_Hand", P.BUST, self.ref["fist_R"]) 217 d = self._rot(rig.world(pose)[rig.names["J_Bip_R_Hand"]]) @ np.array([0, 0, -1.0]) 218 return a, d / np.linalg.norm(d) 219 220 def flat(self, pose, side, yaw): 221 """Turn the foot so heel to toe runs as in the base stance, turned `yaw` degrees (- toes out to her right).""" 222 rig = self.rig 223 cur = rig.pos(pose, f"J_Bip_{side}_ToeBase") - rig.pos(pose, f"J_Bip_{side}_Foot") 224 return rig.rotate_world(pose, f"J_Bip_{side}_Foot", P.rot((0, 1, 0), yaw) @ rot_between(cur, self.toe[side])) 225 226 def girdle(self, pose, side, target, share=0.3, cap=20.0): 227 """Swing the clavicle (the Shoulder bone) a share of the way toward where the arm reaches, at most `cap` 228 degrees: the shoulder comes forward across the body on a long reach, as a real shoulder girdle does, 229 instead of leaving the arm to reach alone (straight, and through the chest).""" 230 rig = self.rig 231 S = rig.pos(pose, f"J_Bip_{side}_Shoulder") 232 U = rig.pos(pose, f"J_Bip_{side}_UpperArm") 233 a, b = (U - S) / np.linalg.norm(U - S), (target - S) / np.linalg.norm(target - S) 234 ang = np.degrees(np.arccos(np.clip(a @ b, -1, 1))) 235 if ang < 1e-3: 236 return pose 237 axis = np.cross(a, b) 238 return rig.rotate_world(pose, f"J_Bip_{side}_Shoulder", P.rot(axis, min(ang * share, cap))) 239 240 def look(self, pose, down, neck=0.4): 241 """Turn the neck (a share) and the head so she faces -z (the enemy), level, the gaze tipped down a little.""" 242 rig = self.rig 243 g = np.array([0.0, down, -1.0]) 244 g /= np.linalg.norm(g) 245 up = np.array([0.0, 1.0, 0.0]) - g * g[1] 246 up /= np.linalg.norm(up) 247 want = np.c_[g, up, np.cross(g, up)] 248 for bone, share in (("J_Bip_C_Neck", neck), ("J_Bip_C_Head", 1.0)): 249 Q = self._rot(rig.world(pose)[rig.names["J_Bip_C_Head"]]) 250 f, u = Q @ self.head_f, Q @ self.head_u 251 have = np.c_[f, u, np.cross(f, u)] 252 R = Rotation.from_matrix(want @ have.T).as_rotvec() * share 253 pose = rig.rotate_world(pose, bone, Rotation.from_rotvec(R).as_matrix()) 254 return pose 255 256 def solve(self, k): 257 rig = self.rig 258 twist = k["turn"] - k["hip"] 259 pose = P.merge(self.base, { 260 "J_Bip_C_Hips": P.move(0, -k["drop"], -k["fwd"], P.rot((0, 1, 0), k["hip"]) @ P.rot((1, 0, 0), -k["lean"] * 0.6)), 261 "J_Bip_C_Spine": P.rot((0, 1, 0), twist * 0.55) @ P.rot((1, 0, 0), -k["lean"] * 0.25), 262 "J_Bip_C_Chest": P.rot((0, 1, 0), twist * 0.45) @ P.rot((1, 0, 0), -k["lean"] * 0.15)}) 263 pose = rig.leg_ik(pose, "L", self.foot["L"] + np.array([-0.05, k["lift"], -0.10 - k["lead"]]), pole=(-0.1, 0, -1)) 264 pose = rig.leg_ik(pose, "R", self.foot["R"] + np.array([0.05, 0, 0.17]), pole=(0.3, -0.2, -1)) 265 pose = self.flat(pose, "L", 0.0) 266 pose = self.flat(pose, "R", -35.0) 267 W = rig.world(pose)[rig.names["J_Bip_C_UpperChest"]] 268 fr = W[:3, 3] + self._rot(W) @ self.chest0.T @ np.asarray(k["fist"], float) 269 D = np.asarray(k["blade"], float) 270 D /= np.linalg.norm(D) 271 pose = self.girdle(pose, "R", fr) 272 pose = self.girdle(pose, "L", fr - D * SPAN) 273 pose = clear_grip(rig, self.body, pose, "R", self.ref, fr, D, [k["poleR"]] + POLES) 274 a, d = self.sword(pose) 275 mirror = np.array([-1.0, 1.0, 1.0]) 276 pose = clear_grip(rig, self.body, pose, "L", self.ref, a - d * SPAN, d, 277 [k["poleL"]] + [tuple(np.asarray(q) * mirror) for q in POLES]) 278 return self.look(pose, float(k["gaze"])) 279 280 281 def guard_at(t): 282 """The guard's numbers at time t of the idle loop: the body sinks (clips.sink), the blade a beat behind.""" 283 k, kb = sink(t), sink(t - BLADE_LAG) 284 out = dict(GUARD) 285 for n in ("drop", "lean"): 286 out[n] = GUARD[n] + (BREATH[n] - GUARD[n]) * k 287 out["fist"] = tuple(np.asarray(GUARD["fist"]) + (np.asarray(BREATH["fist"]) - GUARD["fist"]) * k) 288 out["blade"] = tuple(np.asarray(GUARD["blade"]) + (np.asarray(BREATH["blade"]) - GUARD["blade"]) * kb) 289 return out 290 291 292 def clips(vrm, shape=None, f=None): 293 f = f or Fighter(vrm, shape) 294 n = int(round(IDLE_LOOP / IDLE_STEP)) 295 idle = [(round(i * IDLE_STEP, 3), f.solve(guard_at(i * IDLE_STEP))) for i in range(n)] 296 idle.append((IDLE_LOOP, idle[0][1])) 297 rest = guard_at(0.0) # the attack leaves and rejoins the idle's first pose 298 keys = [(ATTACK[0][0], rest, True)] + ATTACK[1:-1] + [(ATTACK[-1][0], rest, True)] 299 attack = [(t, f.solve(hermite(keys, t))) for t in SAMPLES[1:-1]] 300 attack = [(0.0, idle[0][1])] + attack + [(SAMPLES[-1], idle[0][1])] 301 return {"idle": idle, "attack": attack} 302Bashcd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF'
command
cd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF' s=open('clips2h.py').read() rep=[ ('''The sword is rigid on the right hand (outfit.sword); the left fist closes on the same grip SPAN further down, toward the pommel. A clip is a few keys of plain numbers (how low and turned the body is, where the lead foot is, where the right fist sits from the chest, where the blade points), eased between with Hermite curves and solved at every sample: feet planted or stepped with leg IK and kept flat, both hands gripped with duel.clear_grip (the elbows tried until the arms clear the body), the head turned back level toward the enemy. Solving every sample rather than blending a few solved poses keeps both fists on the grip and the hands on arcs between keys. ''','''The sword is rigid on the right hand (outfit.sword); the left fist closes on the same grip SPAN further down, toward the pommel. A clip is a few keys of plain numbers (how low and turned the body is, where the lead foot is, where the right fist sits in the chest's frame, where the blade points), eased between with Hermite curves and solved at every sample: feet planted or stepped with leg IK and kept flat, the clavicles swung a little toward the reach, both hands gripped (clear_grip: elbow directions tried until the arm clears checks.Body), the head turned back level toward the enemy. Solving every sample rather than blending a few solved poses keeps both fists on the grip and the hands on arcs between keys. The fist sits in the chest's frame because on this body the arms meet the bust: a fist placed in model space put the upper arms through it whenever the shoulders turned. '''), (''' return {n: 0 * np.asarray(kp[n], float) if n in STEADY else (np.asarray(kn[n], float) - np.asarray(kp[n], float)) / (tn - tp) for n in kp}''',''' return {n: 0 * np.asarray(kp[n], float) if n in STEADY else (np.asarray(kn[n], float) - np.asarray(kp[n], float)) / (tn - tp) for n in kp}'''), (''' self.fast = True self.fast = all(''',''' self.fast = True # (so self.world takes the fast path for the check) self.fast = all('''), (''' """Turn the foot so heel to toe runs as in the base stance, turned `yaw` degrees (- toes out to her right)."""''', ''' """Turn the foot so heel to toe runs flat as in the rest pose, turned `yaw` degrees (- toes out to her right)."""'''), ('''def clips(vrm, shape=None, f=None): ''','''def clips(vrm, shape=None, f=None): """The idle (a 2 s loop sampled every IDLE_STEP) and the attack (ATTACK solved at SAMPLES), both starting from the same guard pose. f: a Fighter already made for this vrm and shape.""" '''), ] for a,b in rep: assert s.count(a)==1,a[:50]; s=s.replace(a,b) open('clips2h.py','w').write(s) EOF grep -n "—" clips2h.py; awk 'length > 120 {print FILENAME": "FNR": "length}' clips2h.py; python3 -m pyflakes clips2h.py 2>/dev/null || python3 -m flake8 --max-line-length 120 clips2h.py 2>/dev/null | head; echo doneresult, 4 lines
clips2h.py: 223: 121 clips2h.py: 262: 126 clips2h.py: 265: 122 done
Bashcd ~/Projects/lowmarch-fable52 && awk 'length > 120' tools/clips.py tools/duel.py tools/whole/build.py | wc -l; awk '{ if (length > m) m = length } END { print m }' tools/clips.py tools/whole/build.py; sed -n '223p;262p;265p' tools/whole/clips2h.py; cat setup.cfg tox.ini .flake8 pyproject.toml 2>/dev/null | grep -i "line"
command
cd ~/Projects/lowmarch-fable52 && awk 'length > 120' tools/clips.py tools/duel.py tools/whole/build.py | wc -l; awk '{ if (length > m) m = length } END { print m }' tools/clips.py tools/whole/build.py; sed -n '223p;262p;265p' tools/whole/clips2h.py; cat setup.cfg tox.ini .flake8 pyproject.toml 2>/dev/null | grep -i "line"result, 5 lines
6 134 """Turn the foot so heel to toe runs flat as in the rest pose, turned `yaw` degrees (- toes out to her right).""" "J_Bip_C_Hips": P.move(0, -k["drop"], -k["fwd"], P.rot((0, 1, 0), k["hip"]) @ P.rot((1, 0, 0), -k["lean"] * 0.6)), pose = rig.leg_ik(pose, "L", self.foot["L"] + np.array([-0.05, k["lift"], -0.10 - k["lead"]]), pole=(-0.1, 0, -1))Bashcd ~/Projects/lowmarch-fable52 && time (LOWMARCH_SITE=whole-clips WHOLE_STANCE=longsword OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 tools/whole/build.py arm_f_slender wren 2>&1 | tail -8) && python3 -c "
command
cd ~/Projects/lowmarch-fable52 && time (LOWMARCH_SITE=whole-clips WHOLE_STANCE=longsword OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 tools/whole/build.py arm_f_slender wren 2>&1 | tail -8) && python3 -c " import json; c=json.load(open('review/out/whole-clips/site/checks.json'))['wren'] print(c['summary']); print(len(c['through']),'through'); print(c['layers']['summary']) for it in c['touching']: print(' ~', it['text']) for it in c['layers']['items'][:6]: print(' L', it['text']) "result, 35 lines
wren.glb 4.5 MB, 94s wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it -> ~/Projects/lowmarch-fable52/review/out/whole-clips/site 94s real 1m34.854s user 1m2.374s sys 0m2.108s wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it 0 through wren: plate check skipped (WHOLE_LAYERS=1 runs it) ~ wren, idle at 0.00 s: left upper arm 1.1 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 0.20 s: left upper arm 1.1 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 0.40 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 0.60 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 0.80 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 1.00 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 1.20 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 1.40 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 1.60 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 1.80 s: left upper arm 1.1 cm from the body; right upper arm 1.4 cm from the body ~ wren, idle at 2.00 s: left upper arm 1.1 cm from the body; right upper arm 1.4 cm from the body ~ wren, attack at 0.00 s: left upper arm 1.1 cm from the body; right upper arm 1.4 cm from the body ~ wren, attack at 0.10 s: left upper arm 0.9 cm from the body ~ wren, attack at 0.65 s: right upper arm 0.7 cm from the body; left upper arm 1.2 cm from the body ~ wren, attack at 0.68 s: left upper arm 0.9 cm from the body; right upper arm 0.9 cm from the body ~ wren, attack at 0.78 s: right upper arm 0.7 cm from the body ~ wren, attack at 0.90 s: right upper arm 0.3 cm from the body ~ wren, attack at 1.05 s: right upper arm 0.3 cm from the body ~ wren, attack at 1.10 s: right upper arm 0.7 cm from the body ~ wren, attack at 1.15 s: left upper arm 0.6 cm from the body; right upper arm 1.1 cm from the body ~ wren, attack at 1.20 s: left upper arm 0.8 cm from the body ~ wren, attack at 1.25 s: left upper arm 0.8 cm from the body ~ wren, attack at 1.35 s: left upper arm 0.8 cm from the body; right upper arm 1.3 cm from the body ~ wren, attack at 1.42 s: left upper arm 1.0 cm from the body; right upper arm 1.4 cm from the body ~ wren, attack at 1.50 s: left upper arm 1.1 cm from the body; right upper arm 1.4 cm from the body
Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && sed -i 's/^SHORT = False/SHORT = True/' t.py && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py 2>&1 | grep "^idle\|^attack" | python3 -c "
command
cd ~/Projects/lowmarch-fable52/review/out/whole-clips && sed -i 's/^SHORT = False/SHORT = True/' t.py && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 t.py 2>&1 | grep "^idle\|^attack" | python3 -c " import sys,re rows=[l for l in sys.stdin] def col(pat): v=[(float(re.search(pat,l).group(1)),l.split('|')[0][:12]) for l in rows]; return min(v) for name,pat in [('blade-head/hair',r'hd +([\d.]+)'),('grip+hands-head/hair',r'hd +[\d.]+ +([\d.]+)'),('pauldron zone',r'paul +([\d.]+)'),('blade-legs',r'legs +([\d.]+)'),('tip y',r'tip +([\d.]+)'),('off',r'off +([\d.]+)')]: print(name, col(pat)) print('max off', max(float(re.search(r'off +([\d.]+)',l).group(1)) for l in rows), 'span range', min(float(re.search(r'span +([\d.]+)',l).group(1)) for l in rows), max(float(re.search(r'span +([\d.]+)',l).group(1)) for l in rows)) print('max hipext R', max(int(re.search(r'hipext R *(-?\d+)',l).group(1)) for l in rows)) print('elbows', min(int(re.search(r'elb R *(\d+)',l).group(1)) for l in rows), max(int(re.search(r'elb R *(\d+)',l).group(1)) for l in rows), min(int(re.search(r'L *(\d+) reach',l).group(1)) for l in rows), max(int(re.search(r'L *(\d+) reach',l).group(1)) for l in rows)) "result, 10 lines
blade-head/hair (13.9, 'attack 0.44 ') grip+hands-head/hair (14.0, 'attack 0.44 ') pauldron zone (14.5, 'attack 0.44 ') blade-legs (6.5, 'attack 0.68 ') tip y (0.14, 'attack 0.65 ') off (0.0, 'attack 0.26 ') max off 0.2 span range 9.5 9.5 max hipext R 15 elbows 54 113 50 118 [This command modified 1 file you've previously read: ../../whole-clips/t.py. Call Read before editing.]
Bashcd ~/Projects/lowmarch-fable52 && git status --short && git diff --stat
command
cd ~/Projects/lowmarch-fable52 && git status --short && git diff --stat
result, 12 lines
M tools/whole/stage/stage.html M tools/whole/wren.py ?? tools/whole/clips2h.py ?? tools/whole/export_model.py ?? tools/whole/lens_frame.json ?? tools/whole/lens_shot.py ?? tools/whole/patch_lens_flattice.py ?? tools/whole/shots/ ?? tools/whole/stage_clip.py tools/whole/stage/stage.html | 6 +++--- tools/whole/wren.py | 17 ++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-)
agent
+1:09:00I wrote tools/whole/clips2h.py and the contact sheet. The final build reports no arm through the body in either clip, and both fists stay on the grip in every sample. The weak spot is the follow-through at 0.68 to 1.05 s: from this camera the blade is hidden behind her body and the long dress, so those frames read as "hands at the belt holding a hilt". Nothing is committed and no existing repo file was edited by me.
Deliverables
~/Projects/lowmarch-fable52/tools/whole/clips2h.py~/Projects/lowmarch-fable52/review/out/whole-clips/shots/sheet.png(1926x2178, eight 960x540 tiles: idle 0.0 and 1.0 s; attack 0.20, 0.38, 0.56, 0.68, 0.90, 1.30 s)- Extra:
review/out/whole-clips/shots/sheet_no_dress.png, the same frames with thedressgroup hidden. It's the better guide to what the clips will look like in the shorter costume.
How it works
- Each clip is a few keys of plain numbers: hips drop and shift, hip and shoulder turn, lean, lead-foot step and lift, right-fist offset, blade direction and elbow hints. The keys are eased with Hermite curves and solved fresh at every sample: 25 attack samples and 10 idle samples, the idle loop closing on its first pose.
- At each sample:
- The feet are set with leg IK, flat at rest height.
- The clavicles swing up to 30% (capped at 20°) toward the reach.
- The right fist is gripped, then the left fist lands on the actual sword axis 9.5 cm down the grip, with elbow directions retried until the arm clears
checks.Body. - The neck and head turn back level toward the enemy.
- The right fist is placed in the chest's own frame, not in model space. On this body the upper arms meet the bust, and model-space hands put them through it whenever the shoulders turned.
- Speed: rig.grip plus vroid_portrait.bone_pose made the first solve take about 500 s. A
FastRigwith cached rest matrices (it checks itself against the slow path and falls back on any mismatch) plus a 4-round grip brought the solve down to 7 to 20 s.
Guard (idle): a middle guard. Left foot forward, rear foot turned out 35°, hips bladed 22° and sunk 6 cm. The fists sit before the navel with elbows bent about 110°, and the point is up at the enemy's face. The 2 s breathing loop reuses the polearm's clips.sink curve, with the blade dipping a beat behind the body.
Attack:
| Time (s) | What happens |
|---|---|
| 0.20 | Blade rising on the right |
| 0.32 to 0.44 | Wind over the right shoulder, weight back, shoulders turned 42°; 0.44 is a held key |
| 0.50 | Blade up over the head, lead foot in the air (6 cm lift) |
| 0.56 | Cut: lunge 26 cm, hips and shoulders turned +10/+22°, lean 14° |
| 0.62 | Blade down |
| 0.68 | Overshoot low left: shoulders +34°, blade trailing down and back |
| 0.90 to 1.05 | Settle |
| 1.15 to 1.5 | Step back up into the guard |
Final build check lines
wren: 36 keyframes checked; no arm through the body, 25 with an arm resting on it
All 25 "resting" lines are at 0.3 to 1.4 cm outside the skin. The tightest is the right upper arm at 0.3 cm (attack 0.90 and 1.05 s). The plate-over-garment layer check did not run: build.py in this worktree now skips it unless WHOLE_LAYERS=1, and that change came from someone else.
Measured margins over all 36 samples
- Hands on the grip: fist spacing 9.5 cm in every sample, left fist at most 0.2 cm off the axis.
- Head and hair: blade at least 13.9 cm from the posed head and hair mesh; grip and hands at least 14.0 cm (both tightest at 0.44 s).
- Pauldron: blade and right hand at least 14.5 cm from an assumed pauldron zone (left shoulder skin pushed out 5.5 cm).
- Legs and ground: blade at least 6.5 cm from the leg skin (0.68 s); tip never below 0.14 m.
- Feet: the rear foot is fixed exactly (no drift, ankle at 0.103 every sample). The lead foot only moves during its two steps.
- Hips and elbows: rear-hip extension at most 15°. Elbows range from 50° to 118°, never locked straight.
What still looks wrong (blunt)
- Follow-through doesn't read. Her left side faces away from this camera, so a low-left follow-through always sits behind her. The shorter surcoat will help, but even with the dress hidden only part of the blade shows behind her thigh.
- The cut reads more like a thrust in a still frame. At 0.56 s her arms are extended with the blade forward-down. The diagonal only shows in the motion from 0.50 (blade up) to 0.62 (blade down).
- At 0.20 s the rising blade crosses her face in the picture, though it's about 20 cm in front of it.
- Arms rest on the chest in most keys (0.3 to 1.4 cm). With a cuirass, the arm plates will touch it. The bust is the limiting shape.
- The guard is compact: hands close to the chest. In the default placement her point overlaps the soldier's halberd head; that's placement, not the clip.
- Checks are static, at the solved samples only. Hair is spring-simulated and the export blends linearly between samples, so the moments in between aren't checked.
Wall time (rough)
| Step | Time |
|---|---|
| Solve, first version | about 500 s |
| Solve, after the speed-up | 7 to 20 s |
| Build | 39 to 163 s per run (machine load varied; the final run took 94 s wall, 62 s user), 8 builds |
| Shoot | about 6 s per frame alone; 8 frames in parallel took 20 to 40 s, about 12 rounds |
Most of the session went into tuning keys against the arm checks, using headless scripts.
Changes you may want elsewhere (I didn't make them)
build.py: nothing needed.shoot.py: a relativeWHOLE_SITEsilently fails, because the patched copy symlinks into a temp dir and the links break. Wrapping the site path inos.path.abspath(...)fixes it.outfit.sword(or the new costume):- The right fist sits about 10 cm below the guard, since the fist is at 55% of
grip_lenand the guard is 9.5 cm beyond it. That's a visible gap, not "just under the cross-guard". Putting the fist about 4 to 5 cm from the guard end of the grip would fix it. - Its fixed fist offset puts the grip axis about 2 cm off the hand hole that
grip_pointsmeasures.
- The right fist sits about 10 cm below the guard, since the fist is at 55% of
My scratch tools (h.py, t.py checks, rnd.py/grid.py key searches, viz.py, shots.sh, sheet.py) are under review/out/whole-clips/, which is git-ignored. The other modified and untracked files in the worktree (wren.py, stage/, lens_*, export_model.py, stage_clip.py, shots/) aren't mine.

