Project 5: NURBS Surface Generator
Build a NURBS surface evaluator that generates a mesh from control points and knot grids.
Project Overview
| Attribute | Value |
|---|---|
| Difficulty | Level 3: Advanced |
| Time Estimate | 2-3 weeks |
| Main Language | C++ |
| Alternative Languages | C, Rust, Python |
| Knowledge Area | Parametric surfaces |
| Tools | Mesh viewer, plotting tool |
| Main Book | “The NURBS Book” by Piegl & Tiller |
What you’ll build: A surface evaluator that outputs a triangle mesh approximation of a NURBS surface.
Why it teaches computational geometry: Surfaces are how CAD represents smooth solids. This makes them concrete.
Core challenges you’ll face:
- Extending basis functions to two parameters
- Managing control point grids and weights
- Producing stable, uniform sampling
Real World Outcome
You will generate a surface mesh that can be visualized in a mesh viewer. The surface should reflect the control net and weights.
Example Output:
$ ./nurbs_surface --control surface.json --u 40 --v 40 --output surface.obj
Degree (u,v): 3,3
Control points: 6 x 6
Wrote surface mesh to surface.obj
Verification steps:
- View the surface mesh and compare against the control net
- Adjust weights and observe shape changes
The Core Question You’re Answering
“How do CAD systems generate smooth surfaces from a grid of control points?”
This project extends curve intuition into full surface modeling.
Concepts You Must Understand First
Stop and research these before coding:
- Tensor-product surfaces
- How do you combine two sets of basis functions?
- Book Reference: “The NURBS Book” by Piegl & Tiller, Ch. 5
- Control nets
- How do control points influence local surface shape?
- Book Reference: “Curves and Surfaces for CAGD” by Gerald Farin, Ch. 6
- Surface sampling
- How do you choose u/v resolution for mesh output?
- Book Reference: “Geometric Modeling” by Michael E. Mortenson, Ch. 9
Questions to Guide Your Design
- Sampling strategy
- Will you sample uniformly in parameter space?
- How will you detect high-curvature regions?
- Output mesh
- How will you triangulate the sampled grid?
- How will you generate normals for rendering?
Thinking Exercise
Surface Parameter Grid
Imagine a 4x4 control net. Sketch how many quads appear when you sample a 10x10 grid in parameter space.
Questions while working:
- How many triangles does that produce?
- How does sampling density affect performance?
The Interview Questions They’ll Ask
Prepare to answer these:
- “How do NURBS surfaces differ from NURBS curves?”
- “What is a tensor-product surface?”
- “How do control nets affect surface shape?”
- “Why do you need tessellation for display?”
- “How do you compute normals for a parametric surface?”
Hints in Layers
Hint 1: Starting Point Extend your curve basis evaluation into two dimensions.
Hint 2: Next Level Compute weighted sums across the control net for each (u,v).
Hint 3: Technical Details Triangulate the sampled grid consistently to avoid cracks.
Hint 4: Tools/Debugging Visualize the control net alongside the generated surface.
Books That Will Help
| Topic | Book | Chapter |
|---|---|---|
| NURBS surfaces | “The NURBS Book” by Piegl & Tiller | Ch. 5 |
| Control nets | “Curves and Surfaces for CAGD” by Gerald Farin | Ch. 6 |
| Tessellation | “Geometric Modeling” by Michael E. Mortenson | Ch. 9 |
Implementation Hints
- Start with a simple surface like a bilinear patch.
- Keep your evaluator separate from the mesh writer.
- Provide controls to vary resolution for quality vs speed.
Learning Milestones
- First milestone: You can evaluate points on a surface grid.
- Second milestone: You can export a mesh that renders correctly.
- Final milestone: You can explain how control nets shape surfaces.