Information Coding / Computer Graphics, ISY, LiTH. Splines

Similar documents
Curves and Surfaces Computer Graphics I Lecture 9

Splines. Connecting the Dots

Computer Graphics Curves and Surfaces. Matthias Teschner

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

Curves and Surfaces Computer Graphics I Lecture 10

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Curves. Computer Graphics CSE 167 Lecture 11

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Design considerations

3D Modeling Parametric Curves & Surfaces

Introduction to Computer Graphics

2D Spline Curves. CS 4620 Lecture 18

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

Parametric curves. Brian Curless CSE 457 Spring 2016

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

Objects 2: Curves & Splines Christian Miller CS Fall 2011

08 - Designing Approximating Curves

Spline Notes. Marc Olano University of Maryland, Baltimore County. February 20, 2004

2D Spline Curves. CS 4620 Lecture 13

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

Curves and Surfaces 1

Intro to Modeling Modeling in 3D

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Computer Graphics. Unit VI: Curves And Fractals. By Vaishali Kolhe

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

(Spline, Bezier, B-Spline)

Shape modeling Modeling technique Shape representation! 3D Graphics Modeling Techniques

Review of Tuesday. ECS 175 Chapter 3: Object Representation

Computergrafik. Matthias Zwicker. Herbst 2010

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Central issues in modelling

Know it. Control points. B Spline surfaces. Implicit surfaces

Bezier Curves, B-Splines, NURBS

Intro to Curves Week 4, Lecture 7

INF3320 Computer Graphics and Discrete Geometry

Dgp _ lecture 2. Curves

Curves and Curved Surfaces. Adapted by FFL from CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

Lecture IV Bézier Curves

CS-184: Computer Graphics

Computer Graphics. Curves and Surfaces. Hermite/Bezier Curves, (B-)Splines, and NURBS. By Ulf Assarsson

Representing Curves Part II. Foley & Van Dam, Chapter 11

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Intro to Curves Week 1, Lecture 2

Curves D.A. Forsyth, with slides from John Hart

Approximate Catmull-Clark Patches. Scott Schaefer Charles Loop

Rational Bezier Curves

Subdivision Surfaces

Splines Computer Graphics I Lecture 10

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

Introduction to Geometry. Computer Graphics CMU /15-662

Sung-Eui Yoon ( 윤성의 )

Computer Graphics I Lecture 11

Spline Surfaces, Subdivision Surfaces

In this course we will need a set of techniques to represent curves and surfaces in 2-d and 3-d. Some reasons for this include

Curve Representation ME761A Instructor in Charge Prof. J. Ramkumar Department of Mechanical Engineering, IIT Kanpur

OUTLINE. Quadratic Bezier Curves Cubic Bezier Curves

Computer Graphics Splines and Curves

Surfaces for CAGD. FSP Tutorial. FSP-Seminar, Graz, November

B-spline Curves. Smoother than other curve forms

Surface Modeling. Polygon Tables. Types: Generating models: Polygon Surfaces. Polygon surfaces Curved surfaces Volumes. Interactive Procedural

The goal is the definition of points with numbers and primitives with equations or functions. The definition of points with numbers requires a

Direct Rendering of Trimmed NURBS Surfaces

Subdivision Surfaces

CS-184: Computer Graphics. Today

From curves to surfaces. Parametric surfaces and solid modeling. Extrusions. Surfaces of revolution. So far have discussed spline curves in 2D

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

CS130 : Computer Graphics Curves. Tamar Shinar Computer Science & Engineering UC Riverside

An introduction to interpolation and splines

LECTURE #6. Geometric Modelling for Engineering Applications. Geometric modeling for engineering applications

A MATRIX FORMULATION OF THE CUBIC BÉZIER CURVE

CS354 Computer Graphics Surface Representation III. Qixing Huang March 5th 2018

09 - Designing Surfaces. CSCI-GA Computer Graphics - Fall 16 - Daniele Panozzo

Curves and Surface I. Angel Ch.10

Curves and Surfaces 2

Curves & Surfaces. Last Time? Progressive Meshes. Selective Refinement. Adjacency Data Structures. Mesh Simplification. Mesh Simplification

ECE 600, Dr. Farag, Summer 09

Subdivision Surfaces

CHAPTER 1 Graphics Systems and Models 3

An Introduction to B-Spline Curves

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

Computer Animation. Rick Parent

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Curved PN Triangles. Alex Vlachos Jörg Peters

Need for Parametric Equations

