CO Games Development 1 Week 12 Interpolation, Path Smoothing & Splines

Slides:



Advertisements
Similar presentations
Curves Jim Van Verth Essential Math for Games Animation Problem: want to replay stored set of transformations  Generated by.
Advertisements

Interpolating curves.
Lecture Notes #11 Curves and Surfaces II
Parametric Curves Ref: 1, 2.
BEZIER CURVES Part II. Assume we are given two endpoints labelled E1 and E2 and two control points labelled C1 and C2. create a smooth curve whose endpoints.
DIFFERENTIATION & INTEGRATION CHAPTER 4.  Differentiation is the process of finding the derivative of a function.  Derivative of INTRODUCTION TO DIFFERENTIATION.
Lecture 10 Curves and Surfaces I
Interpolation A method of constructing a function that crosses through a discrete set of known data points. .
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
ICS 415 Computer Graphics Bézier Splines (Chapter 8)
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
B-Spline Blending Functions
1 Introduction Curve Modelling Jack van Wijk TU Eindhoven.
Dr. S.M. Malaek Assistant: M. Younesi
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
1Notes  Assignment 0 is due today!  To get better feel for splines, play with formulas in MATLAB!
1cs426-winter-2008 Notes  Ian Mitchell is running a MATLAB tutorial, Tuesday January 15, 5pm-7pm, DMP 110 We won’t be directly using MATLAB in this course,
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
Modeling of curves Needs a ways of representing curves: Reproducible - the representation should give the same curve every time; Computationally Quick;
Curves Mortenson Chapter 2-5 and Angel Chapter 9
Drawing Parametric Curves Jean-Paul Mueller. Curves - The parametric form of a curve expresses the value of each spatial variable for points on the curve.
Computer Graphics 12: Spline Representations
Modelling: Curves Week 11, Wed Mar 23
RASTER CONVERSION ALGORITHMS FOR CURVES: 2D SPLINES 2D Splines - Bézier curves - Spline curves.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Curve Modeling Bézier Curves
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
This Week Week Topic Week 1 Week 2 Week 3 Week 4 Week 5
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to virtual engineering Óbuda University John von Neumann Faculty of Informatics Institute of Intelligent Engineering Systems Lecture 3. Description.
Spline Representations
Numerical Computation
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Curves. First of all… You may ask yourselves “What did those papers have to do with computer graphics?” –Valid question Answer: I thought they were cool,
INTERPOLATION & APPROXIMATION. Curve algorithm General curve shape may be generated using method of –Interpolation (also known as curve fitting) Curve.
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Geometric Modelling 2 INFO410 & INFO350 S Jack Pinches
Keyframing and Splines Jehee Lee Seoul National University.
Ship Computer Aided Design MR 422. Geometry of Curves 1.Introduction 2.Mathematical Curve Definitions 3.Analytic Properties of Curves 4.Fairness of Curves.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
Curves: ch 4 of McConnell General problem with constructing curves: how to create curves that are “smooth” CAD problem Curves could be composed of segments.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
(c) 2002 University of Wisconsin
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
CS552: Computer Graphics Lecture 19: Bezier Curves.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
Interpolation - Introduction
CSCI480/582 Lecture 9 Chap.2.2 Cubic Splines – Hermit and Bezier Feb, 11, 2009.
© University of Wisconsin, CS559 Spring 2004
Chapter 10-2: Curves.
CURVES CAD/CAM/CAE.
© University of Wisconsin, CS559 Spring 2004
Implicit Functions Some surfaces can be represented as the vanishing points of functions (defined over 3D space) Places where a function f(x,y,z)=0 Some.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Type to enter a caption. Computer Graphics Week 10 Lecture 1.
Spline representation. ❖ A spline is a flexible strip used to produce a smooth curve through a designated set of points. ❖ Mathematically describe such.
Presentation transcript:

CO2301 - Games Development 1 Week 12 Interpolation, Path Smoothing & Splines Gareth Bellaby

Topics Introduction - Path Smoothing Parametric line equations Interpolation Path Smoothing & Splines

Introduction - Path Smoothing Topic 1 Introduction - Path Smoothing

Path Smoothing The path generated by the pathfinding algorithms are composed of unnatural looking straight lines and abrupt turns. This is true whichever representation is used. Path Smoothing is about smoothing the path and making something more aesthetically pleasing.

