PDA

View Full Version : Tessellation shaders: more control over the actual tessellation?



Ailurus
12-17-2015, 03:28 AM
I don't seem to have enough rights to post something to the OpenGL suggestions board, so I thought I'd post it here.

I recently started using TC and TE shaders (focusing on triangular patches), and was rather surprised by the limited options to control the actual tessellation. I do understand the choice to have separate Inner and Outer levels, but it is — for instance — not possible to uniformly tessellate an (equilateral) triangle into 4, 9, 16, ... smaller (equilateral) triangles. Would it be an idea to provide the user with a custom tessellation mode?

Alfonse Reinheart
12-17-2015, 06:14 AM
No. Well, I'm sure it's theoretically possible in some future hardware, but it's not a good idea in general.

The reason tessellation is specified the way it is is that it allows patches to have their own tessellation levels while still providing perfect connectivity between adjacent triangles. OpenGL guarantees that if the outer levels for a shared edge are identical, then the TES will get identical input coordinates. This only works because each edge is tessellated the same number of times.

If you do a 3x equilateral subdivision for one triangle (16 triangles) and a 2x subdivision for a neighboring triangle (9 triangles), then you have a problem. The shared edge between them will have more vertices on one side than the other. Which means that the rasterizer can create gaps between the triangles.

That's bad.

Your way only provides connectivity across a mesh if all triangles are subdivided the same number of times.

Ailurus
12-17-2015, 02:57 PM
Thanks for your reply :). I agree, using the same tessellation for an entire mesh would only be useful in very specific cases. Still, it would be interesting to be able to experiment a bit more with the TC and TE shaders.