tesselation
play

TESSELATION 1 OUTLINE Tessellation in OpenGL Tessellation of - PowerPoint PPT Presentation

TESSELATION 1 OUTLINE Tessellation in OpenGL Tessellation of Bezier Surfaces Tessellation for Terrain/Height Maps Level of Detail 2 THE PIPELINE Remember the pipeline? OPENGL PIPELINE Tessellation is done in


  1. TESSELATION 1

  2. OUTLINE Tessellation in OpenGL • • Tessellation of Bezier Surfaces • Tessellation for Terrain/Height Maps Level of Detail • 2

  3. THE PIPELINE • Remember the pipeline?

  4. OPENGL PIPELINE • Tessellation is done in three pipeline stages: Tessellation Control Shader (TCS) • • Allows us to configure the types of triangles generated Tessellator • • Produces a fixed grid of triangles Tessellation Evaluation Shader (TES) • • Allows us to manipulate the grid TCS and TES are programmable • • Middle stage, tessellator, is not programmable

  5. THE EXAMPLE

  6. TESSELLATION LEVELS

  7. VERTEX SHADER #version 430 uniform mat4 mvp; void main(void) { }

  8. TESSELLATION CONTROL SHADER #version 430 uniform mat4 mvp; layout (vertices = 1) out; void main(void) { gl_TessLevelOuter[0] = 6; gl_TessLevelOuter[2] = 6; gl_TessLevelOuter[1] = 6; gl_TessLevelOuter[3] = 6; gl_TessLevelInner[0] = 12; gl_TessLevelInner[1] = 12; }

  9. TESSELLATION EVALUATION SHADER #version 430 layout (quads, equal_spacing, ccw) in; uniform mat4 mvp; void main (void) { float u = gl_TessCoord.x; float v = gl_TessCoord.y; gl_Position = mvp * vec4(u,0,v,1); }

  10. FRAGMENT SHADER #version 430 out vec4 color; uniform mat4 mvp; void main(void) { color = vec4(1.0, 1.0, 0.0, 1.0); }

  11. TESSELLATION FOR BEZIER SURFACES

  12. THE EXAMPLE

  13. TESSELLATION FOR TERRAIN / HEIGHT MAPS

  14. OVERLY JAGGED

  15. HEIGHT MAP AND NORMAL MAP

  16. WITH NORMAL MAP AND LIGHTING

  17. LEVEL OF DETAIL

  18. SUMMARY • Tessellation in OpenGL • Tessellation of Bezier Surfaces • Tessellation for Terrain/Height Maps • Level of Detail 19

More recommend