It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

By Gabe Kruger
Gamasutra
June 11, 1999

Letters to the Editor:
Write a letter
View all letters


Features

 

Contents

Introduction

On Lines

Connect the Curves

Rendering Bézier Curves

Divide and Conquer

Code Listing 2

Bézier Patches

Rendering Bézier Patches

Advanced Patching

Not All is Perfect

Not All is Perfect

Bézier curves are very useful and generate good visuals, but there are several problems that do crop up when using them.

  • Cracks can form between adjacent patches if they are tessellated to different levels. This can be addressed by setting the tessellation level on a per-object basis, or by being aware of it and emitting the appropriate triangles at the edges. Cracks can also form when a Bézier patch abuts some other primitive, such as a regular polygon.
  • Constant steps in t do not generate constant steps in arclength. This can result in uneven textures stretching or improper changes in velocity when using Bézier curves to define a path. There are various workarounds to this problem, but a lot of it can be alleviated by having the distance between control points not vary too wildly.
  • These curves create infinite smoothness, but they do not add detail. Parametric curves can be used in conjunction with several other techniques to add detail. These include height mapping or using a noise function to perturb the calculated points.
  • Adding detail like a sharp peak to the middle of a patch often requires breaking the patch up into smaller patches. This can dramatically increase the number of patches and control points required for the surface. A solution to this problem involves defining the surface patches hierarchically.

A Brief Trip to the Zoo

Bézier curves fall into the class of parametric curves, but they are by no means the only form of parametric curves. They are the most common because they are efficient to calculate and intuitive to model with. There are some drawbacks, including the extra effort required to ensure continuity between sections.

Another popular parametric curve is the B-spline. The "B" stands for "basis" (not "Bézier"), and these should not be confused with Bézier curves. These are defined as a sequence of control points with continuity guaranteed along them. The blending functions are actually derived by enforcing continuity along the spline. Describing B-splines in any detail is a whole other article. They allow for smoother shapes, but at the cost of increased computation, and they are more difficult to use to model objects, since they do not pass through any of their control points and the control points do not directly affect geometric quantities such as tangent lines. There are several forms of B-spline: uniform and non-uniform, and rational and non-rational. The most famous of these are NURBs, non-uniform rational B-splines.

Other forms include Catmull-Rom splines, which pass through all of their control points with the tangent at each point defined and b -splines, which are similar to B-splines, but have two additional parameters that allow for further control over the shape of the curve.

It's been a long journey, but I believe worth it. Hopefully you will take what you have learned and add Bézier curves to your projects to generate paths for cameras or to create realistic looking curved surfaces. They are a powerful tool to add to your arsenal. I've included a sample application (including source code) which you can download a experiment with. Enjoy.

Gabe Kruger spends his days working at OptoSonics, a medical imaging research company, but spends his nights dreaming of games. He can be reached at gabe@refracted.com.

For Further Information

Computer Graphics: Principles and Practice (Second Edition) by James Foley, et. al (Addison-Wesley, 1990). This is the bible and a must for anyone interested in computer graphics.

Advanced Animation and Rendering Techniques: Theory and Practice by Alan Watt and Mark Watt. (Addison-Wesley, 1992.) Practical coverage of a wide range of topics.

http://graphics.cs.ucdavis.edu. A good graphics resource on the web with a lot of material covering parametric curves.

Acknowledgements

For their support, I would like to thank Brian Hook and Anna Kang of id Software.


[Back to] Introduction


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service