Tessellation Evaluation Shader

From OpenGL.org
Revision as of 13:03, 21 November 2012 by Alfonse (Talk | contribs) (Tessellation options)

Jump to: navigation, search
Tessellation Evaluation Shader
Core in version 4.0
Core ARB extension ARB_tessellation_shader

The Tessellation Evaluation Shader (TES) is a Shader program written in GLSL that takes the results of a Tessellation operation and computes the interpolated positions and other attributes. These values are passed on to the next stage in the pipeline.


Tessellation options

The presence of an active TES in a program or program pipeline means that the tessellation primitive generation stage will occur, thus tessellating the given patch. Because of that, many options that control the way in which tessellation happens are specified in the TES itself.

The details of what these mean for the tessellation results are described in the section on the tessellation primitive generation. This section will only describe how to specify these options, not go into detail on exactly what they do.

All of these are input layout qualifiers. They are specified using that syntax:

layout(param1​, param2​, ...) in;

They can be specified as separate statements or all in one. However, each particular type of parameter can only be specified once (you technically can specify them multiple times, but they all must be the same).

Abstract patch type

The TES defines the type of abstract patch that will be tessellated.

The possible values for this are:

  • isolines​: The patch is a rectangular block of parallel lines.
  • triangles​: The patch is a triangle.
  • quads​: The patch is a quadrilateral.

The TES must define this.


The TES has options that control the spacing between tessellated vertices of the abstract patch. The possible values for this are:

  • equal_spacing​: There will be equal distances between vertices in the abstract patch.
  • fractional_even_spacing​: There will always be an even number of segments. All but two of the segments will have a fixed length. The remainder will go into two equal-length segments on symmetrical sides of the edge.
  • fractional_odd_spacing​: As even-spacing, but there will always be an odd number of segments.

This is optional. If the TES does not specify this parameter, equal_spacing​ will be used.

Primitive ordering

When emitting triangles, the Winding Order can be important for face culling. The process of tessellation takes place over an abstract patch, which is not in any particular coordinate system. It is the TES's responsibility to take abstract patch coordinates and generate real clip-space (or whatever your Geometry Shader expects) positions from them.

Therefore, maintaining the proper winding order for triangles is the job of the TES. To facilitate that, the TES has the ability to control the winding order of the primitive generator. This is done via the and ccw​ parameters.

Remember that this parameter only controls the winding of the abstract patch triangles. How this converts to the actual patch and clip-space output positions is up to the TES.

This is optional. If the TES does not specify this parameter, ccw​ will be used. Since lines don't have a winding order, this parameter is useless when using the isolines​ patch type.

Primitive generation

Normally, the kind of Primitive emitted by the primitive generator is defined by the abstract patch type. isolines​ will generate a series of line-strips, while the others will generate a series of triangles.

The TES can force the primitive generator to override this and simply generate a point primitive for each vertex in the tessellated patch. A Geometry Shader could modify these and build a quad, or they could simply be drawn as points.

To do this, use the layout qualifier point_mode​. Obviously specifying this makes the ordering parameter unimportant.