I'm trying to compute the analytic normals for a B-Spline surface. I know the normal is the cross product of the partial derivatives of the surface but I'm not sure if I'm taking the partial derivatives correctly.

Since a B-Spline surface is just the sum of the basis functions in each direction multiplied by the control points (2), I should just be able to take the derivative of each term and add them up (3), correct?

I'm getting the derivative of the basis function from [0].

What about the control points? Are they constant with respect to u and v? How do I take their derivative?

Thanks,

Victor

[0] - http://members.gamedev.net/skyork/pdfs/Bspline_Construction_Summary2005.pdf

The control points aren't functions of u or v, so you don't have to take derivatives of them. They're really just constants. You should be fine computing the derivative like you want. The tricky part is taking the derivatives of the B-spline basis functions. The functions themselves are built recursively, so the derivatives of a B-spline basis function of degree n can be formulated in terms of B-spline basis functions of degree n-1. This website should clarify:

http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-derv.html

If you're interested in getting code snippets for B-splines, "The NURBS Book" by Piegl and Tiller is a great resource. I would also like to know what you're using B-splines for. I work with CAD surfaces a lot and it's good to see someone else interested in them too.

Mathematically you are correct, but the terminology is wrong.

There is a difference between Bézier curves and B-splines (both 2D).

And their higher dimensional counterparts Bézier surfaces and NURBS (both 3D).

A B-spline is made of multiple weighted bezier curves, broadly speaking.

But the equations you have there seem like they belong to a Bézier surface not a B-Spline surface (or NURBS).

Their derivatives can be calculated with different approaches. I think using De Casteljau's algorithm is a easy one.

The equations that OP posted are the equations for a B-spline surface as well as a Bezier surface. The only difference is which basis functions appear as the \(N_{i,p}(u)\) terms. If it's the Bernstein basis functions, the surface is Bezier; if it's B-spline basis functions, then it's a B-spline surface. Strictly speaking, the B-spline basis is a generalization of the Bernstein basis.

Bezier and B-spline curves can be 3D spatial curves, and thus could also be described as 4D rational curves as well. B-splines can be decomposed into Bezier curves via generalizations of the de Casteljau method, like the Cox-de Boor or Boehm algorithm, or also known as knot refinement.

You're right that the equations posted don't describe a rational surface. Those equations would look like this:

\[ S(u,v) = \frac{\sum_{i=0}^n \sum_{j=0}^m w_{ij} P_{ij} N_{i,p}(u) N_{j,q}(v)}{\sum_{i=0}^n \sum_{j=0}^m w_{ij} N_{i,p}(u) N_{j,q}(v)} \]

**Edited by cadjunkie, 02 May 2014 - 09:39 AM.**