openglglsltriangulation

Polygon triangulation on GPU using OpenGL


Are tessellation shaders also designed for triangulating non-convex (of any kind, in general) polygons?

Or should I triangulate polygons with a third-party tool and then just pass triangles to rendering?


Solution

  • Tessellation shaders are designed to subdivide larger primitives, typically triangles or quads, into smaller ones for more detailed rendering. They're commonly used in graphics programming to create smoother surfaces, increase detail, and handle adaptive level-of-detail rendering.

    While tessellation shaders can be used to refine the geometry of polygons, they are typically employed for working with simpler and convex primitives, such as triangles and quads. They are not intended for handling arbitrary, complex, or non-convex polygons. Tessellation shaders are limited in their capability to work with non-convex shapes due to the tessellation requirements and the specific algorithms used.

    For non-convex polygons, you'll usually need to perform polygon triangulation using a third-party tool or an algorithm specifically designed for this purpose before rendering. Triangulation breaks down a non-convex polygon into triangles, which are simpler to work with for rendering purposes.