Curves & Surfaces. MIT EECS 6.837, Durand and Cutler

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

Efficient GPU Rendering of Subdivision Surfaces. Tim Foley,

Advanced Modeling 2. Katja Bühler, Andrej Varchola, Eduard Gröller. March 24, x(t) z(t)

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

3D Modeling techniques

Geometric Modeling of Curves

Physically-Based Modeling and Animation. University of Missouri at Columbia

A Curve Tutorial for Introductory Computer Graphics

Transcription:

28(69) Splines Originally a drafting tool to create a smooth curve In computer graphics: a curve built from sections, each described by a 2nd or 3rd degree polynomial. Very common in non-real-time graphics, both 2D and 3D Useful also for real-time. 28(69)

Applications of splines Designing smooth curves (common in 2D illustrations) Filter design Modelling smooth surfaces Representating of smooth surfaces (converted to polygons in real-time) Animation paths 29(69)29(69)

Important application of splines: Text rendering We will return to that subject on a later lecture. 30(69)30(69)

Control points A spline is specified by a set of control points. 31(69)31(69)

Interpolation spline Control points on the curve. Approximation spline Control points not on the curve. 32(69)32(69)

Parametric representation x = x(u) y = y(u) z = z(u) u 1 u u 2 A set of functions for each coordinate 33(69)33(69)

Parametric continuity C 0 = continuous position = the curves meet C 1 = continuous direction = the curves meet at same angle C 2 = continuous curvature = the curves meet at same bend 34(69)34(69)

Specification of splines by polynomials in multiple sections x 1 (u) = a x1 u 3 + b x1 u 2 + c x1 u + d x1 Continuity in this point? y 1 (u) = a y1 u 3 + b y1 u 2 + c y1 u + d y1 z 1 (u) = a z1 u 3 + b z1 u 2 + c z1 u + d z1 x 2 (u) = a x2 u 3 + b x2 u 2 + c x2 u + d x2 1 2 y 2 (u) = a y2 u 3 + b y2 u 2 + c y2 u + d y2 z 2 (u) = a z2 u 3 + b z2 u 2 + c z2 u + d z2 35(69)35(69)

Parametric continuity u = u 1 1 2 C 0 : x 1 (u 1 ) = x 2 (u 1 ) y 1 (u 1 ) = y 2 (u 1 ) z 1 (u 1 ) = z 2 (u 1 ) C 1 : x 1 (u 1 ) = x 2 (u 1 ) y 1 (u 1 ) = y 2 (u 1 ) z 1 (u 1 ) = z 2 (u 1 ) C1: 6 equations per vertex, 12 coefficients per section 36(69)36(69)

Geometric continuity G 0 = C 0 = continuous position = the curves meet G 1 = proportinal direction = the curves meet at same angle but not same velocity G 2 = proportional curvature = the curves meet at same bend but not same velocity 37(69)37(69)

Geometric continuity u = u 1 1 2 G 0 : x 1 (u 1 ) = x 2 (u 1 ) y 1 (u 1 ) = y 2 (u 1 ) z 1 (u 1 ) = z 2 (u 1 ) G 1 : x 1 (u 1 ) = k*x 2 (u 1 ) y 1 (u 1 ) = k*y 2 (u 1 ) z 1 (u 1 ) = k*z 2 (u 1 ) for some k Essentially one less constraint 38(69)38(69)

Blending functions Rewrite parametric form to a set of polynomials, one polynomial for each control point 39(69)39(69)

Approximation splines Use a set of blending functions to blend together control points to points on the curve Bézier curves B-splines NURBS 40(69)40(69)

Common demand on approximations splines: Stay within the convex hull of the control points Convex hull = minimal convex polygon enclosing a specified set of points 41(69)41(69)

Bézier curves Typically uses 3 or 4 control points per section 42(69)42(69)

Bézier curves The 4 points are blended together using 4 blending functions 4 blending functions = Cubic Bézier 43(69)43(69)

Bézier curves Blending functions: Bernstein polynomials BEZ 0,3 = (1-u) 3 BEZ 1,3 = 3u(1-u) 2 BEZ 2,3 = 3(1-u)u 2 BEZ 3,3 = u 3 The sum is 1 for any u 44(69)44(69)

1 P 0 P 1 P 2 P 3 BEZ 0,3 = (1-u) 3 BEZ 1,3 = 3u(1-u) 2 u BEZ 2,3 = 3(1-u)u 2 BEZ 3,3 = u 3 1 u P(u) = P 0 *(1-u) 3 + P 1 *3u(1-u) 2 + P 2 *3(1-u)u 2 + P 3 *u 3 3 = P i * BEZ i,3 (u) i = 0 45(69)45(69)

