Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.

Slides:



Advertisements
Similar presentations
Splines I – Curves and Properties
Advertisements

Homogeneous Transformations CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Lecture Notes #11 Curves and Surfaces II
Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
© University of Wisconsin, CS559 Spring 2004
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
Cubic Curves CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
© University of Wisconsin, CS559 Spring 2004
Outline for today Inverses of Transforms Curves overview Bézier curves.
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.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Modelling: Curves Week 11, Wed Mar 23
Midterm Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
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:
Curve Modeling Bézier Curves
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
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.
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
CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005
V. Space Curves Types of curves Explicit Implicit Parametric.
Numerical Computation
Curves.
Korea University Jung Lee, Computer Graphics Laboratory 3D Game Engine Design David H. Eberly 8.3 Special Surfaces 2001/11/13.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Chapter VI Parametric Curves and Surfaces
Geometric Objects and Transformation
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
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.
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
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.
11/6/ :55 Graphics II Introduction to Parametric Curves and Surfaces Session 2.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Computing & Information Sciences Kansas State University Lecture 31 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 32 of 42 Wednesday, 11.
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
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.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 12: Curves 1
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.
Introduction to Parametric Curve and Surface Modeling.
Curve & Surface.
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005

Final The final is on Tuesday, December 6 From 11:30-2:30 Center Hall, room 105 It will cover material from the entire quarter It will be similar to the midterm, but with 20 questions There will not be any questions on C++ or OpenGL

Topics The final will have geometry problems similar to those in the midterm There will be some mathematical questions about curved surfaces and ray tracing (lectures 12, 13, & 16) I suggest studying lectures 12, 13 & 16 well, as I might ask about anything from those (you don’t have to memorize the Fresnel equations, but you should know what they are for) There will not be any math questions about BRDFs, the ‘Rendering Equation’, or global illumination, but I expect you to be familiar with the concepts of these things There will be conceptual questions about scene management and modeling There will also be mathematical and conceptual questions from things covered in the first half of the class (traditional graphics pipeline)

Example: Distance to Plane A plane is described by a point p on the plane and a unit normal n. Find the distance from point x to the plane p n x

Example: Distance to Plane The distance is the length of the projection of x-p onto n: p n x x-p

Example: Target ‘Lock On’ For an airplane to get a missile locked on, the target must be within a 10 degree cone in front of the plane. If the plane’s matrix is M and the target position is t, find an expression that determines if the plane can get a lock on. M t

Example: Target ‘Lock On’ For an airplane to get a missile locked on, the target must be within a 10 degree cone in front of the plane. If the plane’s matrix is M and the target position is t, find an expression that determines if the plane can get a lock on. a b c d t

Example: Target ‘Lock On’ We want to check the angle between the heading vector (-c) and the vector from d to t: We can speed that up by comparing the cosine instead ( cos(10°)=.985 )

Example: Target ‘Lock On’ We can even speed that up further by removing the division and the square root in the magnitude computation: All together, this requires 8 multiplications and 8 adds

Example: Camera ‘Look At’ Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M.

Example: Camera ‘Look At’ Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M. Two possible approaches include: Measure angles and rotate matrix into place Construct a,b,c, & d vectors of M directly

Example: Camera ‘Look At’ Method 1: Measure Angles & Rotate Measure Angles: Tilt angle Heading angle Position Construct matrix by starting with the identity, then apply tilt and heading rotations

Example: Camera ‘Look At’ Method 2: Build Matrix Directly The d vector is just the position of the camera, which is e: The c vector is a unit length vector that points directly behind the viewer:

Example: Camera ‘Look At’ Method 2: Build Matrix Directly The a vector is a unit length vector that points to the right of the viewer. It is perpendicular to the c axis. To keep the camera from rolling, we also want the a vector to lay flat in the xz-plane, perpendicular to the y-axis. Note that a cross product with the y-axis can be optimized as follows:

