NURBS Demo

Demo features
This RenderWare 3.1 demo illustrates three things: (a) dynamic generation of geometry, (b) mixing retained-mode and immediate-mode rendering, and (c) user interaction with retained and immediate-mode rendered objects.

Every NRB file contains a description of a NURBS patch in ASCII format. When such a file is dropped onto the application window, a tessellation of the patch with the indicated U- and V-resolutions is performed (uniform in parameter-space). All vertex positions and normals are calculated accurately by direct evaluation of the NURBS input data using standard B-spline techniques. Multiple files may be dropped onto the window simultaneously. Files may also be specified in the start-up file called nurbs.ini, which is read when the demo is first run. This file already includes the four patch files from the 'teapot' directory, which is used to create the famous Utah teapot (the original teapot, that is, which is bottomless!) For this case the patches have been constructed to fit together as a single object. Other patches may not be. Note that the loaded object (which may consist of a number of patches) is normalised to fit inside a unit sphere centred about the origin.

Each NURBS patch is rendered as a collection of retained mode triangles, while the control net is rendered as a series of 3D immediate mode lines. The control net of a NURBS patch is only displayed when selected with the mouse (see also the patch preview menu option). For multiple patch objects only one patch at a time may be selected.

A NURBS patch may also be rendered as a wire-frame mesh (again using 3D immediate mode) to visualise the tessellation resolution. Wire-frame rendering is toggled via the menu. Similarly, the menu can be used to toggle vertex normal rendering (if a patch is two-sided, normals are drawn on both sides of the patch). Both wire-frame and normals rendering is affected by depth-cueing which can be used to retain some 3D information.

Try it out yourself

Use this link to download a zip file [495 KB] containing Win32 executables for D3D7 and OpenGL, a collection of NRB input files, together with some C-source code. Only application side source code files are provided. Recommended minimum hardware configuration: PIII 600MHz, nVidia GeForce2 GTS.

Copyright © 2000 John Irwin