CS 376 Introduction to Computer Graphics 04 / 27 / 2007 Instructor: Michael Eckmann.

Slides:



Advertisements
Similar presentations
Lecture Notes #11 Curves and Surfaces II
Advertisements

Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Lecture 10 Curves and Surfaces I
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
B-Spline Blending Functions
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 161 Today’s class Curve fitting Evaluators Surfaces.
Rational Bezier Curves
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Course Website: Computer Graphics 11: 3D Object Representations – Octrees & Fractals.
1cs426-winter-2008 Notes  Assignment 0 is due today  MATLAB tutorial tomorrow 5-7 if you’re interested (see web-page for link)
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Cubic Bezier and B-Spline Curves
A story about Non Uniform Rational B-Splines E. Shcherbakov.
Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Modelling: Curves Week 11, Wed Mar 23
CS 376 Introduction to Computer Graphics 04 / 06 / 2007 Instructor: Michael Eckmann.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
COEN Computer Graphics I
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Splines III – Bézier Curves
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.
CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 30 / 2007 Last Lecture :( Instructor: Michael Eckmann.
Model Construction 김 성 남. Contents What is Modeling? Model Construction - Interactive modeling tools - Scanning tools - Computer vision -
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
Numerical Computation
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
CS 376 Introduction to Computer Graphics 04 / 20 / 2007 Instructor: Michael Eckmann.
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
CS 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
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.
Computer Graphics Representing Curves and Surfaces.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Basic Theory (for curve 02). 1.3 Parametric Curves  The main aim of computer graphics is to display an arbitrary surface so that it looks real.  The.
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.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
(c) 2002 University of Wisconsin
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.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
1 CS 430/536 Computer Graphics I B-Splines and NURBS Week 5, Lecture 9 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
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.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Curve & Surface.
Representation of Curves & Surfaces
CS 445 / 645 Introduction to Computer Graphics
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

CS 376 Introduction to Computer Graphics 04 / 27 / 2007 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS Spring 2007 Today’s Topics Questions? Piecewise Cubic Parametric curves –Bezier blending functions –Splines –comparison of the different types Generalize to surfaces Speedups for polynomial evaluation quick comment on Shape Grammars Fractal geometry

Illumination Change this equation: I R = I aR k a O R + Sum all i [f radatten (d L ) I pRi O R (k d L ● N + W(theta)cos ns (phi))]which is INCORRECT to this one: I R = I aR k a O R + Sum all i [f radatten (d L ) I pRi ( O R k d L ● N + W(theta)cos ns (phi))] which is CORRECT NOTE: The object color O R is not to be multiplied by the specular term. Sorry. The above equation is for the red channel, do the same for green and blue channels. Recall... Ambient light as 3 components: I aR I aG I aB Point lights each as 3 components: I pR I pG I pB Objects with color: O R O G O B

Michael Eckmann - Skidmore College - CS Spring 2007 As stated earlier, the pieces of information defining a Bezier curve are 4 points. Therefore, the Geometry Matrix are these 4 points. P 1 and P 4 are the endpoints and P 2 and P 3 are the intermediate points that do not necessarily (usually don't) live on the curve. R 1 (the tangent at the first endpoint) = 3 [P 2 – P 1 ] R 4 (the tangent at the other endpoint) = 3 [P 4 – P 3 ] [ P 1 ] G = [ P 2 ] [ P 3 ] [ P 4 ] Q(t) = [ t 3 t 2 t 1 ] M G Bezier Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 The Basis Matrix M for Bezier curves is: [ ] [ ] [ ] [ ] Q(t) = [ t 3 t 2 t 1 ] M G So, what are the blending functions? Bezier Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 The Blending functions are: -t 3 + 3t 2 -3t + 1 3t 3 + 6t 2 + 3t -3t 3 + 3t 2 t 3 These functions are the Bernstein polynomials which are of the form: C(n, k) t k (1 – t ) n-k where C(n,k) is the choose function. C(n,k) = n! / (k! ((n-k)!)) In the case where n=3 (cubic), we have k among 0,1,2,3, which gives one function per geometric element (point.) Bezier Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 A nice feature of Bezier curves is: –Because the blending functions are symmetric to the line t=0.5, the sequence of points used to define a Bezier curve can be reversed without changing the shape of the curve. Both Bezier and Hermite curves are easy to make have G 1 or C 1 continuity at all the join points. It is not easy though to get C 2 continuity at the join points for Hermite and Bezier curves. Hermite and Bezier curves interpolate the points (that is, the curves go through the points). Splines are C 2 continuous. Bezier/Hermite Curves vs. Splines

Michael Eckmann - Skidmore College - CS Spring 2007 Splines are C 2 continuous. Natural cubic splines interpolate the control points and the coefficients of a natural cubic spline are dependent on all n control points. –expensive to invert an n+1 by n+1 matrix –moving one control point affects the entire curve B-splines are defined by m+1 control points, where m>=3. The control points are named P 0 through P m. –There are m-2 cubic polynomial, C 2 continuous curve segments joined together. These segments are named Q 3 through Q m. –The join points (as well as the endpoints) of the B-spline are called knots. There are m-1 knots. –moving one control point has only a local effect (changes four curve segments) –clearly the B-splines approximate (not interpolate) the control points –Let's look at the handout Splines

Michael Eckmann - Skidmore College - CS Spring 2007 Uniform = spacing between knots are equal (that is, the difference in t between knots is uniform) – without loss of generality we can set the spacing to 1, first t=0 and the next are 1,2,3,... –blending functions for all segments have same shape but are shifted Nonuniform = spacing between knots are unequal (see handout) –more flexibility to control the curve shape than uniform allows –2 or more consecutive knots that are the same reduce the continuity there (e.g., if we have 0 difference between 2 or more knots then continuity is reduced by 1 (i.e., C 2 -> C 1 continuity)) Rational = each spline curve segment is defined with ratio of polynomials –are invariant under rotation, scaling, translation AND perspective transformations of the control points. So, we can apply the perspective transform to the control points and then generate the perspectively transformed curve from the transformed control points to obtain the correct view of the curve. –in addition to the myriad of curves that can be produced, they can precisely define the conic sections (e.g. circle, ellipse, parabola, hyperbola) NURBS = NonUniform Rational B-Splines B-Splines

Michael Eckmann - Skidmore College - CS Spring 2007 NURBS = NonUniform Rational B-Splines –used frequently in graphics packages due to the properties just described Nonrational = each spline curve segment is defined as a polynomial (not a ratio of polynomials) –has the disadvantage (compared to rational B-splines) that they are not invariant to perspective transformations as well as cannot precisely describe the conics B-Splines

Michael Eckmann - Skidmore College - CS Spring 2007 Recall that we defined parametric cubic curves as Q(t) = T M G. For surfaces we define a parametric cubic surface with two parameters, hence Q(s,t) for some particular value of s, say s 1, Q(s 1,t) is a parametric curve. Also, for some particular value of t, say t 1, Q(s,t 1 ) is a parametric curve. [ G 1 (t) ] Q(s,t) = S M G(t) = S M [ G 2 (t) ] [ G 3 (t) ] [ G 4 (t) ] where each G i (t) is a parametric cubic. So, each G i (t) = T M G i The overall G(t) geometry matrix contains 16 geometry items (whereas for cubic curves, G contained 4 geometry items.) Curve Surfaces

Michael Eckmann - Skidmore College - CS Spring 2007 Horner's rule for evaluating polynomials –consider the x-coordinate parametric cubic: x(t) = a x t 3 + b x t 2 + c x t + d x evaluated as is, then you get –6 multiplies and 3 adds if you use Horner's rule, x(t) can be rewritten as: x(t) = [(a x t + b x )t + c x ]t + d x –3 multiplies and 3 adds –for all 3 coordinates, then you have 9 multiplies and 9 adds –we can do better Forward-difference calculations –generate successive values recursively by incrementing the previous value – x k+1 = x k + Δx k –Δx k is the forward difference Speedups for polynomial evaluation

Michael Eckmann - Skidmore College - CS Spring 2007 Forward-difference calculations –generate successive values recursively by incrementing the previous value x k+1 = x k + Δx k –Δx k is the forward difference –for parametric cubics if we divide our range of t into a set number of fixed intervals of size δ then x k = x(t k ) and x k+1 = x(t k+1 ) where t k+1 = t k + δ k=0,1,... x k = a x t k 3 + b x t k 2 + c x t k + d x x k+1 = a x t k b x t k c x t k+1 + d x = a x (t k +δ) 3 + b x (t k +δ) 2 + c x (t k +δ) + d x Δx k = x k+1 - x k = 3a x δt k 2 + (3a x δ 2 + 2b x δ)t k + (a x δ 3 + b x δ 2 + c x δ) Notice that Δx k is a quadratic polynomial in t Speedups for polynomial evaluation

Michael Eckmann - Skidmore College - CS Spring 2007 we can do the same kind of thing but this is the second forward-difference Δx k = Δx k-1 + Δ 2 x k-1 –Δ 2 x k-1 is the second forward difference... Δ 2 x k-1 = 6a x δt k-1 + 6a x δ 3 + 2b x δ 2 Notice that Δ 2 x k-1 is a linear polynomial in t we can do the same kind of thing but this is the third forward-difference Δ 2 x k-1 = Δ 2 x k-2 + Δ 3 x k-2 –Δ 3 x k-2 is the third forward difference... Δ 3 x k-2 = 6a x δ 3 which is a constant in t Speedups for polynomial evaluation

Michael Eckmann - Skidmore College - CS Spring 2007 x(t) = a x t 3 + b x t 2 + c x t + d x Δx k = 3a x δt k 2 + (3a x δ 2 + 2b x δ)t k + (a x δ 3 + b x δ 2 + c x δ) Δ 2 x k-1 = 6a x δt k-1 + 6a x δ 3 + 2b x δ 2 Δ 3 x k-2 = 6a x δ 3 We need initial values for x and the first and second forward differences when k = 0, t = 0 and we get the following x 0 = d x Δx 0 = a x δ 3 + b x δ 2 + c x δ Δ 2 x 0 = 6a x δ 3 + 2b x δ 2 and compute the first few x's and then to compute successive values of x it only takes 3 adds at each step: x k+1 = x k + Δx k Δx k = Δx k-1 + Δ 2 x k-1 Δ 2 x k-1 = Δ 2 x k-2 + Δ 3 x k-2 Speedups for polynomial evaluation

Michael Eckmann - Skidmore College - CS Spring 2007 To see the forward differences algorithm, see the handout with the two algorithms (the first is brute force --- not even using Horner's rule). The brute force uses 11 multiplies and 10 additions. Horner's rule algorithm requires 9 multiplies and 10 additions. The forward differences algorithm only takes 9 additions (and 0 multiplies) to calculate the next point coordinates (after some initialization that takes some multiplies and adds.) Speedups for polynomial evaluation

Michael Eckmann - Skidmore College - CS Spring 2007 See section 8-24 in our text. It's short. I suggest you read it and attend Tim Gildea's presentation of his thesis "LSystem Viewer: Interactive Visualization Software for Parametric DOL-Systems" which is at 8pm, Monday April 30 th in Harder room 202. Two other students will present their work before Tim. 6:30 p.m. Kellen Affleck 7:15 p.m. Max Levine 8:00 p.m. Tim Gildea Shape Grammars

Michael Eckmann - Skidmore College - CS Spring 2007 Up until now, we have only discussed objects (Euclidean shapes) being described by equations. These methods are good for man-made objects that are smooth and have regular shapes. Natural objects like mountains, clouds, terrain, trees, etc. have surface shapes that aren't well described by equations. Instead these are better described by “procedures”. Fractal methods are a way to make a procedural description of a surface/object. Fractal objects have 2 important characteristics –infinite detail at every point –self-similarity between the parts to the overall features (see next slide) Fractal objects are specified by a procedure that does an operation repeatedly. Fractal Geometry

Michael Eckmann - Skidmore College - CS Spring 2007 Zooming in enough on an equation defined surface (Euclidean shape) will reveal the limit to the level of detail in the shape. Zooming in on a Fractal object will reveal the “limitless” detail in the shape. (I'll try to draw figure 8-67 in text pg 480.) Fractals are defined infinitely, but of course in graphics we will perform a finite number of steps and hence our objects will have finite dimensions. Fractal Geometry

Michael Eckmann - Skidmore College - CS Spring 2007 Self-similarity –entire object contains scaled down versions of itself as its subparts –each subpart is created by multiplying a scale factor by the whole object –each subpart can use the same scale factor or different ones –random variations can be employed -> statistically self-similar used for trees, leaves, etc. Fractal Geometry

Michael Eckmann - Skidmore College - CS Spring 2007 Fractal Dimension D –a description of the amount of variation in the structure of a fractal object. a line is 1 dimensional, a square is 2 dimensional if we subdivide a line into N equal parts, each part is the original scaled down by a factor of N = N 1/1 = N 1/d if we subdivide a square into N equal parts, each part is the original scaled down by a factor of sqrt(N) = N 1/2 = N 1/d if we subdivide the Koch snowflake into 4 equal parts, each part is the original scaled down by a factor of 3, hence 3 = 4 1/d = 4 1/ The dimension of the Koch snowflake fractal = d = log(4)/log(3) which is approx See the slide showing the Koch snowflake Fractal Geometry

Michael Eckmann - Skidmore College - CS Spring 2007 For deterministic, self-similar fractals we have Fractal initiator –start shape Fractal generator –the pattern that subparts of the initiator are replaced by The generation of the fractal is deterministic because we always replace a subpart of the initiator with the generator and we do this at each step exactly the same way every time. Example on the board (figure 8-70). Fractal Geometry

Michael Eckmann - Skidmore College - CS Spring 2007 For statistically, self-similar fractals we could have –a Fractal initiator and –randomly choose a generator from a set of generators to be the pattern to replace a subpart of the initiator at each step This is non-deterministic (won't get the same exact shape every time) due to the random choice of generator. Instead of random generators, –random scalings could be done or –something else that is random to make the fractal non-deterministic. see figure 8-80 for an example. Fractal Geometry