| |||||
So far, all of the surface examples have taken the form of sheets that are stretched and deformed as the control points change. This is an easy way to demonstrate the basics; not all that many game objects can be represented as rubber sheets. As a more real-world example, I have created the shape of a space ship, as shown in Figure 9.4.
The model is not complete (there is no bottom), but it still demonstrates all of the important points. First, it's important to note that the code is exactly the same as described earlier. The only things that have changed are the positions of the control points. The code can be found on the CD under Code\Chapter09 - NURBS Patch Model, and you can find the control point positions in the FillPatchBuffer function.
Notice that the model is no longer a wavy square shape. This is because the control points are no longer arranged in a square shape. Instead, the control points along the edge are shaped into the rough outline of the ship. Figures 9.5 and 9.6 demonstrate this. First, I started with a nonuniform grid of control points. This will allow me to put more detail and control in certain areas than in others.
Next, the control points are moved to create the rough shape of the ship. I have disabled the height changes in this screenshot in order to emphasize the irregular shape.
Finally, the control point heights are changed to complete the ship. Figure 9.7 is basically the same shot as Figure 9.4, only now the model is drawn in wireframe so that you can see how the mesh is laid out.
The final object is much closer to something you'd actually use in a game. In a real-world situation, you probably wouldn't want to model the shape by hardcoding control point positions. Instead, you might want to create your own NURBS model format or use a NURBS modeler such as Rhino. However you choose to create the model, the NURBS representation does have some advantages.
| |||||