Interpolazione pose
Due pose si possono interpolare!
basta interpolare le trasformazioni che le compongono
posa A posa B
0.5 ∙ posa A + 0.5 ∙ posa B
--- --- ---
---
Pose = keyframes
Per comprimere animazioni
keyframe A
0.75 A + 0.25 B 0.50 A + 0.50 B 0.25 A + 0.75 B keyframe B
0.50 B + 0.50 C keyframe C
animazione
“corsa”
t = 0 t = 1 t = 2 t = 3 t = 4 t = 5 t = 6
posa memorizzata posa interpolata
(on the fly)
Interpolare intere animazioni
Es: da stance a corsa
keyframe A
0.75 A + 0.25 B 0.50 A + 0.50 B 0.25 A + 0.75 B keyframe B
0.67 B + 0.33 C animazione X
“stance”
t = 0 t = 1 t = 2 t = 3 t = 4 t = 5
0.33 B + 0.67 C keyframe C t = 6
t = 7
keyframe D 0.50 D + 0.50 E
0.75 E + 0.25 F 0.50 E + 0.50 F
t = 0+k t = 1+k t = 2+k t = 3+k t = 4+k t = 5+k 0.25 E + 0.75 F keyframe F t = 6+k
t = 7+k ritardo k = 3 animazione Y
“corsa”
keyframe E
0.80 X + 0.20 Y 0.60 X + 0.40 Y 0.40 X + 0.60 Y 0.20 X + 0.80 Y 0.25 A + 0.75 B
keyframe B
0.67 B + 0.33 C 0.33 B + 0.67 C keyframe C
keyframe D 0.50 D + 0.50 E
0.75 E + 0.25 F 0.50 E + 0.50 F keyframe E
Interpolazione pose (a runtime):
transizioni fra animazioni
Es: da stance a corsa
keyframe A
0.75 A + 0.25 B 0.50 A + 0.50 B animazione X
“stance”
t = 0 t = 1 t = 2 t = 3 t = 4 t = 5 t = 6
t = 7 0.50 E + 0.50 F
t = 0+k t = 1+k t = 2+k t = 3+k t = 4+k t = 5+k 0.25 E + 0.75 F keyframe F t = 6+k
t = 7+k ritardo k = 3 animazione Y
“corsa”
0.25 A + 0.75 B keyframe B
0.67 B + 0.33 C 0.33 B + 0.67 C keyframe C
keyframe D 0.50 D + 0.50 E
0.75 E + 0.25 F keyframe E
Animazioni scheletali:
come si ottengono
Editing manuale
Animatori digitali
help da: IK, simulazioni fisiche …
Motion capture:
Cinematica diretta Cinematica inversa
Tipici task della robotica
Forward kinematics:
«da angoli (e lunghezze) a (x,y)»
banale!
soluz univoca VS
Inverse kinematics:
«da (x,y) (e lunghezze), a angoli»
non banale!
soluzioni multiple
(task: scegliere quella “migliore”)
Inverse Kinematic (IK):
un tool utile
Cinematicadiretta:
“date le trasf locali P1, P2… PN, (es, come angoli) dove finisce il piede?”
(univoco, banale)
Cinematicainversa:
“se voglio mettere il piede nella pos p, quali
P1, P2… PN, ?”
(+ vincoli, es. DoF giunti) (non univoco, non banale)
bacino (root) busto 1
spalla dx spalla sx P2
P4 P6
gamba gamba dx
sx
polpaccio busto 2 dx
P3 P7
piede collo Dx
P5 P8
P3 P1
Inverse Kinematic (IK):
un tool utile
Due tipi di utilizzo:
in preprocessing (durante il task dell’animator) in real time (task da game engine)
Esempi di utilizzo in real time:
Posizionamento esatto piedi su terreno irregolare Mano che raggiunge esattamente
un oggetto da afferrare
Mani che si congiungono esattamente in un’arma a due mani
(es. nonostante piccole discrepanze nella forma dello scheletro)
(es. nelle trasizioni)
Third person view
spazio mondo
spazio vista
V
T1
= ( T1 x T2 )-1
= ( T2 )-1 x ( T1 )-1
camera T2
First person view
spazio mondo T1
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx
polpaccio dx busto 2
P4
P7
piede Dx collo
P9
P11 P2
P1
testa
bacino (root)
P12
spazio vista
V
camera
T2 T2 = pos occhi
(in spazio «testa»)
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx polpaccio
dx busto 2
P4
P7
piede Dx collo
P9
P11 P2 P1
testa bacino (root)
P12
Composizione di pose
( e di animazioni)
+ =
lower joints
upper joints
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx
polpaccio dx busto 2
P4
P7
piede Dx collo
P9
P11 P2 P1
testa bacino (root)
P12
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx polpaccio
dx busto 2
P4
P7
piede Dx collo
P9
P11 P2 P1
testa bacino (root)
P12
Pose A Pose B New Pose
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx polpaccio
dx busto 2
P4
P7
piede Dx collo
P9
P11 P2 P1
testa bacino (root)
P12
Composizione di pose
( e di animazioni)
+ =
lower joints
upper joints
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx polpaccio
dx busto 2
P4
P7
piede Dx collo
P9
P11 P2 P1
testa bacino (root)
P12
busto 1
spalla dx spalla sx
P3
P8 P10
gamba gamba dx
sx polpaccio
dx busto 2
P4
P7
piede Dx collo
P9
P11 P2 P1
testa bacino (root)
P12
P1 = 0.45 ∙ + 0.55 ∙ P1 P1
anche interpolando, p.e.:
Pose A Pose B
Composizione di pose
( e di animazioni)
Utile in molteplici contesti:
pezzi di personaggio diversi che seguono animazioni diverse
Nota implementativa:
In Unity, si ottiene definendo “Layers” sovrapposti in un Animation Controller
Layer = maschera, su quali ossa agisce l’animazione
Alcuni (pre)processing su animazioni skeletali
Compressione
input:Animaz con N keyframes output: Animaz con M<N keyframes
Retargeting
input:Rig1 + (Skel animat per Rig1) + Rig2 output: (Skel animat per Rig 2)
Costruzione da blend-shape animation
input:Blend-shape
output: Rig + Skinned Mesh + Anim
Compressione animazioni skeletali
Obiettivo: rimuovere keyframes
quelli “inutili”
in preprocessing (e.g. as a game tool)
Versione 0.0 di un algoritmo:
per ogni keyframe Px rimuovi keyframe Px
computa versione interpolata Pi dai keyframe rimanenti
(il precedente e il successivo) se distanza( Pi ,Px)> MAX_ERR allora reinserisci keyframe Px
Per-vertex animations VS Skeletal-Animations
Per Vertex animations
possibilità interpolazione (e.g. keyframes) pesante in RAM
replicazione esplicita posizioni + normali
leggero in computation
Skeletal animations
possibilità interpolazione (e.g. keyframes) leggero in RAM
ortogonalità
modelli / animazioni
piccolo sforzo real-time
interpolaz trasf.
(x vertice!)
ricomputo trasf globali (se mix di pose, o altre manipolaz transf locali)
Animations in games
(of 3D Solid Objects)
Procedural Non-Procedural
Rigid
Articulated
Free form
Skeletal Animations
Blend-Shapes
Rigid body dynamics Pre-made
transforms
(ASSETS) (PHYSIC ENGINE)
Ragdolling Inverse kinematics
(generic) deformable object
simulation usually too expensive
Cloth/
garments
Ropes
Non-procedural Animations:
which one to pick?
Which format to pick?
EXAMPLE:
say we want
a model capable of doing this:
Non-procedural Animations:
which one to pick?
Transform animation
“wing” mesh
(2 instances)
“hull”
mesh
“wing” mesh
(2 instances)
“windscreen”
mesh
wing
mesh
wind- screen
mesh
wing
mesh
wing
mesh
wing
mesh
hull
mesh
Tws
Tw1
Tw2 Tw3 Tw4
Tship
animate these!
solution 1:
rest of scene
scene graph
Non-procedural Animations:
which one to pick?
Skeletal animation
x-wing skinned mesh
wing
bone
wind- screen
bone
wing
bone
wing
bone
wing
bone
hull
bone
Tship
solution 2:
x-wing rig
skeletal animations
Non-procedural Animations:
which one to pick?
Blend- shape solution 3:
“x-wing” blend-shape
base shape morph 1 morph 2
Non-procedural Animations:
which one to pick?
In this example:
Animation of transforms (of the scenegraph):
how: 3 (rigid) meshes, 5 instances, animate scenegraph transforms can reuse geometry for all wings: most compact on RAM ☺ simpler rendering
5 separated draw calls!
Skeletal animation:
how: one rig + one skinned mesh + few skeletal animations mesh skinning: single bone enough in this case
if very low poly mesh (few polys): a waste?
more taxing rendering (a bit) real time skinning on vertex any single draw call! ☺
Blend shapes:
how: blend shape with one base shape + 2 morphs minimal impact
worst quality interpolation: linear vertices on straight paths (unless, more shapes added) heaviest on RAM
(a waste of DoF!) not important, if very low res single draw call! ☺
but to different buffers each frame / or to a larger buffer straight (non curved) paths
Animations in games
(of 3D Solid Objects)
Procedural Non-Procedural
Rigid
Articulated
Free form
Skeletal Animations
Blend-Shapes
Rigid body dynamics Pre-made
transforms
(ASSETS) (PHYSIC ENGINE)
Ragdolling Inverse kinematics
(generic) deformable object
simulation usually too expensive
Cloth/
garments
Ropes
“G e o m . C a ch e s”
Geom. Caches
(for lack of a better name)
Baked, optimized animations
of a mixture of types e.g.
blend shapes kinematic animatios
(approximated)
skinned animations
(typically, no scene graph, just final transf)
optimized
compressed, streamed…
Baking of a variety of simulations results
.abc most used file format:
by
Geom. Caches
(for lack of a better name)
Baked, optimized animations
of a mixture of types
Geometry Caches
(a subset of Alembic) by
in Unity (+Mecanim)
(note)
Assets (modelli, animazioni, scheletri) importabili in formati:
fbx, collada
Compressione animazioni
durante import o builds
riduzione num link per vertice, num keyframes … :
Modulo «Animator Controller» gestisce (in parte WYSIWYG):
blending fra animazioni: transitions composizione di animazioni: layers
e.g.: un layer sovrascrive solo le ossa upper body
Inverse Kinematic: da script ( Avatar.SetIKPoistion) Scheletri:
custom (importati da file) standard per umanoidi
«scheletro standard per bipedi di unity (e mecanim)» (~21 ossa) interfaccia semplificata
What about animations of non solid objects?
Gases, liquids, etc
fire, smoke, water splosh, explosions, clouds…