Example: Camera ‘Look At’ Method 2: Build Matrix Directly The b vector is a unit length vector that points up relative to the viewer. It is perpendicular to the both the c and a axes Note that b does not need to be normalized because it is already unit length. This is because a and c are unit length vectors 90 degrees apart.

Example: Camera ‘Look At’ Method 2: Build Matrix Directly Summary:

Position Vector Dot Matrix

v=(.5,.5,0,1) x y Local Space (0,0,0)

Position Vector Dot Matrix v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d Matrix M

Position Vector Dot Matrix v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d v’v’

Position vs. Direction Vectors Vectors representing a position in 3D space are expanded into 4D as: Vectors representing direction are expanded as:

Direction Vector Dot Matrix

The abcd vectors of M’ are the abcd vectors of M transformed by matrix N Notice that a, b, and c transform as direction vectors and d transforms as a position Matrix Dot Matrix

Identity Take one more look at the identity matrix It’s a axis lines up with x, b lines up with y, and c lines up with z Position d is at the origin Therefore, it represents a transformation with no rotation or translation

Linear Interpolation Linear interpolation (Lerp) is a common technique for generating a new value that is somewhere in between two other values A ‘value’ could be a number, vector, color, or even something more complex like an entire 3D object… Consider interpolating between two points a and b by some parameter t a b t=1.. 0<t<1 t=0

de Casteljau Algorithm p0p0 p1p1 p2p2 p3p3 We start with our original set of points In the case of a cubic Bezier curve, we start with four points

de Casteljau Algorithm p0p0 q0q0 p1p1 p2p2 p3p3 q2q2 q1q1

q0q0 q2q2 q1q1 r1r1 r0r0

r1r1 x r0r0

Bezier Curve x p0p0 p1p1 p2p2 p3p3

Recursive Linear Interpolation

Expanding the Lerps

Bernstein Polynomials

The Bernstein polynomial form of a Bezier curve is where and Bernstein Polynomials

B33B33 B03B03 B13B13 B23B23

Cubic Equation Form

Cubic Matrix Form

Matrix Form

Bezier Curves & Cubic Curves By adjusting the 4 control points of a cubic Bezier curve, we can represent any cubic curve Likewise, any cubic curve can be represented uniquely by a cubic Bezier curve There is a one-to-one mapping between the 4 Bezier control points (p 0,p 1,p 2,p 3 ) and the pure cubic coefficients (a,b,c,d) The Bezier basis matrix B Bez (and it’s inverse) perform this mapping There are other common forms of cubic curves that also retain this property (Hermite, Catmull-Rom, B-Spline)

Derivatives Finding the derivative (tangent) of a curve is easy:

Tangents The derivative of a curve represents the tangent vector to the curve at some point

Convex Hull Property If we take all of the control points for a Bezier curve and construct a convex polygon around them, we have the convex hull of the curve An important property of Bezier curves is that every point on the curve itself will be somewhere within the convex hull of the control points p0p0 p1p1 p2p2 p3p3

Continuity A cubic curve defined for t ranging from 0 to 1 will form a single continuous curve and not have any gaps We say that it has geometric continuity, or C 0 continuity We can easily see that the first derivative will be a continuous quadratic function and the second derivative will be a continuous linear function The third derivative (and all others) are continuous as well, but in a trivial way (constant), so we generally just say that a cubic curve has second derivative continuity or C 2 continuity In general, the higher the continuity value, the ‘smoother’ the curve will be, although it’s actually a little more complicated than that…

Interpolation / Approximation We say that cubic Bezier curves interpolate the two endpoints (p 0 & p 3 ), but only approximate the interior points (p 1 & p 2 ) In geometric design applications, it is often desirable to be able to make a single curve that interpolates through several points

