Skip to content

Using OpenGL's tessellation shaders to render Bézier curves and surfaces.

License

Notifications You must be signed in to change notification settings

CleisthenesH/Tessellating-Bezier-Curves-and-Surface

Repository files navigation

⚠️Living Document: All Parts are Subject to Change⚠️

Tessellating Bézier Curves and Surface

A picture of a Bicubic Bézier surface
A Bicubic Bézier surface whoes trianglulation was calculated in the Tesselation shader. Only the 16 white points where sent to the graphics card.

A picture of a Conic section
A Conic section defined by three points and two tangents caulated as a rational quadratic Bézier curve. Only 3 points where sent to the graphics card.

This repo demonstrates how to use OpenGL's tessellation shaders to render Bézier curves and surfaces. These curves and surfaces are an intuitive, extendable, and numerically stable way to add natural curves and character to renders. And the tessellation shaders provide a performance minded and memory efficient way to implement Bézier curves and surfaces in OpenGL, what a great combination!

Summaries

Looking at the structure of the tessellation shader I believe it was built for these types of operations. As such the purpose of the files in each demonstration follows naturally from their shader type, which can be read about here, with main.c acting as minimal driving code to build the shanders and send them user input. Hence the following table only gives a mathematical summary of each demonstration:

Demonstration Summary
cubic curve Implementation of a cubic Bézier curve which can be thought of as a smooth line between two end point and their tangents.
bicubic rectangle Implementation of a bicubic Bézier surface which can be thought of as a soft rectangle controlled by 16 points which can be used to 'pull' the rectangle around.
cubic triangle Implementation of a biquadratic Bézier surface which can be thought of as a soft triangle controlled by 10 points which can be used to 'pull' the rectangle around.
conic section Implementation of a rational quadratic Bézier curve which can be thought of as as the conic section between two endpoints, their tangents, and an arbitrary third point.

And more to come!

Additional resources

About

Using OpenGL's tessellation shaders to render Bézier curves and surfaces.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published