Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
Using NURBS Surfaces in Real-Time Applications
View All     RSS
October 27, 2020
arrowPress Releases
October 27, 2020
Games Press
View All     RSS







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Using NURBS Surfaces in Real-Time Applications


November 17, 1999 Article Start Previous Page 2 of 5 Next
 

B-Spline Basis Functions

Now we're going to define a powerful set of parametric functions called the b-spline basis functions (the b in b-spline stands for "basis" so this term is kind of redundant). These equations are defined for a given knot vector U = {u0, u1, …, un} as given in Equation 1.


Equation 1:



Whoa, that's scary! Let's take a close look at it to see what makes it useful. The p subscript in the second equation is the degree of the function (points are zero'th degree, lines are first degree, and so on). The first equation expresses that for zero'th degree curves, the function is either constant zero or constant one depending on the parameter, u, and where it falls in the knot vector. Looking at this pictorially for the knot vector U = {0,1,2} and B0,0, B1,0, and B2,0 we get the plots shown in Figure 4.


Figure 4. Plots of U = {0,1,2} for B0,0, B1,0, and B2,0

For degrees other than zero, we must recursively calculate the value of the function using a linear combination of the functions that are one degree less than the degree for which we're calculating. For first degree functions, we use a linear combination of the zero'th degree functions. For second degree functions, we use a linear combination of the first degree functions (which are also defined as a linear combination of the zero'th degree functions), and so on. As an example, for the knot vector U = {0,1,2, 3} we produce the plots shown in Figure 5 for B0,1, B1,1, B2,1, and B3,1.


Figure 5. Plots of U = {0,1,2} for B0,1, B1,1, B2,1, and B3,1.1

Interestingly enough, with the four control points, P0, P1, P2, and P3 defined in our previous example, we can now represent the curve, C from Figure 3, as a parametric curve by the equation:

C(u) = B0,1(u) * P0 + B1,1(u) * P1 + B2,1(u) * P2 + B3,1(u) * P3 with knot vector U = {0,1,2,3}.

This can be expressed more compactly as:

In our example, n = 3 and p = 1.

To verify that this approach works, pick a value for u, say 1.5. Looking at the plots in Figure 5 we can see that:

B0,1(1.5) = 0
B1,1(1.5) = 0.5
B2,1(1.5) = 0.5
B3,1(1.5) = 0

Looking at just the x values of the points, we get:

CX(1.5) = B0,1(1.5) x P0,X + B1,1(1.5) x P1,X + B2,1(1.5) x P2,X + B3,1(1.5) x P3,X
  = 0 * 0 + 0.5*1 + 0.5*2 + 0*0
  = 1.5

Looking at the y values of the points, we get :

CY(1.5) = B0,1(1.5) * P0,Y + B1,1(1.5) * P1,Y + B2,1(1.5) * P2,Y + B3,1(1.5) * P3,Y
  = 0 * 0 + 0.5*2 + 0.5*2 + 0*0
  = 2

Therefore, C(1.5) = (1.5, 2) which is just what we expect it to be!

We've covered a lot of ground and still haven't even looked at parametric surfaces yet. That's okay because by now you should have a decent understanding of the nature of parametric surfaces. We know that a parametric function is a set of equations that produce one or more values for a given parameter. In our examples, we produced x and y values and could easily have produce z values to generate points in 2-space or 3-space. I've also shown how several parametric functions can be used to "blend" points in 2-space (again, blending in 3-space would be a trivial extension of this process). We also learned what a knot vector is and how knot vectors can be used together with the b-spline basis functions to create some interesting "blending" functions.


Article Start Previous Page 2 of 5 Next

Related Jobs

Johnson County Community College
Johnson County Community College — Overland Park, Kansas, United States
[10.26.20]

Assistant Professor, Game Development
CVEDIA
CVEDIA — London, England, United Kingdom
[10.26.20]

Senior Unity Engineer - Remote - EU Time Zone
Insomniac Games
Insomniac Games — Burbank, California, United States
[10.25.20]

Lead Gameplay Programmer
Insomniac Games
Insomniac Games — Burbank, California, United States
[10.25.20]

Lead Engine Programmer





Loading Comments

loader image