Piecewise Curves Rather than use a very high degree curve to interpolate a large number of points, it is more common to break the curve up into several simple curves For example, a large complex curve could be broken into cubic curves, and would therefore be a piecewise cubic curve For the entire curve to look smooth and continuous, it is necessary to maintain C 1 continuity across segments, meaning that the position and tangents must match at the endpoints For smoother looking curves, it is best to maintain the C 2 continuity as well

Connecting Bezier Curves A simple way to make larger curves is to connect up Bezier curves Consider two Bezier curves defined by p 0 …p 3 and v 0 …v 3 If p 3 =v 0, then they will have C 0 continuity If (p 3 -p 2 )=(v 1 -v 0 ), then they will have C 1 continuity C 2 continuity is more difficult… p0p0 p0p0 p1p1 p2p2 P3P3 P3P3 p2p2 p1p1 v0v0 v1v1 v2v2 v3v3 v3v3 v2v2 v1v1 v0v0 C 0 continuity C 1 continuity

Bezier Surfaces Bezier surfaces are a straightforward extension to Bezier curves Instead of the curve being parameterized by a single variable t, we use two variables, s and t By definition, we choose to have s and t range from 0 to 1 and we say that an s-tangent crossed with a t-tangent will represent the normal for the front of the surface s t 0,0 1,1 1,0 0,1 n

Curved Surfaces The Bezier surface is a type of parametric surface A parametric surface is a surface that can be parametrized by two variables, s and t Parametric surfaces have a rectangular topology In computer graphics, parametric surfaces are sometimes called patches, curved surfaces, or just surfaces There are also some non-parametric surfaces used in computer graphics, but we won’t consider those now

Control Mesh Consider a bicubic Bezier surface (bicubic means that it is a cubic function in both the s and t parameters) A cubic curve has 4 control points, and a bicubic surface has a grid of 4x4 control points, p 0 through p 15 p0p0 p1p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 p9p9 p 10 p 11 p 12 p 13 p 14 p 15 s t

Surface Evaluation The bicubic surface can be thought of as 4 curves along the s parameter (or alternately as 4 curves along the t parameter) To compute the location of the surface for some (s,t) pair, we can first solve each of the 4 s-curves for the specified value of s Those 4 points now make up a new curve which we evaluate at t Alternately, if we first solve the 4 t-curves and to create a new curve which we then evaluate at s, we will get the exact same answer This gives a pretty straightforward way to implement smooth surfaces with little more than what is needed to implement curves s t (0.2, 0.6)

Matrix Form We saw the matrix form for a 3D Bezier curve is

Matrix Form To simplify notation for surfaces, we will define a matrix equation for each of the x, y, and z components, instead of combining them into a single equation as for curves For example, to evaluate the x component of a Bezier curve, we can use:

Matrix Form To evaluate the x component of 4 curves simultaneously, we can combine 4 curves into a 4x4 matrix To evaluate a surface, we evaluate the 4 curves, and use them to make a new curve which is then evaluated This can be written in a compact matrix form:

Matrix Form

C x stores the coefficients of the bicubic equation for x G x stores the geometry (x components of the control points) B Bez is the basis matrix (Bezier basis) s and t are the vectors formed from the exponents of s and t The matrix form is a nice and compact notation and leads to an efficient method of computation It can also take advantage of 4x4 matrix support which is built into modern graphics hardware

Tangents To compute the s and t tangent vectors at some (s,t) location, we can use:

Normals To compute the normal of the surface at some location (s,t), we compute the two tangents at that location and then take their cross product Usually, it is normalized as well s t n x

Bezier Surface Properties Like Bezier curves, Bezier surfaces retain the convex hull property, so that any point on the actual surface will fall within the convex hull of the control points With Bezier curves, the curve will interpolate (pass through) the first and last control points, but will only approximate the other control points With Bezier surfaces, the 4 corners will interpolate, and the other 12 points in the control mesh are only approximated The 4 boundaries of the Bezier surface are just Bezier curves defined by the points on the edges of the surface By matching these points, two Bezier surfaces can be connected precisely