Download presentation

Presentation is loading. Please wait.

Published bySamira Setton Modified over 2 years ago

1
Curves Jim Van Verth (jim@essentialmath.com)

2
Essential Math for Games Animation Problem: want to replay stored set of transformations Generated by artist Generated by motion capture Two main issues Replaying position Replaying orientation

3
Essential Math for Games Animation of Position Set of points representing position Three issues to handle Frame rate higher than sample rate Reduce number of samples to save memory Blend between two animation sets

4
Essential Math for Games Animation of Position Idea: use set of points to define a function Can then sample points along that function to find new positions Two possibilities: Interpolation (passes through points) Approximation (passes near points)

5
Essential Math for Games Parametric Curve Function Q(t) Maps parameter t to point on curve Q Commonly broken into ( x(t), y(t), z(t) ) Called space curve Derivative is tangent ( x'(t), y'(t), z'(t) )

6
Essential Math for Games Linear Interpolation Two points define a line Can generate new points between them

7
Essential Math for Games Do this using parameterization of line Q(t) = P 0 + t (P 1 – P 0 ) = (1 – t) P 0 + t P 1 Parameter t controls position on line Curve only defined where t in [0,1] Linear Interpolation P0P0 P1P1

8
Essential Math for Games Multiple Points Can linearly interpolate from point to point (piecewise linear curve) Problem: get discontinuity at each point I.e. not smooth Demo

9
Essential Math for Games Continuity Continuous function has no ‘gaps’ C-continuity Number indicates derivative continuity I.e. C 1 means 1 st derivative continuous Tangents equal at joins G-continuity Tangents point in same direction

10
Essential Math for Games Hermite Curves One solution Idea: Cubic curve between each point Tangents at each point specify how curve should go Piecewise Hermite spline Demo

11
Essential Math for Games Hermite Curves For points P 0, P 1 and tangents P' 0, P' 1 function is: P0P0 P1P1 P'1P'1 P'0P'0

12
Essential Math for Games Hermite Curves At each sample, two tangents – in and out For smooth curve ( C 1 ) Make them equal Smooth curve but change in speed ( G 1 ) Same direction, different lengths For crease ( C 0 ) Different directions

13
Essential Math for Games Export from commercial tools May have to tweak to guarantee results Export from homemade tools Clamped, natural, cyclic, acyclic splines Maintain C 2 continuity Solution to system of linear equations Computing Tangents

14
Essential Math for Games Catmull-Rom spline Tangent half vector between neighboring points Tangent undefined at end points Computing Tangents P i-1 PiPi P i+1

15
Essential Math for Games Bezier Curve Instead of two tangents, have two approximating control points Curve doesn’t pass through control points Their position controls shape of curve Curve lies in convex hull

16
Essential Math for Games Bezier Curve For points P 0, P 1, P 2, P 3 function is: P0P0 P1P1 P2P2 P3P3

17
Essential Math for Games Bezier Curve Control points provide good user interface Align control points between curve segments for continuity

18
Essential Math for Games De Castlejau's method Fast Bezier subdivision Find percentage along each segment, then along resulting segments Result is control pts for two subcurves P0P0 P1P1 P2P2 P3P3

19
Essential Math for Games De Castlejau’s Method Useful for rendering Subdivide until only “straight” subcurves Straight if P 1 & P 2 are close to P 0 P 3 Useful for measuring length Subdivide until ||P 0 P 1 || + ||P 1 P 2 || + ||P 2 P 3 || is close to ||P 0 P 3 || Add up all the sublengths

20
Essential Math for Games B-splines Generally curve approximates points, i.e. doesn’t pass through them Continuous through 2nd derivative Provides local control

21
Essential Math for Games NURBS Non-Uniform Rational B-Splines Non-uniform = curve segments have unequal spacing by parameter Rational = can apply weights to sample points (good for conic sections) Result: very useful, but not cheap Mostly used for parametric surfaces

22
Essential Math for Games References Parent, Rick, Computer Animation: Algorithms and Techniques, Morgan Kaufmann, 2002. Bartels, Beatty, Barsky, An Introduction to Splines for use in Computer Graphics & Geometric Modelling, Morgan Kaufmann, 1987. Rogers and Adams, Mathematical Elements for Computer Graphics, McGraw-Hill, 1989. Rogers, An Introduction to NURBS: With Historical Perspective, Morgan Kaufmann, 2000.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google