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

Slides:



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

Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
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
Jehee Lee Seoul National University
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.
Q about GL to render polygon glBegin(GL_TRIANGLES) glVertex3f(0,0,0); glVertex3f(1,1,0); glVertex3f(1,0,0); glVertex3f(0,1,0); glEnd();
MIT EECS 6.837, Durand and Cutler Curves & Surfaces.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
MIT EECS 6.837, Durand and Cutler Curves & Surfaces.
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.
Cubic Bezier and B-Spline Curves
ENDS 375 Foundations of Visualization Geometric Representation 9/30/04.
Modelling: Curves Week 11, Wed Mar 23
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
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.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
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:
Curve Modeling Bézier Curves
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
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.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
Numerical Computation
1 Dr. Scott Schaefer Smooth Curves. 2/109 Smooth Curves Interpolation  Interpolation through Linear Algebra  Lagrange interpolation Bezier curves B-spline.
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
Subdivision Schemes Basic idea: Start with something coarse, and refine it into smaller pieces for rendering –We have seen how subdivision may be used.
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.
Drawing Triangles CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
GPH 338 Computer Animation Survey
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.
Interactive Graphics Lecture 10: Slide 1 Interactive Computer Graphics Lecture 10 Introduction to Surface Construction.
Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Parametric Curves & Surfaces
11/26/02(C) University of Wisconsin Last Time BSplines.
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.
Introduction to Curves
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 12: Curves 1
Computing & Information Sciences Kansas State University Lecture 30 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 30 of 42 Wednesday, 09.
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:
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Introduction to Parametric Curve and Surface Modeling.
Constructing Objects in Computer Graphics
CS5500 Computer Graphics May 11, 2006
Curve & Surface.
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Three-Dimensional Object Representation
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005 Curved Surfaces CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005

Bezier Curves Bezier curves can be thought of as a higher order extension of linear interpolation p1 p1 p2 p3 p1 p0 p0 p0 p2 Linear Quadratic Cubic

Curve Evaluation p1 Find the point x on the curve as a function of parameter t: • x(t) p0 p2 p3

de Casteljau Algorithm p1 We start with our original set of points In the case of a cubic Bezier curve, we start with four points p0 p2 p3

de Casteljau Algorithm p1 q1 q0 p0 p2 q2 p3

de Casteljau Algorithm q1 r0 q0 r1 q2

de Casteljau Algorithm • x r1

Bezier Curve p1 • x p0 p2 p3

Recursive Linear Interpolation

Expanding the Lerps

Bernstein Polynomials

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

Cubic Equation Form

