Rendering resolution independent Curves

I wrote:

The only thing NURBS curves beat Bezier curves on is that they can be stored more compactly, because NURBS curves are actually Bezier curves but with redundant data potentially removed.

I made a mistake. I should have written:

The only thing NURBS curves beat Bezier curves on is that they can be stored more compactly, because NURBS curves are actually a sequence of one or more rational Bezier curves but with redundant data potentially removed.

It was late, and I was in a hurry. My bad.

Mountainking, when I wrote my response regarding your fragment shader program, I didn’t understand how it was supposed to work. Now I have a better idea. Your fragment shader needs to be executed for every fragment in each triangle defining the curves that are also within the viewport, rather than for every fragment in the framebuffer.

Anyway, you are nearly right, the fragment shader is executed for every fragment within each triangle. (A pixel consists of one or more fragments, depending on the multisampling antialiasing configuration.)

By the way, I think that algorithm is very clever. Its problem is that the time it takes to work grows on the order of the square of the size of the curve being rendered. So, for very small curves, such as found in fonts rendered at the sizes they usually are, the performance should be quite good for quadratic Bezier curves. The algorithm is much more complex (and slow) for cubic Bezier curves, though. When you are drawing screen-filling curves, performance will be bad no matter how fast your graphics card.

Jumping in late here, sorry, but you might be interested in seeing some of the work I have done in resolution independent contour rendering. I am not alone in doing this. It is somewhat of a trend in contemporary graphics research, and it has been implemented in at least one game by Valve Studios (Team Fortress Classic, released as part of their Orange Box). The distance field idea was presented by Chris Green at Valve, borrowing from several earlier authors in the field of resolution independent curve and surface rendering in computer graphics.

My first attempt from 2006 using second order polynomials:
http://www.itn.liu.se/~stegu/GLSL-conics/

Related work from 2006 in RenderMan SL (could be
ported to GLSL), using cubic Béziérs:

My most recent work (2009-10) using distance fields
for rendering the contours:
http://contourtextures.wikidot.com/

An earlier variant of the above from 2009 using
explicit gradients (some minor advantages using more data):
http://www.itn.liu.se/~stegu/contourtextures/

All these methods lend themselves well to rendering
properly anti-aliased lines of arbitrary width as well
as filled contours. Implicit curves are sometimes very
useful indeed, and they are quite shader friendly.

If you have any questions, feel free to email me (there
are plenty of pointers to where to contact me in the
material linked to above). I am quite likely to overlook
a post to this thread, as I cannot follow the OpenGL
forums as closely as I would like to.