05-03-2011, 08:43 AM
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:
| /| /|
| / | / |
| / | / |
|/ |/ |
I tried with
gl_TessLevelOuter = gl_TessLevelOuter = 1; // left and right edges
gl_TessLevelOuter = gl_TessLevelOuter = 2; // upper and lower edges
No matter what I do with gl_TessLevelInner and , I can't get it right.
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.
05-03-2011, 09:34 AM
I managed to get something that LOOKS alright by doing this:
gl_TessLevelOuter = gl_TessLevelOuter = 1.0; // left and right edges
gl_TessLevelOuter = gl_TessLevelOuter = 3.0; // upper and lower edges
gl_TessLevelInner = 1.0; // left / right
gl_TessLevelInner = 3.0; // upper / lower
| /| /| /|
| / | / | / |
| / | / | / |
|/ |/ |/ |
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>.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.