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: Tessellate(displacement map) a cube.

  1. #1
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    15

    Tessellate(displacement map) a cube.

    Hey!

    I have used the Geometry shader to create all the faces on a cube. This has been done by first creating two vertices on the cpu for each face which has then been expanded into two triangles (per face) in the geometry shader.

    The draw call: glDrawArrays(GL_LINES, ..., ...)

    I wonder now how I can do the same with tessellation and a displacement map? Two vertices for each face on the cpu and then expand everything to two triangles for each face and tessellate the surface with a displacement map.

    I'm asking this because the geometry shader is after the tessellation evaluation shader.. Need to expand it before the tessellation occur...

    Thanks
    Last edited by Darkpower; 12-13-2013 at 08:03 PM.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,106

  3. #3
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    15
    I know how tessellation with displacement mapping works. That link doesn't provide anything to my problem.

    I don't want to create all the 24 vertices on the cpu, only 12. 2 vertices/face. When using the vertex, geometry and fragment shader pipeline then I can expand every 2 vertices(lines) in the geometry shader to 4 vertices(triangle_strip).

    But I want to take it further and add a displacement map with tessellation for each face with the same method described above!

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,106
    Do not use the geometry shader to do tessellation. It is far to slow. If your graphics card does not support tesselation you should do it on the cpu. Displacement mapping is done in the fragment shader - here is one reference http://www.opengl.org/sdk/docs/tutor.../Chapter_4.pdf

Posting Permissions

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