Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triangulate a quad with a hole in it using tessellation

Is it possible to triangulate a quad with a hole in it using tesselation shader? For example,

enter image description hereenter image description hereenter image description here

  1. Imagine I have a Quad.
  2. Then I want to make a hole to the center of the quad.
  3. There need to be a lot more of vertices to make that hole.

And the questions:

  • Can I do that using Tessellation shader? If so, how?
  • Should I use Geometry shader instead?
like image 803
Jorjon Avatar asked May 18 '13 23:05

Jorjon


1 Answers

That is not a typical application of the tessellation shader, and that's also not what is done. Basically, you have a coarse 3d model, which is passed to your graphics card. The graphics card actually implements the tessellation algorithm, which creates a more refined 3d model by tessellating the primitives.

You have to supply two shaders: Tessellation control- and evaluation shaders (in OpenGL terms)

In the tessellation control shader you can "parameterize" the tessellation algorithm (inner and outer tessellation factors etc). Then the tessellation algorithm is applied. Thereafter the tessellation evaluation shader is used to, e.g. interpolate vertex attributes for the fine vertices.

What you want to do reminds me of CSG (http://en.wikipedia.org/wiki/Constructive_solid_geometry). It's true that the tessellation shader creates new data, but you may just paramterize the algorithm. You cannot "implement" the tessellation algorithm. Ad Geometry shader: it's true that you can emit (limited amount of) new primitives, but it also does not apply to your problem.

like image 150
dinony Avatar answered Nov 15 '22 10:11

dinony