/ anatomy/ calculate-digitigrade-male Calculate digitigrade-male transformation of Harmony:|| Preface
Harmony:|| is constructed from female digitigrade wolfy anatomy.
But…I have to make digitigrade male structure. Additionally, I want to take it easy! I don’t like iterations!
Then, I’ll tackle to this problem, from basic algebra.
Before Calculation…
To begin with, structural state of Harmony:|| is female digitigrade state S (d,f) S_{\text{(d,f)}} S (d,f) .
I made “MUKIMUKI Comfy(Muscular Blobcat with a blanket)”.
WTF
It has male plantigrade structural state S (p,m) S_{\text{(p,m)}} S (p,m) .
And, I made plantigrade female transform file including plantigrade female state S (p,f) S_{\text{(p,f)}} S (p,f) while making it.
I would like to reuse those.
Concept of Calculate S (d,m) S_{\text{(d,m)}} S (d,m)
I already have state matrices S (d,f) S_{\text{(d,f)}} S (d,f) , S (p,f) S_{\text{(p,f)}} S (p,f) and S (p,m) S_{\text{(p,m)}} S (p,m) .
Those matrices are conceptually expressed by
S (d,f) T (d,f)to(p,f) = S (p,f) S (p,f) T (p,f)to(p,m) = S (p,m) \begin{align*}
S_{\text{(d,f)}} T_{\text{(d,f)to(p,f)}} &= S_{\text{(p,f)}}\\
S_{\text{(p,f)}} T_{\text{(p,f)to(p,m)}} &= S_{\text{(p,m)}}
\end{align*} S (d,f) T (d,f)to(p,f) S (p,f) T (p,f)to(p,m) = S (p,f) = S (p,m)
where T T T is transform matrix.
S (d,f) S_{\text{(d,f)}} S (d,f) is identity matrix I I I , and I can calculate transform matrix directly;
I T (d,f)to(p,f) = S (p,f) ⇔ T (d,f)to(p,f) = S (p,f) S (p,f) T (p,f)to(p,m) = S (p,m) ⇔ T (p,f)to(p,m) = S (p,f) − 1 S (p,m) \begin{align*}
I T_{\text{(d,f)to(p,f)}} = S_{\text{(p,f)}} &\Leftrightarrow T_{\text{(d,f)to(p,f)}} = S_{\text{(p,f)}}\\
S_{\text{(p,f)}} T_{\text{(p,f)to(p,m)}} = S_{\text{(p,m)}} &\Leftrightarrow T_{\text{(p,f)to(p,m)}} = {S_{\text{(p,f)}}}^{-1} S_{\text{(p,m)}}
\end{align*} I T (d,f)to(p,f) = S (p,f) S (p,f) T (p,f)to(p,m) = S (p,m) ⇔ T (d,f)to(p,f) = S (p,f) ⇔ T (p,f)to(p,m) = S (p,f) − 1 S (p,m)
I assume that non-changed attributes can be ignored.
That is,
T (d,f)to(p,f) = T (d, ∙ )to(p, ∙ ) T (d,f)to(p,m) = T ( ∙ ,f )to( ∙ ,m) \begin{align*}
T_{\text{(d,f)to(p,f)}} &= T_{\text{(d,}\bullet \text{ )to(p,}\bullet \text{)}}\\
T_{\text{(d,f)to(p,m)}} &=T_{\text{(}\bullet \text{,f )to(}\bullet \text{,m)}}\\
\end{align*} T (d,f)to(p,f) T (d,f)to(p,m) = T (d, ∙ )to(p, ∙ ) = T ( ∙ ,f )to( ∙ ,m)
Then, I can calculate 2 ways transform to S (d,m) S_{\text{(d,m)}} S (d,m) , maybe.
S (p,m) T (d, ∙ )to(p, ∙ ) − 1 = method 1 S (d,m) S (d,f) T ( ∙ ,f )to( ∙ ,m) = method 2 S (d,m) \begin{align*}
S_{\text{(p,m)}} {T_{\text{(d,}\bullet \text{ )to(p,}\bullet \text{)}}}^{-1} \stackrel{\text{method 1}}{=} S_{\text{(d,m)}}\\
S_{\text{(d,f)}} T_{\text{(}\bullet \text{,f )to(}\bullet \text{,m)}} \stackrel{\text{method 2}}{=} S_{\text{(d,m)}}
\end{align*} S (p,m) T (d, ∙ )to(p, ∙ ) − 1 = method 1 S (d,m) S (d,f) T ( ∙ ,f )to( ∙ ,m) = method 2 S (d,m)
Happy Experiment Time!!
Harmony:|| has some scripts on UI panel.
Then, I have to modify a bit only!
import bpy, json
from mathutils import Matrix
fp_S_df = None #because S_df is identity matix
fp_S_pf = 'plantigrade.harmony'
fp_S_pm = 'plantigrade_male.harmony'
armature = bpy.data.objects['Harmony_armature']
with open(fp_S_pf, 'rt') as f:
data_S_pf = json.load(f)
with open(fp_S_pm, 'rt') as f:
data_S_pm = json.load(f)
for k,v in data_S_pf.items():
T_dx2px = Matrix(data_S_pf[k])
T_xf2xm = Matrix(data_S_pf[k]).inverted_safe() @ Matrix(data_S_pm[k])
S_pm = Matrix(data_S_pm[k])
armature.pose.bones[k].matrix_basis = S_pm @ T_dx2px.inverted_safe() #method 1
# armature.pose.bones[k].matrix_basis = T_xf2xm #method 2
Initial State
Target State(method 1)
Target State(method 2)
Nice.