Tesselation Shaders. Tesselation  dictionary definition of tesselate is the forming of a mosaic.

Slides:



Advertisements
Similar presentations
Week 4 Lecture 1: OpenGL 3.x & 4.x. 2 Objectives Changes in OpenGL 3.x 4.x Changes in GLSL 1.3/4/5 4.x.
Advertisements

COMPUTER GRAPHICS SOFTWARE.
D3D11 Tessellation Sarah Tariq NVIDIA
OpenGL: Simple Use Open a window and attach OpenGL to it Set projection parameters (e.g., field of view) Setup lighting, if any Main rendering loop –Set.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
Chapter 2: Graphics Programming
CMPE 466 COMPUTER GRAPHICS
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Results / Compared to Relief Mapping It does not scale linearly with screen coverage as does the other techniques. However, for larger displacements, it.
Dual Marching Cubes: An Overview
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
1 Computer Graphics Chapter 7 3D Object Modeling.
Damon Rocco.  Tessellation: The filling of a plane with polygons such that there is no overlap or gap.  In computer graphics objects are rendered as.
2003 by Jim X. Chen: Introduction to Modeling Jim X. Chen George Mason University.
Shading Languages By Markus Kummerer. Markus Kummerer 2 / 19 State of the Art Shading.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Curves and Surfaces (cont’) Amy Zhang. Conversion between Representations  Example: Convert a curve from a cubic B-spline curve to the Bézier form:
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications
1 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
Subdivision Schemes Basic idea: Start with something coarse, and refine it into smaller pieces for rendering –We have seen how subdivision may be used.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Maths & Technologies for Games DirectX 11 – New Features Tessellation & Displacement Mapping CO3303 Week 19.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
Artistic Surface Rendering Using Layout Of Text Tatiana Surazhsky Gershon Elber Technion, Israel Institute of Technology.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Geometry Shader (GLSL)
1 Subdivision. 2 Subdivision for game Why? Large model require many memory for storage Need to dynamically tessellated during game play Make surface modeling.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 4: Color and Attributes Isaac Gang University.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 21.
DPL3/10/2016 CS 551/651: Simplification Continued David Luebke
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Tessellation Shaders.
Bezier Triangles and Multi-Sided Patches
Graphics Processing Unit
Introduction to OpenGL
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Introduction to Computer Graphics with WebGL
Chapters VIII Image Texturing
Introduction to Computer Graphics with WebGL
Programming with OpenGL Part 4: Color and Attributes
Day 05 Shader Basics.
Chapter VI OpenGL ES and Shader
Graphics Processing Unit
Lecture 13 Clipping & Scan Conversion
Chapter XVIII Surface Tessellation
Programming with OpenGL Part 4: Color and Attributes
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Introduction to OpenGL
OpenGL-Rendering Pipeline
Presentation transcript:

Tesselation Shaders

Tesselation  dictionary definition of tesselate is the forming of a mosaic

Tesselation  in computer graphics tesselation refers to the subdivision of a surface (not necessarily made up of polygons) into smaller polygons  there should be no seams between polygons  there should be no overlap of the polygons  typically used to convert a coarse model to a model with fine detail

Tesselation coarse modelsmooth tesselated model tesselated model + displacement mapping

Tesselation  the effects of tesselation are often most apparent around the silhouette of objects

Tesselation Shaders TCS TES TPG

Tesselation Shaders patch quads (which are converted to triangles) isolinestriangles

Patch  when a tesselation shader is active the only primitive that can be used is a patch  the GL_PATCHES type is what you would use in your OpenGL program; e.g., glBegin(GL_PATCHES); glVertex... glVertex... // and so on glEnd();  the patch is just a chunk of geometry (vertices) that is defined by the programmer

Tesselation Primitive Generator  patches are never directly rendered  tesselation primitive generator (TPG) generates the primitives that are eventually passed down the remainder of the pipeline  TPG is a fixed function stage that runs once per patch  but configurable to produce primitives based on a set of standard tesselation algorithms  TCS sets up the TPG and instructs the TPG how many primitives to generate  TES determines the vertex positions of the primitives generated by the TPG  TPG generates primitives with vertices defined in a parametric space (u, v, w) where 0 ≤ u, v, w ≤ 1

Tesselation Control Shader  TCS runs for each vertex in a patch  can compute additional information about the patch and vertices and pass them to the TES  tells TPG how many primitives to produce OpenGL 4 Shading Language Cookbook