Cubic Matrix 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 (p0,p1,p2,p3) and the pure cubic coefficients (a,b,c,d) The Bezier basis matrix BBez (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 p3 p1 p0 p2

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 C0 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 C2 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 (p0 & p3), but only approximate the interior points (p1 & p2) 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 C1 continuity across segments, meaning that the position and tangents must match at the endpoints For smoother looking curves, it is best to maintain the C2 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 p0…p3 and v0…v3 If p3=v0, then they will have C0 continuity If (p3-p2)=(v1-v0), then they will have C1 continuity C2 continuity is more difficult… v1 p2 p2 v3 p1 P3 v0 v3 p1 v1 P3 v0 v2 p0 v2 p0 C1 continuity C0 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 0,1 t 1,1 n 0,0 s 1,0

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, p0 through p15 p12 p13 p8 t p9 p14 p4 p5 p15 p0 p10 p1 p11 p6 s p7 p2 p3

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 t (0.2, 0.6) s

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

Matrix Form Cx stores the coefficients of the bicubic equation for x Gx stores the geometry (x components of the control points) BBez 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 n t x s

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

Tessellation Tessellation is the process of taking a complex surface (like a bicubic patch) and approximating it with a set of simpler surfaces (like triangles) In computer graphics, there are a lot of different types of complex surfaces one might want to tessellate, such as: Parametric surfaces (such as Bezier surfaces) Displacement mapped surfaces Subdivision surfaces Fractals Procedural models Implicit surfaces We will look at the first two today

Uniform Tessellation The most straightforward way to tessellate a parametric surface is uniform tessellation With this method, we simply choose some resolution in s and t and uniformly divide up the surface like a grid This method is very efficient to compute, as the cost of evaluating the surface reduces to approximately the same cost as evaluating a curve However, as the generated mesh is uniform, it may have more triangles than it needs in flatter areas and fewer than it needs in highly curved areas

Adaptive Tessellation Very often, the goal of a tessellation is to provide the fewest triangles necessary to accurately represent the original surface For a curved surface, this means that we want more triangles in areas where the curvature is high, and fewer triangles in areas where the curvature is low We may also want more triangles in areas that are closer to the camera, and fewer farther away Adaptive tessellation schemes are designed to address these requirements

Mixed Tessellation Some practical renderers use a mixed tessellation scheme First, the original surface patch is adaptively subdivided into several subpatches, each approximately the same size (say around 10 pixels on a side) Then, each of the subpatches (which is just a rectangular s,t range within the larger 0,1 rectangle) is uniformly tessellated to some size (say 10 x 10) The result is that the curved surface is tessellated into triangles roughly the size of a single pixel The bulk of the cost of the algorithm is in the uniform tessellation, which can be implemented in a very efficient way

Displacement Mapping To add additional geometric detail to a tessellated surface, we can use displacement mapping With this technique, a displacement map is stored, which is much like a texture map that stores a height value per texel instead of a color As with texture mapping, we can assign a texture coordinate to each corner of the patch that allows us to position the displacement map onto the surface This coordinate gets interpolated when we evaluate the position and normal of the patch for some (s,t) value We can displace the position by the height value. The displacement is usually done along the computed patch normal Once we’ve displaced our tessellated triangle mesh, we will need to recompute accurate normals, as they will change based on the displacements To avoid geometry aliasing, we should really perform some sort of filtering on the height value (such as mipmapping)

Scan Conversion The serial scan conversion technique we looked at earlier in the quarter requires expensive set-up computations in order to make the per-pixel cost very low, thus making it efficient for large triangles Some surface renderers generate triangles smaller than a single pixel, or the size of a few subpixels in an antialiased rendering For triangles this small, it is usually better to use different approaches in the scan conversion process Also, as these micropolygons are so usually generated from uniform tessellations, other optimizations can be made to account for all of the shared vertices and edges between them

Transparency Parametric surfaces and displacement mapping combine to add a powerful new set of features for describing complex geometry Usually, renderers that support advanced features such as these will also have a more sophisticated technique for handling transparency and hidden surfaces than the techniques we’ve seen so far High quality renderers generally don’t render the scene one primitive at a time Instead, they must store the entire scene in memory at one time and process the rendering one pixel at a time In this way, if we have many layers of transparent surfaces overlapping in complex ways, we don’t have to rely on sorting the primitives, which may be guaranteed to fail…

Scanline Rendering Some renderers (such as ray tracers) truly render individual pixels one by one and can therefore render them in random order Other renderes are organized to process the entire scene in a serial fashion, such as top to bottom, left to right These are known as scanline renderers, as they process one horizontal scanline at a time

Scanline Rendering With a scanline renderer, primitives (such as triangles) are first transformed and clipped/culled to device space The clipping/culling removes any invisible triangles, and the remaining triangles are gathered together into a big array Next, the array of primitives is sorted from top to bottom, based on the highest y value in the primitive Then, the rendering begins, by looping in y from the top scanline down to the bottom We maintain an active list of primitives, which are all of the primitives that intersect the current scanline For each new scanline, we may add some new primitives to the list and remove some old ones We also keep the active list sorted from left to right, based on the lowest x value in the primitive To render a scanline, we loop through the active list, breaking it up into horizontal spans, where each span can have the individual primitives sorted in z

Surface Renderers Curved surface renderers often use a scanline based approach combined with the mixed tessellation scheme Surface patches are subdivided into roughly uniform sized subpatches, which are culled to the view frustum The scanline algorithm then treats these subpatches as the primitives When a new subpatch is added to the active list, it is uniformly tessellated into a grid of microtriangles, which can then be scan converted with special purpose techniques This method allows the combination of complex surfaces, displacement maps, antialiasing, and transparency while being reasonably efficient with memory usage Of course, one can also perform any lighting operations one wants to apply per microtriangle, and in fact, this tends to be the most expensive part of the rendering

Surface Renderers High quality renderers need to be able to render extremely detailed scenes efficiently The scanline approach combined with mixed tessellation is a powerful approach to rendering that has been used for many years in real applications Renderers often allow arbitrary properties to be assigned to the corners of the patches, or otherwise mapped onto them These properties are then used by user-programmable shaders that can implement texture mapping, lighting, displacement mapping, and other operations to come up with the final surface shape and pixel color This fundamental approach is the one proposed in the REYES architecture (render everything you ever saw), back in 1984 It is the backbone of Pixar’s RenderMan renderer, which has been used in numerous movies for the last 20 years Only in the last 5 years has there been a serious push towards the even more sophisticated approaches of ray tracers and global illumination renderers, which we will look at later…

Other Curve Types Curves Surfaces Hermite curves Catmull-Rom curves B-Splines NURBS Surfaces B-Spline / NURBS Trim curves Subdivision surfaces Implicit surfaces