2
\$\begingroup\$

After investigating a bit about splines and reading a bunch of docs, I have noticed regular quadratic and cubic splines are not used very much in games.

Splines using quadratic/cubic Bézier curves, Catmull-Rom, B-splines, and other spline interpolation methods seem to be used widely though.

I can be totally wrong here but from books and tutorials I have seen that for regular cubic/quadratic you have to solve systems including first derivative for continuity and second derivative to match curvature. It seems that the most used splines (Bézier, Catmull-Rom, etc...) implicitly bring these features with fewer calculations.

Is this the reason that regular quadratic and cubic spline interpolation are not often used in game programming?

\$\endgroup\$
6
  • \$\begingroup\$ Well, the answer is "it depends". Bezier curves are actually not interpolating (they are guaranteed to pass only through the first and last vertcies of the control polygon). Cubic splines are pretty common and are used to generate smooth, curvy paths that pass through a series of control points. There are efficient algorithms for solving for these constraints (e.g. C1 continuity at the joint points of the spline segments). A thorough discussion of the subject is found reading a paper on CAGD or Wikipedia, for example. \$\endgroup\$
    – teodron
    Commented Sep 5, 2016 at 13:01
  • \$\begingroup\$ As I see interpolation, IMO Bezier are a way of interpolation. Anyway that is not important for the question, and your anwer doesn't really fully asnwers it. I was waiting for some cons and pros and how they related to game stuff to confirm or unconfirm my thoughts. \$\endgroup\$
    – Notbad
    Commented Sep 5, 2016 at 21:27
  • \$\begingroup\$ I have only commented. The main takeaway is that Beziers are not a way of interpolating, but a way of approximating a discrete/sampled path. The difference is the fact that the path is no longer guaranteed to pass through those points and the actual error that you get from not reaching the points might make certain AI tasks more complicated than they should. \$\endgroup\$
    – teodron
    Commented Sep 6, 2016 at 7:24
  • 1
    \$\begingroup\$ It looks like answers so far have interpreted this as "why aren't splines [in general] used more [compared to rendering polygonal geometry]?" when it looks like your question is actually: "why is this specific class of splines, called regular splines, not used as often as other common types?" I think the misunderstanding may be due to many of us being unfamiliar with this "regular" form you describe. I've searched for it, but "regular" comes up a lot in math so I haven't found a clear authoritative definition. Can you edit your question to link to a source defining this type of spline? \$\endgroup\$
    – DMGregory
    Commented Sep 6, 2016 at 22:33
  • \$\begingroup\$ @DMGregory is right, I might have misinterpreted the regular adjective as to having the sense of common, plain, vanilla splines to distinguish them for the specialized classes like NURBS, Catmull-Rom, Hermite, etc. The question is quite interesting and can definitely lead to a survey-like answer. \$\endgroup\$
    – teodron
    Commented Sep 9, 2016 at 8:06

3 Answers 3

2
\$\begingroup\$

A nice place to start (without the mathematical heaviness associated with the Differential Geometry of Curves and Surfaces) would be this. The author discusses the uses and practical advantages or disadvantages of these curve primitives with use cases taken from a game designer's perspective (or from a game editor developer's perspective if you will).


This source seems to discuss the essentials: types of curves and their properties (Hermite, Bezier, Catmull-Rom, Cubic Splines), how to evaluate them.


Performance wise, this Dr. Dobbs article discusses what can be done to evaluate Bezier curves efficiently. Many others can be found as the field is really mature and the applications are widespread.

Finally, this is a digital book that discusses Bezier and Spline curves in minute detail. If you are already familiar with these concepts, you can skip to the chapters that explain what algorithms are used to evaluate them.

\$\endgroup\$
1
\$\begingroup\$

From the question its not entirely clear what "regular" means in "regular quadratic and cubic splines are not used much." If you mean standard cubic equations, such as ax^3 + bx^2 + c, the reason they are not widely used is there is no direct relationship between coefficients and spatial control points. Given a set of points one would have to solve a system of equations for the coefficients a,b,c. This is called curve fitting: it reduces dimensionality, is slow to compute, but is widely used in the sciences/statistics to approximate data with a lower-degree curve.

Bezier Cubic, Catmull-Rom and B-Splines are used primarily because they have local control (moving controls moves the curve in an expected way), piecewise connectivity (they can be placed end-to-end for arbitrary number of controls), C1 or C2 continuity (smoothness) and may or may not interpolate their controls. The piecewise aspect is especially useful because it means you can have arbitrarily many data points (controls) and the curve will pass thru or near all of them. These features define the specialization of splines. Yet under-the-hood each of them does have a blending of standard cubic polynomials.

\$\endgroup\$
0
\$\begingroup\$

Graphics accelerator cards are not equipped to deal with them. Polygon-related operations like rasterization itself are taken care of quickly and automatically. The other operations require discrete points to operate on, like frustrum culling or even view projections.

These operations don't work at all with this kind of pipeline. They only work properly with a ray-tracing-like render algorithm. I say like to stave off any super pedantic people out there that might correct me and talk about other algorithms like photon-tracing that are basically the same thing.

When rendering triangles as in OGL you basically take discrete object data and transform them onto the screen. When you take these other more abstract graphics representations you don't have a discreet object at all. When you do ray tracing this doesn't really matter. When you do rendering like in OGL first you have to transform all of these into discrete objects (which generally look terrible compared to the "real" object). Or else use some kind of ray tracing with compute shaders or something and somehow put those results in among the results of your discreet rendering.

So while you can do it, it's mostly not practical to do so in OGL at least for a gaming application. Maybe it can be used here and there for certain things like allowing users to create content, but you won't see it used for data representation as the norm any time soon.

\$\endgroup\$
5
  • \$\begingroup\$ Excuse me, but can't see the linking between my question and your answer :/. \$\endgroup\$
    – Notbad
    Commented Sep 5, 2016 at 21:22
  • \$\begingroup\$ It's not practical, because it has poor performance. \$\endgroup\$
    – Yudrist
    Commented Sep 5, 2016 at 22:45
  • \$\begingroup\$ I suppose Notbad is asking about the pros and cons in terms of performance versus desired geometric properties. Your answer is indeed not addressing these points and I cannot really understand what the connection between ray tracing and splines really is at this level. \$\endgroup\$
    – teodron
    Commented Sep 6, 2016 at 7:28
  • \$\begingroup\$ Those data structures like 'cuadratic' splines are not designed for use with a graphics accelerator, they are designed for use with ray tracer and/or offline rendering. They are not used much because they are not usable for much in realtime rendering. They also require much more work to use at all in that paradigm. \$\endgroup\$
    – Yudrist
    Commented Sep 6, 2016 at 8:01
  • 3
    \$\begingroup\$ But as Notbad lays out in the question, many forms of splines are used commonly in games. We often interpolate animation data along Bézier curves, or camera positions along Catmull-Rom splines. So, why do we choose these spline types over "regular" splines? That's my reading of the question. I don't see anything in the question about using these splines for rendering, so the information about polygon rasterization seems out of place. \$\endgroup\$
    – DMGregory
    Commented Sep 6, 2016 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .