Advanced Computer Graphics
• Exercise 2 - Splines and Silhouettes
Due: February 21
1. As we saw, a single cubic Bézier curve can be defined as Q(t) = b0(t) P0 + b1(t) P1 + b2(t) P2 + b3(t) P3 where the Pi are the control points and the bi(t) are the Bernstein polynomials.
(a) Extend this definition to a bicubic Bézier patch. That is, write down the equation for Q(s,t) in terms of the Bernstein polynomials and the sixteen control points Pij, i=0..3, j=0..3. 2.
(b) How would you go about computing the surface normal at an arbitrary point on a Bézier patch? That is, given some s and t, find the surface normal at Q(s,t). (Explain how you would derive the answer - it is not necessary to write out the full expression explicitly.)
- The extension of a Bézier curve to a two dimensional parametric surface is rather natural. If we imagine a 2D grid of control points and then inspect each dimension of that grid independently, we notice that Bézier curves do not require coherence across dimensions. Therefore, we can simply break each dimension up individually in order to create the full definition. If we have control points Pij (i=0...3, j=0...3), then we can independently evaluate the Bernstein polynomials in each dimension. That means that for each term we will have some Pij*bi(t)*bj(s). The entire expression would therefore be Q(t,s) = P00.b0(t).b0(s) + P01.b0(t).b1(s) + P02.b0(t).b2(s) + P03.b0(t).b3(s) + P10.b1(t).b0(s) + P11.b1(t).b1(s) + P12.b1(t).b2(s) + P13.b1(t).b3(s) + P20.b2(t).b0(s) + P21.b2(t).b1(s) + P22.b2(t).b2(s) + P23.b2(t).b3(s) + P30.b3(t).b0(s) + P31.b3(t).b1(s) + P32.b3(t).b2(s) + P33.b3(t).b3(s)
- For the normals, we can just use the function Q(t,s) to find two vectors pointing away from the point Q(t,s). We can just evaluate Q at some small distance ds and dt from s and t, and then use the vectors generated therein to compute the normal by taking the cross product of those vectors and then normalizing.
2. What is the degree of continuity at an interior point of an nth-order B-spline patch? What is the degree of continuity at a point on the boundary between two such B-spline patches?
- The interior pint of a B-spline patch is just a polynomial of degree n. Since polynomials are infinitely differentiable, they have infinite continuity.
- Just as we saw in class let an arbitrary cubic B-spline segment be denoted as Qi(t). We can therefore define any two neighboring segments to be Q0(t) = b-3(t) P0 + b-2(t) P1 + b-1(t) P2 + b0(t) P3 and Q1(t) = b-3(t) P1 + b-2(t) P2 + b-1(t) P3 + b0(t) P4. From the definition of Berstein polynomials, we know that any bi(t) = ait3 + bit2 + cit + di.
- In class we saw that this representation of a cubic B-spline guaranteed C2 continuity, but what about C3? We will prove that C3 continuity is impossible to attain from a cubic B-spline.
- First, differentiate Q0(t) and Q1(t) three times so that we may attempt to match their boundaries. All of the coefficients of the bi(t) drop out except ai which has a factor of 6 attached to it from differentiation. Now, we set Q0(1) = Q1(0) and solve for the coefficients of the b(t)'s. The expression that follows is a-3P0 + [a-2 - a-3]P1 + [a-2 - a-3]P2 + [a-2 - a-3]P3 - a0P4 = 0. Since we have no parameter 't' and only the a's have survived, we must conclude that all of the ai = 0! This means that we have no cubic coefficients, but that implies we're no longer a cubic B-spline, so we must conclude that cubic B-splines cannot have C3 continuity. In fact, if we were to continue anyway, the second derivative would yield equations for all of the b's just as the third derivative did for the a's. Since the a's were found to be zero, the same thing would happen to the b's as before, all the way up to C0 continuity and the entire system would collapse to zero.
- The reason this problem occurs is because once we have taken n derivatives, where n is the degree of the B-spline, we have eliminated any parameter from the continuity equations thereby forcing us to choose the nth degree polynomial coefficients to be zero. We can therefore conclude that any B-spline of degree n can have at most Cn-1 continuity.
3. Describe an algorithm for extracting a discrete approximation of the silhouettes of a surface represented as a signed distance function sampled along a uniform voxel grid. That is, the value at each voxel gives the signed distance to the nearest surface location, negative values occur inside the surface and positive values occur outside the surface. Hint: silhouettes depend on the viewing position and occur at areas on the surface where the dot product of the surface normal and the unit-length vector pointing toward the camera's center of projection are zero. What is the complexity of your algorithm? How does the running time of your algorithm relate to the Marching Cubes algorithm we studied in class?
- First off, notice that the computation of a normal at a point in space from an implicit surface is simply the gradient of that function evaluated at the specified point. In this way we can compute the normal anywhere on the surface once we determine exactly where we want to find normals.
- From a surface normal we can determine whether a point is part of the silhouette by taking its dot product with a vector pointing towards the center of projection and testing whether it is zero. This fact will become useful a little later.
- In order to find the first point on the silhouette by computing the normals of the surface everywhere and then determining when the dot product between these normals and the camera vector changes sign. We can simply march through the voxel grid in the same way as we normally would (using the signed distance function as a guide for our step size). Once we have found one we are in a good position.
- We can use the fact that a silhouette is at least piecewise continuous to speed the search up of the entire silhouette. While we are traversing the voxel grid to find our initial silhouette, we set a flag indicating we have visited the voxel. Once we find a silhouette point we can simply search in the neighborhood around that initial point and follow the boundary until it finishes or wraps on itself.
- This process is similar to a corner detector with hysteresis thresholding only we perform the inverse operation. We find the initial points and then trace out neighboring positions to complete the piecewise continuous links looking for the next pixel in the chain that minimizes the dot product between the camera vector and the normal at the search location.
- Notice that there is some overhead in computing the normals, but we need only do this one time for the entiring rendering session.
- We expect this algorithm to have order n^3 complexity in the very worst case whereby we must visit every single voxel in the grid. In practice we should do much better than this. We could implement an octree to speed up the initial lookups. It's hard to put an exact big-O value on the algorithm because it is highly dependent on the volume. In the best case, this could run in sublinear time. This would happen if there is only one silhouette that is completely continuous. We only need to find one point, and then we only perform 8 comparisons for the points on the silhouette boundaries.
- In relation to the marching cubes, we should easily beat it. The marching cubes must visit all voxels and test the signs across the cube. We should not have to visit nearly as many voxels because the silhouettes are 1D.
4. (Optional for extra credit) Show that a quadratic rational Bézier curve in the plane can generate arbitrary conic sections (i.e., arcs of an arbitrary curve of the form Ax2 + Bxy + Cy2 + Dx + Ey + F = 0). Short proofs preferred!
© 2008 Sean M. Arietta
University of Virginia