Fitting together sections C 0 /G 0 continuity: just fit the points C 1 continuity: Tangents are equal along the edge. G 1 continuity: Tangents have same direction along the edge. Simple method: Put 3 points in a line 46(69)46(69)

Quadratic Bezier curves Three control points 2nd order polynomials p(u) = (1-u) 2 p 0 + 2u(1-u)p 1 + u 2 p 2 47(69)47(69)

de Casteljau s algorithm A Bézier is really an interpolation of interpolations p 1 p 3 q 1 q 0 q 2 p 0 p 2 48(69)48(69)

de Casteljau s algorithm Linear interpoations of linear interpolations until only one point remains p 1 p 3 q 1 q 0 r 0 r 1 p(u) q 2 p 0 p 2 49(69)49(69)

de Casteljau s algorithm Gives us the Bernstein polynomials of any level we want. Linear (2 points) = plain interpolation Quadratic Béziers (3 points) Cubic (4 points) Higher levels possible but not practical 50(69)50(69)

de Casteljau s algorithm Obvious from figure/method: Bézier is always inside convex hull Fit together sections by keeping points along a line also obvious - we must start along the tangent 51(69)51(69)

Interpolation splines Passes through all control points. Control points on the curve. 52(69)52(69)

Blending functions for interpolation spline The points are blended together using blending functions 53(69)53(69)

Blending functions for interpolation spline All blending functions are zero or 1 at the control points Actual blending functions for interpolated spline of 4 control points (similar to Bézier) 54(69)54(69)

Cardinal splines Catmull-Rom splines Interpolation spline Specified only by control points Calculated from 4 control points, define between the middle two A tension parameter t can adjust the shape t = 0 => Catmull-Rom 55(69)55(69)

Catmull-Rom splines, Matrix form P(u) = [ u 3 u 2 u 1] -1/2 3/2-3/21/2 1-5/2 2-1/2-1/2 0 1/2 0 0 1 0 0 p k-1 p k p k+1 p k+2 P(u) = p k-1 (-u 3 /2 + u 2 - u/2) + p k (3u 3 /2-5u 2 /2 + 1) + p k+1 (-3u 3 /2 + 2u 2 + u/2) + p k+2 (u 3 /2 - u 2 /2) = p k-1 *CAR 0 (u) + p k *CAR 1 (u) + p k+1 *CAR 2 (u) + p k+2 *CAR 3 (u) 56(69)56(69)

Catmull-Rom splines, Blending functions 57(69)57(69)

Application of Catmull-Rom splines: Animation paths Defined by a sequence of points on the curve Always G 1 /C 1 continuous 58(69)58(69)

Bézier surfaces A surface is built from a set of Bézier patches A Bézier patch consists of 16 control points in a 4x4 grid 59(69)59(69)

Bézier surfaces Blending of the 16 control points as a 2- dimensional sum 3 3 P(u,v) = p j,k BEZ j,3 (v) BEZ k,3 (u) j=0 k=0 u v 60(69)60(69)

Bézier surface example 61(69)61(69)

Fitting together patches Fit in both u and v direction Make a 3x3 joystick at each corner 62(69)62(69)

Drawing splines Subdivide the spline until the error is small enough. u=0 u=0.25 u=0.375 u=1 u=0.5 u=0.75 63(69)63(69)

Splines and surfaces in OpenGL Pre-generated shapes on CPU Generate by multi-pass GPU processing Old OpenGL: Evaluators (glmap) 3.2: Geometry shaders 4: Tesselation shaders 64(69)64(69)

Evaluators Old built-in Bezier evaluator. Easy to use but no longer recommended. Supported both curves and surfaces 65(69)65(69)

Geometry shaders OpenGL 3 (extension in GL 2) Shader between vertex and fragment, converts geometry, can add new vertices Modest hardware demand: G80 or better (2007+) 66(69)66(69)

Tesselation shaders OpenGL 4 Shader between vertex and fragment (before geometry shader), focused on subdivision Higher hardware demand (Southfork is OK) 67(69)67(69)

Applications of geometry stage shaders: Splines/surfaces Edge extraction, silhouettes Polygon-level effects (shrinking triangles) Adaptive subdivision Visualizing normal vectors etc 68(69)68(69)

More object representation soon... Fractals and procedural generation but first let us move to the animation subject 69(69)69(69)