normalize and vec4 oddness Patches -> primitives What is a patch? Up to 32 vertices Tessellation Control Shader (TCS) Tessellation Primitive Generator (not programmable) Tessellation Evaluation Shader (TES) TCS -> Primitive Generator -> TES TCS outputs: Tessellation Level Vertices (can move stuff, like vertex and geometry shaders) Optional, can use glPatchParameterfv to set default values Transformation can be applied in the vertex shader instead Primitive Generation: Normalized Coordinates (Barycentric coordinates) In triangles vs. in quads No awareness of "actual" coordinates! Tessellation levels: In general, these are the number of segments an edge is tessellated into Edge tessellation should match the neighboring patch Triangles: One inner level, three outer levels Can be discareded if level is 0 That allows the TCS to cull patches Picture of how these come together TES outputs: gl_Position Anything else we've defined, like color Calculate this from: gl_TessCoord (vec3, barycentric coordinates) gl_in with patch vertices Demo: Add a tcs and tes to the cube to make it into a sphere using normalize Add shaders glPatchParameteri to set GL_PATCH_VERTICES draw GL_PATCHES The color pickle Using the geometry shader to draw lines instead of triangles We now have only one type of shader remaining! Practice problems: 1. Add a uniform to today's lab to control tessellation level in the TCS, and set up the CPU portion of the program to vary this over time. 2. Use the geometry shader to place the sphere inside a much larger duplicate sphere. Lab today: Adjust the TCS so that a detailed cube made up of little triangles is drawn. Next, scale the locations like this: control_closeness = maximum influence of a single control point, taken from gl_TessCoord Instead of normalizing the lengths of the vectors to each point, scale them by control_closeness instead.