Tesselation Evaluation Shader  TES specifies which algorithm the TPG uses  seemingly strange because the TES runs after the TPG; the GLSL compiler resolves this inconsistency  runs once per output vertex generated by the TPG  TES uses the parametric coordinates provided by the TPG and the patch vertices to determine the final positions of the output primitive vertices OpenGL 4 Shading Language Cookbook

Outer and Inner Division Levels  TCS tells the TPG how many primitive to produce by specifying the outer and inner division levels via a pair of output arrays patch out float gl_TessLevelOuter[4] patch out float gl_TessLevelInner[2] quadtriangleisoline gl_TessLevelOuter[0] gl_TessLevelOuter[1] gl_TessLevelOuter[2]  gl_TessLevelOuter[3]  gl_TessLevelInner[0]  gl_TessLevelInner[1] 

Outer and Inner Division Levels  quad tesselation  first subdivide the original rectangle into a regular mesh of rectangles where the number of subdivisions is given by the inner tesselation level gl_TessLevelInner[0] = 5 gl_TessLevelInner[1] = 4 u v

Outer and Inner Division Levels  quad tesselation  all rectangles except those adjacent to one of the outer rectangle edges are decomposed into triangle pairs  spec says “ algorithm used to subdivide the rectangular domain in (u, v) space into individual triangles is implementation- dependent”

Outer and Inner Division Levels  quad tesselation  outermost rectangle edges are subdivided independently gl_TessLevelOuter[0] = 1 gl_TessLevelOuter[1] = 2 gl_TessLevelOuter[2] = 4 gl_TessLevelOuter[3] = 5

Outer and Inner Division Levels  quad tesselation  area between inner rectangles and outer edges are filled by triangles produced by joining the vertices on the subdivided outer edges to the vertices on the edge of the inner mesh

Outer and Inner Division Levels  triangle tesselation  first temporarily subdivide each edge of an equilateral triangle using the inner tesselation level n gl_TessLevelInner[0] = 4

Outer and Inner Division Levels  triangle tesselation  generate a nested inner triangle with edges subdivided in n-2 segments

Outer and Inner Division Levels  triangle tesselation  continue generating nested inner triangles until a triangle with edge subdivision equal to 0 or 1 is reached

Outer and Inner Division Levels  triangle tesselation  continue generating nested inner triangles until a triangle with edge subdivision equal to 0 or 1 is reached gl_TessLevelInner[0] = 5

Outer and Inner Division Levels  triangle tesselation  the temporary subdivision of the outer triangle is discarded and the first, second, and third outer tesselation levels are used gl_TessLevelInner[0] = 8 gl_TessLevelInner[1] = 2 gl_TessLevelInner[2] = 4

Outer and Inner Division Levels  isoline tesselation  n parallel line segments each subdivided into m segments are created where m and n are the first two outer tesselation levels u v u v gl_TessLevelInner[0] = 3 gl_TessLevelInner[1] = 1 gl_TessLevelInner[0] = 6 gl_TessLevelInner[1] = 4

Bezier Curve Example  see textbook p

Bezier Curve Example  use the tesselation shader to subdivide the curve into line segments that can be rendered  possible to control the number of vertices based on curvature, screen area, etc.

Bezier Curve Example

 tesselation control shader #version 400 #extension GL_ARB_tessellation_shader: enable uniform float uOuter1; layout(vertices = 4) out; // number of vertices in output patch void main() { gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; gl_TessLevelOuter[0] = 1.; gl_TessLevelOuter[1] = uOuter1; } runs once for each input patch vertex output patch vertex position = input patch vertex position index of the vertex being processed by this invocation of the shader

Bezier Curve Example  tesselation evaluation shader #version 400 #extension GL_ARB_tessellation_shader: enable layout(isolines, equal_spacing) in; void main() { vec4 p0 = gl_in[0].gl_Position; vec4 p1 = gl_in[1].gl_Position; vec4 p2 = gl_in[2].gl_Position; vec4 p3 = gl_in[3].gl_Position; assign incoming vertex positions to separate variables for readability number of vertices in the input patch is stored in gl_PatchVerticesIn runs once for each output patch vertex generated by the TPG

Bezier Curve Example  tesselation evaluation shader (cont) float u = gl_TessCoord.x; float b0 = (1. – u) * (1. – u) * (1. – u); float b1 = 3. * u * (1. – u) * (1. – u); float b2 = 3. * u * u * (1. – u); float b3 = u * u * u; gl_Position = b0 * p0 + b1 * p1 + b2 * p2 + b3 * p3; } 3-component floating-point vector holding the (u, v, w) coordinate of the vertex being processed by the TES