Path Smoothing We have a set of points. We want to instead to have a curved path or line. One way to do this is so employ a spline. A spline takes two or more points and draws a curve based on the location of the points. The word spline is an architectural term- it was a flexible wooden rod used to draw out a curve, e.g. for a pillar section. There are different types of spline. The curve they generate have different characteristics.

Parametric line equations Topic 2 Parametric line equations

Parametric equation A parametric equation is simply one that contains a parameter. In this context, the parameter means a variable. Two points are needed to calculate the equation for a line.

Parametric equation One convention is to use t for the parameter. All of the points lying along a line can be expressed using the following formula: In practice you will express each of the x, y and z components separately, e.g.

Parametric equation P0 is the point where the line starts. P1 - P0 is simply the vector (or slope) between two points. t is a variable which ranges across all of the possible points along the line.

Example

Intervals Note that the parametric line equation can be used to derive regular intervals along the line. The half-way point is calculated if t = 0.5. The quarter-way point is calculated if t = 0.25.

Example: mid-point

Example: quarter-point

Topic 3 Interpolation

Interpolation Interpolation is the creation of new data points from a set of known points. For example, a scatter of points on a graph. From the given points you can calculate the line which has the closest fit

Interpolation The line could take different forms. For example: a straight line which passes through all of the points some kind of curve which appears to be a close fit but is allowed to miss the points

Interpolation Interpolation is the operation whereby you capture the essence of a set of data whilst leaving out the noise. Interpolation is carried out by creating a function. A function "in mathematics, [is] an expression, rule, or law that defines a relationship between one variable (the independent variable) and another variable (the dependent variable)." Encyclopædia Britannica So a function takes an input and calculates an output according to some mathematical rule or operation.

Interpolation Set of points. Want to draw a line through them, but we want this to be a aesthetically pleasing curve. Need to calculate points in between our known points. This method is know as interpolation. Interpolation means to take a set of discrete points at given intervals and generate the continuous function that passes through the points. Laurent will do interpolation with you in the context of animation.

Linear Interpolation Linear interpolation is usual abbreviated to lerp. By using the parametric line equation you can calculate any point along the line. Often rearranged into the following form:

Polynomial interpolation It is also possible to use polynomial interpolation. A polynomial expression is an expression involving a sum of powers. So simply interpolation using a polynomial. Produces interesting curves, for example curves which are irregular, which perform abrupt changes in direction, or even form knots.

Path Smoothing & Splines Topic 4 Path Smoothing & Splines

Path Smoothing There are many ways to interpolate data. I will introduce a method of generating a curve called the Catmull-Rom spline. I will quickly pass over how it does this, but essentially you generate tangents based on the position of the sample points. For more details see Van Verthe section 9.6 and Rabin, "A* Aesthetic Optimizations", Games Gems.

Catmull-Rom spline

Catmull-Rom spline Need four points. The curve is derived for the line between the second and third points. The line is calculated as a sequence of discrete locations. The calculation is carried out for each component of the four points. Bicubic polynomial.

Catmull-Rom spline Where A, B, C and D are:

Path Smoothing As with parametric line equations, in practice you will express each of the x, y and z components separately (cf. slide 8 and the examples given on slides 10 - 13.)

Example Given 4 points (1, 2), (2, 4), (4, 3) and (5, 6). Do the calculation first for x:

Example Now plug this into the equation. If we want the mid-point between B and C then t = 0.5

Catmull-Rom spline You don't need to derive all of the points of the curve. An efficiency gain can be made by using predetermined intervals. This allows you to pre-calculate the value of t. Quarter interval: Half interval: Three quarter interval:

Catmull-Rom spline In order to derive the line between the second and third points (the middle) use all four points. In order to derive the line between the first and second points (the first third) use the first points twice, i.e. p1 and p2 are the same. In order to derive the line between the third and last points (the last third) use the last points twice, i.e. p3 and p4 are the same.

Characteristics of Catmull-Rom spline The curve passes through all of the points. It is reasonably efficient. The line is continuous.

Bézier curve There are a number of other splines: Hermite splines, B-Splines, etc. A commonly used one is the Bézier spline. As with all of the splines, the Bézier spline uses polynomial interpolation. A cubic Bézier curve is give using the following forumula:

Characteristics of Catmull-Rom spline The curve passes through all of the points. It is reasonably efficient. The line is continuous.

Characteristics of Bézier spline The curve touches the first and last points. The curve is within the convex hull of the control points.