1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.

Slides:



Advertisements
Similar presentations
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Advertisements

Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
Chapter 11: Advanced Rendering Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Ray Tracing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of.
09/04/02 Dinesh Manocha, COMP258 Bezier Curves Interpolating curve Polynomial or rational parametrization using Bernstein basis functions Use of control.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Designing Parametric Cubic Curves Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2006 Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
COEN Computer Graphics I
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Designing Parametric Cubic Curves
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Splines III – Bézier Curves
Curves and Surfaces (cont’) Amy Zhang. Conversion between Representations  Example: Convert a curve from a cubic B-spline curve to the Bézier form:
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
19/13/ :20 UML Graphics II Parametric Curves and Surfaces Session 3.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
Introduction to Computer Graphics with WebGL
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel: Interactive.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Curves and Surfaces Chapter 10. CS 480/680 2Chapter 9 -- Hierarchical Models Introduction: Introduction: Until now we have worked with flat entities such.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Introduction to Computer Graphics with WebGL
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
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.
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
11/6/ :55 Graphics II Introduction to Parametric Curves and Surfaces Session 2.
11/26/02(C) University of Wisconsin Last Time BSplines.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS552: Computer Graphics Lecture 19: Bezier Curves.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Introduction to Parametric Curve and Surface Modeling.
Introduction to Computer Graphics with WebGL
Ray Tracing Ed Angel Professor Emeritus of Computer Science
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Angel: Interactive Computer.
University of New Mexico
Parametric Curves.
Rendering Curves and Surfaces
Designing Parametric Cubic Curves
Introduction to Computer Graphics with WebGL
The Bernstein Basis and Bezier Curves
UNIT-5 Curves and Surfaces.
Introduction to Computer Graphics with WebGL
Introduction to Parametric Curve and Surface Modeling
Designing Parametric Cubic Curves
Shading II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Rendering Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 2 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

3 Objectives Introduce methods to draw curves ­Approximate with lines ­Finite Differences Derive the recursive method for evaluation of Bezier curves and surfaces Learn how to convert all polynomial data to data for Bezier polynomials Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

4 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Evaluating Polynomials Simplest method to render a polynomial curve is to evaluate the polynomial at many points and form an approximating polyline For surfaces, we can form an approximating mesh of triangles or quadrilaterals Use Horner’s method to evaluate polynomials p(u)=c 0 +u(c 1 +u(c 2 +uc 3 )) ­3 multiplications and 3 additions for cubic polynomial

5 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 deCasteljau Recursion De Casteljau worked for Citroen as a physicist and a mathematician We can use the convex hull property of Bezier curves to obtain an efficient recursive method that does not require any function evaluations ­Uses only the values at the control points Based on the idea that “any polynomial and any part of a polynomial is a Bezier polynomial for properly chosen control data”

6 Splitting a Cubic Bezier p 0, p 1, p 2, p 3 determine a cubic Bezier polynomial and its convex hull Consider left half l(u) and right half r(u) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

7 l(u) and r(u) Since l(u) and r(u) are Bezier curves, we should be able to find two sets of control points {l 0, l 1, l 2, l 3 } and {r 0, r 1, r 2, r 3 } that determine them Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

8 Convex Hulls {l 0, l 1, l 2, l 3 } and {r 0, r 1, r 2, r 3 } each have a convex hull that that is closer to p(u) than the convex hull of {p 0, p 1, p 2, p 3 } This is known as the variation diminishing property. The polyline from l 0 to l 3 (= r 0 ) to r 3 is an approximation to p(u). Repeating recursively we get better approximations. Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

9 Equations Start with Bezier equations p(u)=u T M B p l(u) must interpolate p(0) and p(1/2) l(0) = l 0 = p 0 l(1) = l 3 = p(1/2) = 1/8( p 0 +3 p 1 +3 p 2 + p 3 ) Matching slopes, taking into account that l(u) and r(u) only go over half the distance as p(u) l’(0) = 3(l 1 - l 0 ) = p’(0) = 3/2(p 1 - p 0 ) l’(1) = 3(l 3 – l 2 ) = p’(1/2) = 3/8(- p 0 - p 1 + p 2 + p 3 ) Symmetric equations hold for r(u) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

10 Efficient Form l 0 = p 0 r 3 = p 3 l 1 = ½(p 0 + p 1 ) r 1 = ½(p 2 + p 3 ) l 2 = ½(l 1 + ½( p 1 + p 2 )) r 1 = ½(r 2 + ½( p 1 + p 2 )) l 3 = r 0 = ½(l 2 + r 1 ) Requires only shifts and adds! Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

11 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Understanding graphically the method… html/noplugin/BezierCurve/AppDeCaste ljau/index.html -move the slider to see how other points can be computed (fractions other than ½ can be used to obtain points in order but this affects performance) The previous process can be generalized :

12 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Every Curve is a Bezier Curve We can render a given polynomial using the recursive method if we find control points for its representation as a Bezier curve Suppose that p(u) is given as an interpolating curve with control points q There exist Bezier control points p such that Equating and solving, we find p=M B -1 M I q p(u)=u T M I q p(u)=u T M B p

13 Matrices Interpolating to Bezier B-Spline to Bezier Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

14 Example These three curves were all generated from the same original data using Bezier recursion by converting all control point data to Bezier control points Bezier Interpolating B Spline Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

15 Surfaces Can apply the recursive method to surfaces if we recall that for a Bezier patch curves of constant u (or v ) are Bezier curves in u (or v ) First subdivide in u ­Process creates new points ­Some of the original points are discarded original and kept new original and discarded Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

16 Second Subdivision 16 final points for 1 of 4 patches created Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

17 Normals For rendering we need the normals if we want to shade ­Can compute from parametric equations ­Can use vertices of corner points to determine ­OpenGL can compute automatically Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Rendering Other Polynomials Every polynomial is a Bezier polynomial for some set of control data We can use a Bezier renderer if we first convert the given control data to Bezier control data ­Equivalent to converting between matrices Example: Interpolating to Bezier M B = M I M BI 18 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

19 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Utah Teapot ( Most famous data set in computer graphics Widely available as a list of 306 3D vertices and the indices that define 32 Bezier patches

20 (Quadrics) Any quadric can be written as the quadratic form p T Ap+b T p+c=0 where p=[x, y, z] T with A, b and c giving the coefficients Render by ray casting ­Intersect with parametric ray p(  )=p 0 +  d that passes through a pixel ­Yields a scalar quadratic equation No solution: ray misses quadric One solution: ray tangent to quadric Two solutions: entry and exit points Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015