Presentation is loading. Please wait.

Presentation is loading. Please wait.

11/26/02(C) University of Wisconsin Last Time BSplines.

Similar presentations


Presentation on theme: "11/26/02(C) University of Wisconsin Last Time BSplines."— Presentation transcript:

1 11/26/02(C) University of Wisconsin Last Time BSplines

2 11/26/02(C) University of Wisconsin Today More B-splines Surface patches

3 11/26/02(C) University of Wisconsin Non-Uniform B-Splines Uniform B-splines are a special case of B-splines Each blending function is the same A blending functions starts at t=-3, t=-2, t=-1,… Each blending function is non-zero for 4 units of the parameter Non-uniform B-splines can have blending functions starting and stopping anywhere, and the blending functions are not all the same

4 11/26/02(C) University of Wisconsin B-Spline Knot Vectors Knots: Define a sequence of parameter values at which the blending functions will be switched on and off Knot values are increasing, and there are n+d+1 of them, forming a knot vector: (t 0,t 1,…,t n+d ) with t 0  t 1  …  t n+d Curve only defined for parameter values between t d-1 and t n+1 These parameter values correspond to the places where the pieces of the curve meet There is one control point for each value in the knot vector The blending functions are recursively defined in terms of the knots and the curve degree

5 11/26/02(C) University of Wisconsin B-Spline Blending Functions The recurrence relation starts with the 1st order B-splines, just boxes, and builds up successively higher orders This algorithm is the Cox - de Boor algorithm –Carl de Boor is a professor here

6 11/26/02(C) University of Wisconsin Uniform Cubic B-splines Uniform cubic B-splines arise when the knot vector is of the form (-3,- 2,-1,0,1,…,n+1) Each blending function is non-zero over a parameter interval of length 4 All of the blending functions are translations of each other –Each is shifted one unit across from the previous one –B k,d (t)=B k+1,d (t+1) The blending functions are the result of convolving a box with itself d times, although we will not use this fact

7 11/26/02(C) University of Wisconsin B k,1

8 11/26/02(C) University of Wisconsin B k,2

9 11/26/02(C) University of Wisconsin B k,3

10 11/26/02(C) University of Wisconsin B 0,4

11 11/26/02(C) University of Wisconsin B 0,4 Note that the functions given on earlier slides are translates of this function obtained by using (t-1), (t-2) and (t-3) instead of just t, and then selecting only a sub-range of t values for each function

12 11/26/02(C) University of Wisconsin Interpolation and Continuity The knot vector gives a user control over interpolation and continuity If the first knot is repeated three times, the curve will interpolate the control point for that knot –Repeated knot example: (-3,-3,-3, -2, -1, 0, …) –If a knot is repeated, so is the corresponding control point If an interior knot is repeated, continuity at that point goes down by 1 Interior points can be interpolated by repeating interior knots A deep investigation of B-splines is beyond the scope of this class

13 11/26/02(C) University of Wisconsin Rendering B-splines Same basic options as for Bezier curves –Evaluate at a set of parameter values and join with lines Hard to know where to evaluate, and how pts to use –Use a subdivision rule to break the curve into small pieces, and then join control points What is the subdivision rule for B-splines? Instead of subdivision, view splitting as refinement: –Inserting additional control points, and knots, between the existing points –Useful not just for rendering - also a user interface tool –Defined for uniform and non-uniform B-splines by the Oslo algorithm

14 11/26/02(C) University of Wisconsin Refining Uniform Cubic B-splines Basic idea: Generate 2n-3 new control points: –Add a new control point in the middle of each curve segment: P’ 0,1, P’ 1,2, P’ 2,3, …, P’ n-2,n-1 –Modify existing control points: P’ 1, P’ 2, …, P’ n-2 Throw away the first and last control Rules: If the curve is a loop, generate 2n new control points by averaging across the loop When drawing, don’t draw the control polygon, join the X(i) points

15 11/26/02(C) University of Wisconsin Rational Curves Each point is the ratio of two curves –Just like homogeneous coordinates: –NURBS: x(t), y(t), z(t) and w(t) are non-uniform B-splines Advantages: –Perspective invariant, so can be evaluating in screen space –Can perfectly represent conic sections: circles, ellipses, etc Piecewise cubic curves cannot do this

16 11/26/02(C) University of Wisconsin 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 P 0,1 x(s,0) x(s,1)

17 11/26/02(C) University of Wisconsin Tensor Product Surface Patches Defined over a rectangular domain –Valid parameter values come from within a rectangular region in parameter space: 0  s<1, 0  t<1 Use a rectangular grid of control points to specify the surface –4 points in the bi-linear case on the previous slide, more in other cases Surface takes the form: –For some functions F i,s and F j,t

