Tessellation shader: how to have NO inner level?

Hi,

How do I write my control shader so that I disable the inner tessellation level altogether ? Please, please tell me there is a way to do this.

I want to tessellate my patch so that I end up with the following tessellation:

x----x----x
|   /|   /|
|  / |  / |
| /  | /  |
|/   |/   |
x----x----x

I tried with

gl_TessLevelOuter[0] = gl_TessLevelOuter[2] = 1; // left and right edges
gl_TessLevelOuter[1] = gl_TessLevelOuter[3] = 2; // upper and lower edges

No matter what I do with gl_TessLevelInner[0] and [1], I can’t get it right.

Any idea?

Thanks,
Fred

PS: sorry for the multi-post. I actually posted this question to the beginners forum, but realized a short time later it was more appropriate to ask the question here.

I managed to get something that LOOKS alright by doing this:

gl_TessLevelOuter[0] = gl_TessLevelOuter[2] = 1.0; // left and right edges
gl_TessLevelOuter[1] = gl_TessLevelOuter[3] = 3.0; // upper and lower edges

gl_TessLevelInner[1] = 1.0; // left / right
gl_TessLevelInner[0] = 3.0; // upper / lower

Result:

x----x----x----x
|   /|   /|   /|
|  / |  / |  / |
| /  | /  | /  |
|/   |/   |/   |
x----x----x----x

In the tessellation evaluation shader, I must have fractional_odd_spacing:

// Note: fractional_odd_spacing
layout (quads, fractional_odd_spacing, ccw) in;

In this situation, things work fine. I need to have an odd number of subdivisions (1, 3, 5 and so on.).

Not sure if this whole thing is correct since the documentation is a bit difficult to understand (ouch)

Am I sure exactly 8 vertices and 6 triangles are generated with the example above (tess levels = 1.0 / 3.0) ?


If "equal_spacing" is used, the floating-point tessellation level is first
    clamped to the range [1,<max>], where <max> is implementation-dependent
    maximum tessellation level (MAX_TESS_GEN_LEVEL).  The result is rounded up
    to the nearest integer <n>, and the corresponding edge is divided into <n>
    segments of equal length in (u,v) space.

    If "fractional_even_spacing" is used, the tessellation level is first
    clamped to the range [2,<max>] and then rounded up to the nearest even
    integer <n>.  If "fractional_odd_spacing" is used, the tessellation level
    is clamped to the range [1,<max>-1] and then rounded up to the nearest odd
    integer <n>.  If <n> is one, the edge will not be subdivided.  Otherwise,
    the corresponding edge will be divided into <n>-2 segments of equal
    length, and two additional segments of equal length that are typically
    shorter than the other segments.  The length of the two additional
    segments relative to the others will decrease monotonically with the value
    of <n>-<f>, where <f> is the clamped floating-point tessellation level.
    When <n>-<f> is zero, the additional segments will have equal length to
    the other segments.  As <n>-<f> approaches 2.0, the relative length of the
    additional segments approaches zero.  The two additional segments should
    be placed symmetrically on opposite sides of the subdivided edge.  The
    relative location of these two segments is undefined, but must be
    identical for any pair of subdivided edges with identical values of <f>.

Source: http://www.opengl.org/registry/specs/ARB/tessellation_shader.txt

Fred

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.