1
TESSELATION 1 OUTLINE Tessellation in OpenGL Tessellation of - - PowerPoint PPT Presentation
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
OUTLINE
2
- Tessellation in OpenGL
- Tessellation of Bezier Surfaces
- Tessellation for Terrain/Height Maps
- Level of Detail
THE PIPELINE
- Remember the pipeline?
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
THE EXAMPLE
TESSELLATION LEVELS
VERTEX SHADER
#version 430 uniform mat4 mvp; void main(void) { }
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; }
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); }
FRAGMENT SHADER
#version 430
- ut vec4 color;
uniform mat4 mvp; void main(void) { color = vec4(1.0, 1.0, 0.0, 1.0); }
TESSELLATION FOR BEZIER SURFACES
THE EXAMPLE
TESSELLATION FOR TERRAIN / HEIGHT MAPS
OVERLY JAGGED
HEIGHT MAP AND NORMAL MAP
WITH NORMAL MAP AND LIGHTING
LEVEL OF DETAIL
SUMMARY
19
- Tessellation in OpenGL
- Tessellation of Bezier Surfaces
- Tessellation for Terrain/Height Maps
- Level of Detail