View Full Version : Tessellate(displacement map) a cube.

12-13-2013, 06:56 PM

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...


12-13-2013, 10:45 PM
Read this http://ogldev.atspace.co.uk/www/tutorial30/tutorial30.html

12-13-2013, 11:51 PM
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!

12-14-2013, 04:00 AM
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/tutorials/TyphoonLabs/Chapter_4.pdf