Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer graphics & visualization Key frame Interpolation.

Similar presentations


Presentation on theme: "Computer graphics & visualization Key frame Interpolation."— Presentation transcript:

1 computer graphics & visualization Key frame Interpolation

2 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Keyframe Animation Draw one keyframe after another  Results in “rough” animation instead of a smooth transition from frame to frame

3 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Keyframe Interpolation

4 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Keyframe Interpolation

5 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Keyframe Interpolation

6 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Simple Translations Linear Interpolation is fine here But what about rotations?

7 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Linear Interpolation of Rotations K = (1-  ) A +  B (linear interpolation: lerp) Introduces non linear behavior on the arc

8 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group SLERP Approach by means of slerp = spherical linear interpolation with it follows A P B  

9 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Quaternion Power Operator [ cos(  /2), sin(  /2) * A]  [cos(  /2), sin(  /2) * A] q a rotates to q orientation as a goes from 0 to 1 = Quaternions:q = (q b q a -1 )  q a (slerp) q = slerp(q a,q b,  )

10 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Curves So far: smooth linear interpolation along a line (or along an arc on the circle) Now extend the idea so that interpolation follows a given path, a curve In the following: description of curves

11 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Consider the following: Data is sampled at discrete data points Want to know data values at an arbitrary position within the domain

12 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group The simple way From n+1 known data samples construct a n- dimensional polynomial n+1 Samples → n+1 knows n-dimensional polynomial has n+1 unknowns leads to system of n+1 linear equations

13 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group The simple way (cont.) system of equations can be rewritten as matrix Vandermonde Matrix

14 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Polynomial for approximation

15 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group How to handle multiple x values? do not use a single approximation function but use n (=dimension of the domain) functions and a new parameter t from 0 to 1 x(t)=x, y(t)=y, z(t)=z … x y y(t) x(t)

16 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group multiple x-values (cont.) leads to multiple polynomials can be rewritten in matrix form

17 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Matrix notation C can be split up into M (basis matrix) G (geometry matrix) M is fixed for a given approach G depends on the specific curve to fit

18 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Building M derive a Matrix M for the Hermite approach Hermite uses polynomials of degree 3 to a fit 2 points it is an interpolation → 2 conditions derivatives at the endpoints are given → 2 conditions

19 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Hermite interpolation with

20 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Hermite interpolation (cont.)

21 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Hermite interpolation Cubic Hermite-Polynoms: Charles Hermite (1822-1901)

22 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Hermite interpolation Example:

23 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Hermite interpolation Properties: – Neither affine invariant with respect to control points nor with respect to vectors – No local control – Difficult to find tangent vectors – Curve segments can be attached continuously – Interpolation between points with tangents, e.g. for Keyframe-Animation with given position and velocity

24 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Monom interpolation Approach: Monom-Basis: {t i | i=0…n} From p(t i ) = a i the system of equations is derived: Vandermond Matrix Basis Control points 3 components per entry

25 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Curves Idea: tangent vectors defined by first and last two points: – b 0 and b n will be interpolated – b i will be approximated – Relation to Hermite-Interpolation: b0b0 b2b2 b1b1 b3b3 cubic Bézier-Curve Example: cubic Bezier-Curve

26 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Curves … and Hermite-Interpolation And for the curve: Geometry vector for Bézier Matrix for Bézier to Hermite with

27 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Curves The cubic Bézier-Curve: Bernstein-Polynoms of degree n: with domain [0,1] Bézier-Control-Points Bernstein-Polynoms with

28 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Curves Cubic Bernstein-Polynoms:

29 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Curves Of degree n = 1: linear interpolation Of degree n = 2: iterated linear interpolation

30 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Curves Iterated linear interpolation for degree 2: Example for t = 0,4 http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/

31 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bezier Interpolation of Quaternions De Casteljau

32 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Spherical Linear Interpolation

33 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group For u = 1/4 Repeated mid-point interpolation

34 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Spline-Curves Problem so far: polynom degree depends on number of control points Idea: – Multiple segments with low degree instead of one segment of high degree – Segments can be of arbitrary type: Hermite-Curves Quadrics Bézier-Curves – Important is smooth transition between segments

35 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Spline-Curves Spline: – A thin flexible rod used for the construction of ships – Deutsch: Straklatte, Strakfunktionen – A spline of n-th degree consists of polynomial segments of max degree n – A cubic Spline describes the shape of a thin rod that is fixed at start and end point

36 computer graphics & visualization Simulation and Animation – SS 07 Jens Krüger – Computer Graphics and Visualization Group Bézier-Splines Spline-Segments i: Spline s(u) ist sum of segments b i,3 = b i+1,0 uiui u i+1 b i,0 b i,1 b i,2 b i+1,1


Download ppt "Computer graphics & visualization Key frame Interpolation."

Similar presentations


Ads by Google