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

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

of 48

  • date post

  • Category


  • view

  • download


Embed Size (px)

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

  • Curved SurfacesCSE167: Computer GraphicsInstructor: Steve RotenbergUCSD, Fall 2005

  • Bezier CurvesBezier curves can be thought of as a higher order extension of linear interpolationp0p1p0p1p2p0p1p2p3LinearQuadraticCubic

  • Curve EvaluationFind the point x on the curve as a function of parameter t:p0p1p2p3x(t)

  • de Casteljau Algorithm

    We start with our original set of pointsIn the case of a cubic Bezier curve, we start with four pointsp0p1p2p3

  • de Casteljau Algorithmp0q0p1p2p3q2q1

  • de Casteljau Algorithmq0q2q1r1r0

  • de Casteljau Algorithmr1xr0

  • Bezier Curvexp0p1p2p3

  • Recursive Linear Interpolation

  • Expanding the Lerps

  • Bernstein Polynomials

  • Bernstein PolynomialsThe Bernstein polynomial form of a Bezier curve is



  • Cubic Equation Form

  • Cubic Matrix Form

  • Cubic Matrix Form

  • Matrix Form

  • Bezier Curves & Cubic CurvesBy adjusting the 4 control points of a cubic Bezier curve, we can represent any cubic curveLikewise, any cubic curve can be represented uniquely by a cubic Bezier curveThere 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 its inverse) perform this mappingThere are other common forms of cubic curves that also retain this property (Hermite, Catmull-Rom, B-Spline)

  • DerivativesFinding the derivative (tangent) of a curve is easy:

  • TangentsThe derivative of a curve represents the tangent vector to the curve at some point

  • Convex Hull PropertyIf 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 curveAn important property of Bezier curves is that every point on the curve itself will be somewhere within the convex hull of the control pointsp0p1p2p3

  • ContinuityA cubic curve defined for t ranging from 0 to 1 will form a single continuous curve and not have any gapsWe say that it has geometric continuity, or C0 continuityWe can easily see that the first derivative will be a continuous quadratic function and the second derivative will be a continuous linear functionThe 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 continuityIn general, the higher the continuity value, the smoother the curve will be, although its actually a little more complicated than that

  • Interpolation / ApproximationWe 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 CurvesRather 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 curvesFor example, a large complex curve could be broken into cubic curves, and would therefore be a piecewise cubic curveFor 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 endpointsFor smoother looking curves, it is best to maintain the C2 continuity as well

  • Connecting Bezier CurvesA simple way to make larger curves is to connect up Bezier curvesConsider two Bezier curves defined by p0p3 and v0v3If p3=v0, then they will have C0 continuityIf (p3-p2)=(v1-v0), then they will have C1 continuityC2 continuity is more difficultp0p0p1p2P3P3p2p1v0v1v2v3v3v2v1v0C0 continuityC1 continuity

  • Bezier SurfacesBezier surfaces are a straightforward extension to Bezier curvesInstead of the curve being parameterized by a single variable t, we use two variables, s and tBy 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 surfacest0,01,11,00,1n

  • Curved SurfacesThe Bezier surface is a type of parametric surfaceA parametric surface is a surface that can be parametrized by two variables, s and tParametric surfaces have a rectangular topologyIn computer graphics, parametric surfaces are sometimes called patches, curved surfaces, or just surfacesThere are also some non-parametric surfaces used in computer graphics, but we wont consider those now

  • Control MeshConsider 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 p15p0p1p2p3p4p5p6p7p8p9p10p11p12p13p14p15st

  • Surface EvaluationThe 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 sThose 4 points now make up a new curve which we evaluate at tAlternately, 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 answerThis gives a pretty straightforward way to implement smooth surfaces with little more than what is needed to implement curvesst(0.2, 0.6)

  • Matrix FormWe saw the matrix form for a 3D Bezier curve is

  • Matrix FormTo 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 curvesFor example, to evaluate the x component of a Bezier curve, we can use:

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

  • Matrix Form

  • Matrix FormCx stores the coefficients of the bicubic equation for xGx 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 computationIt can also take advantage of 4x4 matrix support which is built into modern graphics hardware

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

  • NormalsTo compute the normal of the surface at some location (s,t), we compute the two tangents at that location and then take their cross productUsually, it is normalized as wellstnx

  • Bezier Surface PropertiesLike 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 pointsWith Bezier curves, the curve will interpolate (pass through) the first and last control points, but will only approximate the other control pointsWith Bezier surfaces, the 4 corners will interpolate, and the other 12 points in the control mesh are only approximatedThe 4 boundaries of the Bezier surface are just Bezier curves defined by the points on the edges of the surfaceBy matching these points, two Bezier surfaces can be connected precisely

  • TessellationTessellation 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 surfacesSubdivision surfacesFractalsProcedural modelsImplicit surfacesWe will look at the first two today

  • Uniform TessellationThe most straightforward way to tessellate a parametric surface is uniform tessellationWith this method, we simply choose some resolution in s and t and uniformly divide up the surface like a gridThis method is very efficient to compute, as the cost of evaluating the surface reduces to approximately the same cost as evaluating a curveHowever, 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 TessellationVery often, the goal of a tessellation is to provide the fewest triangles necessary to accurately represent the original surfaceFor 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 lowWe may also want more triangles in areas that are closer to the camera, and fewer farther awayAdaptive tessellation schemes are designed to address these requirements

  • Mixed TessellationSome practical renderers use a mixed tessellation schemeFirst, 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 pixelThe bulk of the cost of the algorithm is in the uniform tessellation, which can be implemented in a very efficient way

  • Displacement MappingTo add additional geometric detail to a tessellated surface, we can use displacement mappingWith this technique, a displacement map is stored, which is much like a texture map that stores a height value per texel instead of a colorAs with texture mapping, we can as