18 11/26/02(C) University of Wisconsin Bezier Patches As with Bezier curves, B i n (s) and B j m (t) are the Bernstein polynomials of degree n and m respectively Most frequently, use n=m=3: cubic Bezier patch –Need 4x4=16 control points, P i,j

19 11/26/02(C) University of Wisconsin Bezier Patches (2) Edge curves are Bezier curves Any curve of constant s or t is a Bezier curve One way to think about it: –Each row of 4 control points defines a Bezier curve in s –Evaluating each of these curves at the same s provides 4 virtual control points –The virtual control points define a Bezier curve in t –Evaluating this curve at t gives the point x(s,t) x(s,t)

20 11/26/02(C) University of Wisconsin Properties of Bezier Patches Which vertices, if any, does the patch interpolate? Why? What can you say about the tangent plane at each corner? Why? Does the patch lie within the convex hull of its control vertices?

21 11/26/02(C) University of Wisconsin Properties of Bezier Patches The patch interpolates its corner points –Comes from the interpolation property of the underlying curves The tangent plane at each corner interpolates the corner vertex and the two neighboring edge vertices –The tangent plane is the plane that is perpendicular to the normal vector at a point –The tangent plane property derives from the curve tangent properties and the way to compute normal vectors The patch lies within the convex hull of its control vertices –The basis functions sum to one and are positive everywhere

22 11/26/02(C) University of Wisconsin Bezier Patch Matrix Form Note that the 3 matrices stay the same if the control points do not change –The middle product can be pre-computed, leaving only:

23 11/26/02(C) University of Wisconsin Bezier Patch Meshes A patch mesh is just many patches joined together along their edges –Patches meet along complete edges –Each patch must be a quadrilateral OK Not OK

24 11/26/02(C) University of Wisconsin Bezier Mesh Continuity Just like curves, the control points must satisfy rigid constraints to ensure parametric continuity –How do we ensure C 0 continuity along an edge? –How do we ensure C 1 continuity along an edge? –How do we ensure C 2 continuity along an edge? For geometric continuity, constraints are less rigid What can you say about the vertices around a corner if there must be C 1 continuity at the corner point?

25 11/26/02(C) University of Wisconsin Bezier Mesh Continuity Just like curves, the control points must satisfy rigid constraints to ensure parametric continuity –C 0 continuity along an edge? Share control points at the edge –C 1 continuity along an edge? Control points across edge are collinear and equally spaced –C 2 continuity along an edge? Constraints extent to points farther from the edge For geometric continuity, constraints are less rigid –Still collinear for G 1, but can be anywhere along the line What can you say about the vertices around a corner if there must be C 1 continuity at the corner point? –They are co-planar (not the interior points, just corner and edge)

26 11/26/02(C) University of Wisconsin Rendering Bezier Patches Option 1: Evaluate at fixed set of parameter values and join up with triangles –Can’t use quadrilaterals because points may not be co-planar –Ideal situation for triangle strips –Advantage: Simple, and OpenGL has commands to do it for you –Disadvantage: No easy way to control quality of appearance Option 2: Subdivide –Allows control of error in the triangle approximation –Defined much like curve subdivision, but done once in each parametric direction

27 11/26/02(C) University of Wisconsin Midpoint Subdivision Repeatedly join midpoints to find new control vertices –Do it first for each row of original control points: 4x4 -> 4x7 –Then do it for each column of new control points:4x7 -> 7x7

28 11/26/02(C) University of Wisconsin A Potential Problem One (good) way to subdivide, is: –If a control mesh is flat enough – draw it –Else, subdivide into 4 sub-patches and recurse on each Problem: Neighboring patches may not be subdivided to the same level –Cracks can appear because join edges have different control meshes –This can be fixed by adding extra edges Crack

29 11/26/02(C) University of Wisconsin Computing Normal Vectors The partial derivative in the s direction is one tangent vector The partial derivative in the t direction is another Take their cross product, and normalize, to get the surface normal vector

30 11/26/02(C) University of Wisconsin B-Spline Surfaces Defined just like Bezier surfaces: Continuity is automatically obtained everywhere BUT, the control points must be in a rectangular grid OK Not OK

31 11/26/02(C) University of Wisconsin How to Choose a Spline Hermite curves are good for single segments where you know the parametric derivative or want easy control of it Bezier curves are good for single segments or patches where a user controls the points B-splines are good for large continuous curves and surfaces NURBS are the most general, and are good when that generality is useful, or when conic sections must be accurately represented (CAD)


Download ppt "11/26/02(C) University of Wisconsin Last Time BSplines."

Similar presentations


Ads by Google