Global Deformations

Deforming Objects
Deformation Techniques
CMPT 466
Computer Animation
Torsten Möller
•
•
•
•
•
•
•
Non-Uniform Scale
Global Deformations
Skeletal Deformations
Grid Deformations
Free-Form Deformations (FFDs)
Morphing
3D Shape Interpolation
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Examples
Deforming Objects
• Changing an object’s shape
– Non-simulated algorithms
– User guidance
!"#$%&'()#$*#+$*$,,*-
• Easiest when topology is preserved
.%$/$%01",*#'&'(',2
© Möller/Parent/Machiraju
– Topology = number of faces, vertices, edges,
holes !
– Define the movements of vertices
© Möller/Parent/Machiraju
Non-Uniform Scale
sx
0
0
0
0
sy
0
0
0
0
sz
0
Non-Uniform Scale (2)
0
0
0
1
Transformation matrix - diagonal elements
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Global Deformations
Moving Vertices
• Transformations elements - functions of
coordinates
• Cannot define trajectory of all vertices
• Work on seed vertices
• Effect nearby vertices
34562678 ,4562678
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Moving Vertices
Defining Vertex Functions
• If vertex i is displaced by (x, y, z) units
– Displace each neighbor, j, of i by
• (x, y, z) * f(i, j)
• f(i,j) is typically a function of distance
– Euclidean distance
– Number of edges from i to j
– Distance along surface
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Vertex Displacement Function
Vertex Displacement Function
• i is the (shortest) distance (in number of
edges) from j
• n is the max number of edges affected
• (k=0) = linear; (k<0) = rigid; (k>0) = elastic
• Figure 3.55
& i #
f (i ) = 1.0 ' $
!
% n +1"
k +1
&
& i ##
f (i ) = $$1.0 ' $
! !!
% n +1""
%
;k ( 0
' k +1
© Möller/Parent/Machiraju
;k < 0
© Möller/Parent/Machiraju
Global Deformations
Global Deformations - taper
• Alan Barr, SIGGRAPH ’84
• A 3x3 transformation matrix affects all
vertices
– P’=M(P)P
• M(P) can taper, twist, bend…
• Figure 3.63 - 3.66
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Global Deformations - taper
Global Deformations - Twist
x’ = x*cos(f(y)) – z*sin(f(y))
y’ = y
z’ = x*sin(f(y)) + z*cos(f(y))
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Global Deformations - Bend
Global Deformations - Bend
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Global Deformations Compound
Grid Deformation
•
•
•
•
© Möller/Parent/Machiraju
2D technique used in the film HUNGER
Overlay 2D grid on top of object
Map object vertices to grid cells (create
local coordinate system)
User distorts 2D grid vertices
Object vertices are remapped to local
coordinate system of 2D grid by using
bilinear interpolation
© Möller/Parent/Machiraju
Grid Deformation (2)
Grid Deformation (3)
• For each vertex
• Identify cell
• Local u,v coordinate
0.8
0.5
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Grid Deformation (4)
Grid Deformation (5)
P11
Pu1
P01
•
•
•
•
P00
Bilinear interpolation
Pu0 = (1-u)*P00 + u*P10
Pu1 = (1-u)*P01 + u*P11
Puv = (1-v)*P0u + v*P1u
© Möller/Parent/Machiraju
Pu0
P01
© Möller/Parent/Machiraju
Grid Deformation (5)
Skeletal Deformation
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Skeletons - NOT these type!
Skeletons
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Skeletal Deformation (2)
• Interior angle bisectors
• Perpendiculars at end points
Skeletal Deformation (3)
•
•
•
•
•
Get object
Draw polyline
Map vertices to polyline
s
Warp polyline
Reposition vertices
L
d
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Skeletal Deformation (4)
Free-Form Deformation (FFD)
• Sederberg, SIGGRAPH ’86
• Position geometric object in local
coordinate space
• Build local coordinate representation
• Deform local coordinate space and thus
deform geometry
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
FFD (2)
FFD (3)
• Similar to 2-D grid deformation
• Define 3-D lattice surrounding geometry
• Move grid points of lattice and deform
geometry accordingly
• Use local coordinate system
• Define local coordinate system for
deformation
• (not necessarily mutually perpendicular)
T
U
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
FFD - register point in cell
Trilinear Interpolation
.
• Let S, T, and U (with origin P0) define local
coord axes of bounding box that encloses
geometry
• A vertex P’s coordinates are:
:
P # P0
(T " U ) ! S
P # P0
t = (U " S ) !
(U " S ) ! T
P # P0
u = (S " T ) !
( S " T ) !U
s = (T " U ) !
;
9
© Möller/Parent/Machiraju
P = P0 + s ! S + t ! T + u !U
T (TxU) . (P-P0)
((TxU) . S)
TxU
© Möller/Parent/Machiraju
S
P
U
P0
Volumetric Control Points
• S, T, and U axes subdivided by control
points
• Lattice of control points constructed
• Bezier interpolation of CPs
define new vertex positions
i
j
k
Pijk = P0 + ! S + ! T + !U
l
m
n
FFD - move and reposition
• Move control grid points
• Usually tri-cubic
interpolation is used with FFDs
• Originally Bezier interpolation was used.
• B-spline and Catmull-Rom interpolation
have also been used (as well as tri-linear
interpolation)
l
& m &m#
& n &n#
##
&l #
P( s, t , u ) = ) $$ !!(1 ' s ) l 'i s i ( $ ) $$ !!(1 ' t ) m ' j t j ( $$ ) $$ !!(1 ' u ) n ' k u k Pijk !! !
$
!
i =0 % i "
% k =0 % k "
""
% j =0 % j "
http://www.dgp.utoronto.ca/~rudy/teapot.html
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Examples
FFD - extensions
•
•
•
•
© Möller/Parent/Machiraju
Hierarchical FFDs
Animated FFD
Static FFD that object moves through
Non-parallelpiped FFD
© Möller/Parent/Machiraju
Using FFDs to Animate
FFDs @ Work
• Control point lattice smaller than geometry
• Move lattice through geometry so it affects
different regions in sequence
• Creepy crawlers under your skin
• Figure 3.74
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
FFDs @ Work
Using FFDs to Animate
• Build FFD lattice that is larger than
geometry
• Translate geometry within lattice so new
deformations affect it with each move
• Change shape of object to move along a
path
• Figure 3.75
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Animating the FFD
• Create interface for efficient manipulation
of lattice control points over time
– Connect lattices to rigid limbs of human
skeleton
– Figure 3.77
– Physically simulate control points
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Animating the FFD
FFD - films and video
• examples
– Boppin’ in Bean Town by John Chadwick
– Facit demo by Beth Hofer
– Balloon Guy by Chris Wedge
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
(2D) Morphing
• image post-processing technique
• transfer source into target image
• user need to specify corresponding elements
Morphing
• 2D image metamorphosis
– Coordinate Grid Approach
– Feature-Based Approach
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Coordinate Grid Morph
Coordinate Grid
• create intermediate grid
• warp source images to intermediate grid
– first in x then in y
• cross-dissolve images
© Möller/Parent/Machiraju
• Source and destination images
– Overlay upon both a 2-D lattice of points
•
•
•
•
Points along edges must remain on edges
Internal points can be in different positions
Same number of points in both
Points define movement of pixels
© Möller/Parent/Machiraju
Two-pass Rendering
Overview
• Figure 3.79
Morphing Images to
Intermediate
• First stretch in x direction and then in y
direction
– Auxiliary lattice has x
coordinates from
source and y
coordinates from
intermediate lattice
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Morphing Images Intermediate
Feature-Based Morphing
• Use scanline method to
compute what pixels from
source image map to a
particular pixel of
intermediate image
© Möller/Parent/Machiraju
• Simplest case: user
draws one ray on
source and
destination images to
define morph
© Möller/Parent/Machiraju
Local Coordinate Systems
Local Coordinate Systems
• Root of feature line in source image is
coordinate system origin
• Feature line in source image correspond to
v axis (unit length)
• Construct perpendicular to this ray for u
axis
• Every pixel (x, y) of image now mapped to
(u, v) using projection to u/v axes
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Local Coordinate Systems
Mapping Destination to Source
• Perform similar local coordinate system
computation for destination image
– Build s/t axes
• (x, y) dest --- (s, t)
• (s, t) --- (u, v)
• (u, v) --- (x, y)source
• Color (x, y)dest with (x, y)source
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
Necessary Details
Necessary Details
• More than one line
• Mapping from destination to pixel to source
pixel will not land on pixel centers
– Perform mapping for all line segments
– Weight each line segment’s contribution to
averaged color value
• Q2 – Q1 = distance of line
segment
• dist is distance from pixel
to line
• a and b are user specified
& Q2 ' Q1 p #
!
w=$
$ a + dist !
%
"
b
– Aliasing results…
– Use quadrilateral centered at source (u, v)
location to sample multiple pixels and average
© Möller/Parent/Machiraju
© Möller/Parent/Machiraju
3D Shape Interpolation
Matching Topology
• still being researched
• map between topologically equal objects
• [easier] map between objects with same
(geometric) topology
© Möller/Parent/Machiraju
• same vertex-edge topology
• easy problem, just interpolate the (x,y,z)
position of corresponding vertices
© Möller/Parent/Machiraju
Star-Shaped Polyhedra
• find a vertex in the core of each polyhedra
• send rays / discretize polyhedra
© Möller/Parent/Machiraju
Map To Sphere
• works for genus 0 topologies
• create mapping to sphere
• sphere is an “intermediate” surface, which
lets us find a correspondence between the 2
objects
© Möller/Parent/Machiraju
Axial Slices
• do the same as before but for 3D object on a
per slice basis
© Möller/Parent/Machiraju