Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Triangle tessellation in GL_ARB_tessellation_shade

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    3

    Triangle tessellation in GL_ARB_tessellation_shade

    I've been reading through http://www.opengl.org/registry/specs...ion_shader.txt today because I wanted to know how exactly triangles are tessellated when using a tessellation shader.

    However, there's a part I found strange - maybe I don't understand if fully (math/vocabulary wise). In "Section 2.X.2.1, Triangle Tessellation" there is a part about how the vertices for inner triangles are created. Specifically:
    Quote Originally Posted by GL_ARB_tessellation_shader text
    Otherwise, for each corner of the outer
    triangle, an inner triangle corner is produced at the intersection of two
    lines extended perpendicular to the corner's two adjacent edges running
    through the vertex of the subdivided outer edge nearest that corner.
    If I understand this right, it works like illustrated in this picture (assuming an inner tessellation level of 4): http://stud4.tuwien.ac.at/~e0725517/images/tri_tess.png

    However, if this was correct, it would be flawed, in that for obtuse triangles it would be possible that the inner vertices are placed outside the original triangle.

    I've tested it on an NVidia card, where the tessellation clearly results in correct concentric triangles.

    Thanks in advance.

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    3

    Re: Triangle tessellation in GL_ARB_tessellation_shade

    Ah, I've somehow overlooked the part where it says that this is for "equilateral triangles"... which is even more disturbing since then I cannot find a general description/algorithm in this text. Well I'll have the chance to test on different cards soon, so I'll see how much they differ... I hope that it's not too much

    EDIT:
    Hmm, thinking about it a bit more I think that the described algorithm should suffice anyway, as it should be possible to apply the same barycentric coordinates to any triangle then?

  3. #3
    Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    356

    Re: Triangle tessellation in GL_ARB_tessellation_shade

    I think there is a mistake in the description.. :-S
    The right algorithm should be :
    "the inner triangle corner is produced at the intersection of two lines extended parallel to the corner's two adjacent edges.."
    Otherwise as you point obtuse triangles can cause problems.

    Same mistake in the openGl 4.0 specification (page 104).
    That's strange.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2010
    Posts
    3

    Re: Triangle tessellation in GL_ARB_tessellation_shade

    Parallel would result in different vertices though. But (I think) I have found the solution anyway.
    It really only needs to be done for one triangle, the one with vertices (1, 0, 0), (0, 1, 0), (0, 0, 1). Which is an equilateral triangle where the algorithm works correctly. The resulting vertices can be used as barycentric coordinates for any triangle.
    So basically, for each tessellation-level parameters, the tessellation only needs to be done once, and the resulting data can be used for any other triangle.
    Some shots of my software implementation in action:
    http://stud4.tuwien.ac.at/~e0725517/images/Tessel_3.png
    http://stud4.tuwien.ac.at/~e0725517/...TessData_1.png
    http://stud4.tuwien.ac.at/~e0725517/...onEditor_0.png

    (Maybe they've written it that way to confuse ATI :P seeing that the unigine engine seems to behave incorrectly at times, and/or crashes even... but only on ATI cards)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •