If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource |
Introduction
For all who have been in a cave the past 3 years, bezier patches are a type of curved surfaces. There are other options, but beziers are the most common. Eventually patches are rendered as polygons, but because the polygons are generated dynamically, faster machines end up with smoother models, the ultimate in scalability.
A bezier patch is specified by a number of points (control points) and a tessellation factor to determine smoothness (higher factor equals smoother surfaces). The number of control points depends on the type of patch you are using; I will be covering bi-quadratic and bi-cubic patches (9 points and 16 points, respectively). While higher order bezier curves are possible, they are not feasible for use in computer games.
To start, lets look at a line:
P0 and P1 are the endpoints and Q is any point on the line. This line can be represented parametrically with the following equation:
Curves
Now, how about a bezier curve? We want the line from P0 to P2 to curve towards P1, like so:
So, what about cubic curves? Fortunately, the equation is almost identical:
Patches
Okay, now that you have 2 dimensions down, lets add the third dimension into the mix. Another dimension, uh oh, how do we do that? Well, take a look at this picture:
Now for the equations:
Okay, so that wasn’t too bad, was it? Didn’t think so. Fortunately, the cubic version is even easier to figure out because it is (again) almost exactly the same as the quadratic equation:
So, you see that once you understand bezier curves, then bezier patches are a piece of cake.
Well, that’s it, you survived. Hope this article helped you figure out some stuff about bezier curves. For more information, check out the resource section. Please send any comments, questions or flames to tutorials@mskinn99.freeservers.com.
For all who have been in a cave the past 3 years, bezier patches are a type of curved surfaces. There are other options, but beziers are the most common. Eventually patches are rendered as polygons, but because the polygons are generated dynamically, faster machines end up with smoother models, the ultimate in scalability.
A bezier patch is specified by a number of points (control points) and a tessellation factor to determine smoothness (higher factor equals smoother surfaces). The number of control points depends on the type of patch you are using; I will be covering bi-quadratic and bi-cubic patches (9 points and 16 points, respectively). While higher order bezier curves are possible, they are not feasible for use in computer games.
To start, lets look at a line:
P0 and P1 are the endpoints and Q is any point on the line. This line can be represented parametrically with the following equation:
Where t varies from 0 to 1. This equation has 2 basis functions (functions it is based on):
The equation can now be rewritten as follows:
Simplified further to:
All this means is that you take the sum of each basis function times each corresponding point.
Curves
Now, how about a bezier curve? We want the line from P0 to P2 to curve towards P1, like so:
Figure 2: Quadratic Bezier Curve
Phew, what a mess! Lets try to make that into one equation, okay?
And now our new basis functions (one for each point):
And the new equation becomes:
That, my friends, is the 2 dimensional equivalent of a bi-quadratic bezier patch. It’s called a quadratic bezier curve.
So, what about cubic curves? Fortunately, the equation is almost identical:
The only difference is the number of basis functions and the number of points (4 of each). The new basis functions are shown below (I won’t derive them, but you can if you want to):
Simple, huh? Not too much effort besides finding the new basis functions. Now, if you wanted to create a higher order bezier curve (more control points and basis functions) the general formula is shown:
Where i is the number of the basis function (0 through n) and n is the order (for a line this is 1, for a quadratic bezier this is 2, for a cubic bezier this is 3, etc.).
Patches
Okay, now that you have 2 dimensions down, lets add the third dimension into the mix. Another dimension, uh oh, how do we do that? Well, take a look at this picture:
Figure 3: Quadratic Bezier Patch
Now for the equations:
Getting rid of the intermediate C points…
(Now you see why we use the ? symbols instead of writing the whole thing out, because without them you wouldn’t be able to make much sense of that last equation.)
Okay, so that wasn’t too bad, was it? Didn’t think so. Fortunately, the cubic version is even easier to figure out because it is (again) almost exactly the same as the quadratic equation:
(Again) the only difference is the number of control points and the number of basis functions.
So, you see that once you understand bezier curves, then bezier patches are a piece of cake.
Well, that’s it, you survived. Hope this article helped you figure out some stuff about bezier curves. For more information, check out the resource section. Please send any comments, questions or flames to tutorials@mskinn99.freeservers.com.