Geometry Shader (GLSL)

Slides:



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

Write a program step by step. Step 1: Problem definition. Given the coordinate of two points in 2-D space, compute and print their straight distance.
GLSL Basics Discussion Lecture for CS 418 Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Informationsteknologi Wednesday, December 12, 2007Computer Graphics - Class 171 Today’s class OpenGL Shading Language.
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.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 4 : GLSL Shaders Topics: Shader programs, vertex & fragment shaders, passing data into.
Introduction to Geometry Shaders Patrick Cozzi Analytical Graphics, Inc.
GLSL I May 28, 2007 (Adapted from Ed Angel’s lecture slides)
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Introduction to Geometry Shaders Patrick Cozzi Analytical Graphics, Inc.
The programmable pipeline Lecture 10 Slide Courtesy to Dr. Suresh Venkatasubramanian.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
OpenGL and WebGL Drawing Functions CSCI 440 Day Five.
GEOMETRY SHADER. Breakdown  Basics  Review – graphics pipeline and shaders  What can the geometry shader do?  Working with the geometry shader  GLSL.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Geometry Shaders. Visualizing Normal Vectors  textbook calls this a “hedgehog plot” but (I think) that this is a misuse of the term  a hedgehog plot.
Real-time Graphical Shader Programming with Cg (HLSL)
Geometric Objects and Transformations. Coordinate systems rial.html.
A Crash Course in HLSL Matt Christian.
Real-Time High Quality Rendering CSE 291 [Winter 2015], Lecture 4 Brief Intro to Programmable Shaders
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
GAM532 DPS932 – Week 2 Vertex Shaders. The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Accelerated Stereoscopic Rendering using GPU François de Sorbier - Université Paris-Est France February 2008 WSCG'2008.
OpenGL Shader Language Vertex and Fragment Shading Programs.
OpenGL Shading Language (GLSL)
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
OpenGL Shading Language (GLSL)
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
Fateme Hajikarami Spring  What is GPGPU ? ◦ General-Purpose computing on a Graphics Processing Unit ◦ Using graphic hardware for non-graphic computations.
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
Ray Tracing using Programmable Graphics Hardware
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.
OpenGL Shading Language
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 4: Color and Attributes Isaac Gang University.
OpenGL Shading Language (GLSL)
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.
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.
Graphics Programming. Graphics Functions We can think of the graphics system as a black box whose inputs are function calls from an application program;
Tessellation Shaders.
Shader.
Introduction to OpenGL
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Real-time Computer Graphics Overview
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Programming with OpenGL Part 4: Color and Attributes
Day 05 Shader Basics.
Introduction to Computer Graphics with WebGL
Chapter VI OpenGL ES and Shader
Graphics Processing Unit
Computer Graphics Practical Lesson 10
Programming with OpenGL Part 3: Shaders
Hw03 : shader.
Programming with OpenGL Part 4: Color and Attributes
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Introduction to OpenGL
CS 480/680 Computer Graphics GLSL Overview.
OpenGL-Rendering Pipeline
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

Geometry Shader (GLSL) Add/remove primitives Add/remove vertices Edit vertex position Spring 2010

Overview Spring 2010

Pipeline Vertex Shader uniform attribute varying Fragment Shader rasterizer Buffer Op… (x’,y’,z’) (x,y,z) Vertex Shader uniform attribute varying in Fragment Shader rasterizer varying out (x,y,z) Geometry Spring 2010

Pipeline Spring 2010

Input/Output Spring 2010

Setting Input Type Spring 2010

New (input) Adjacency Primitives Spring 2010

New (input) Adjacency Primitives Spring 2010

Setting Output Type Spring 2010

Setting Max Output Vertices Since you may not emit an unbounded number of points from a geometry shader, you are required to let OpenGL know the maximum number of points any instance of the shader will emit. Set this parameter after creating the program, but before linking: Query functions Spring 2010

Varying … Spring 2010

Built-In Variables Spring 2010

Remarks It is an error to attach a geometry shader to a program without attaching a vertex shader. It is an error to use a geometry shader without specifying GL_GEOMETRY_VERTICES_OUT_EXT. The shader will not compile correctly without the #version and #extension pragmas. In general, you must specify the type of the primitives input and output to and from the geometry shader. These need not necessarily be the same type. By default, this is set to GL_TRIANGLES. Forgetting to set this parameter may result in a black screen. Spring 2010

Details When the Geometry Shader calls EmitVertex( ), this set of variables is copied to a slot in the shader’s Primitive Assembly step When the Geometry Shader calls EndPrimitive( ), the vertices that have been saved in the Primitive Assembly step are then assembled, rasterized, etc Notes there is no “BeginPrimitive( )” routine. It is implied by (1) the start of the Geometry Shader, or (2) returning from the EndPrimitive( ) call. there is no need to call EndPrimitive( ) at the end of the Geometry Shader – it is implied. Spring 2010

Spring 2010

Sample Codes Spring 2010

Passthrough Spring 2010

Line+Line Spring 2010

Bezier Curve Spring 2010

Bezier Curve Spring 2010

Shrinking Triangles Spring 2010

Shrinking Triangles Spring 2010

Silhouette Spring 2010

Input: gl_triangle_adjacency Output: gl_line_strip Spring 2010

Spring 2010

More Applications Spring 2010

Hedgehog Plots Spring 2010

Hedgehog Plots Spring 2010

Explosion Spring 2010

Subdivision Surface Spring 2010

References http://web.engr.oregonstate.edu/~mjb/cs519/Handouts/geometry_shader.pdf Spring 2010