The University of North Carolina - Chapel Hill COMP 790-058 Spring 2007 1 GPGP - Background Lecture Graphics Pipelines, OpenGL, Fragment Programs, First.

Slides:



Advertisements
Similar presentations
Point-based Graphics for Estimated Surfaces
Advertisements

COMPUTER GRAPHICS SOFTWARE.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
CS-378: Game Technology Lecture #9: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
A Crash Course on Programmable Graphics Hardware Li-Yi Wei 2005 at Tsinghua University, Beijing.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction to Computer Graphics Ed Angel Professor of Computer Science, Electrical and.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Geometric Objects and Transformations. Coordinate systems rial.html.
GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
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.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel and Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Introduction to Computer Graphics Ed Angel Professor Emeritus of Computer.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 CS4610/7610: Introduction to Computer Graphics.
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
1 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
CS 4363/6353 OPENGL BACKGROUND. WHY IS THIS CLASS SO HARD TO TEACH? (I’LL STOP WHINING SOON) Hardware (GPUs) double in processing power ever 6 months!
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
09/25/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Shadows Stage 2 outline.
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.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS The GPU.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Introduction to Computer Graphics Dr Usman Saeed Assistant Professor Faculty of Computing.
What is Computer Graphics?
Week 2 - Friday CS361.
Programmable Pipelines
A Crash Course on Programmable Graphics Hardware
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Graphics Processing Unit
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Lecture 13 Clipping & Scan Conversion
Introduction to Computer Graphics
Models and Architectures
Models and Architectures
Debugging Tools Tim Purcell NVIDIA.
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
OpenGL Background CS 4722.
OpenGL-Rendering Pipeline
Presentation transcript:

The University of North Carolina - Chapel Hill COMP Spring GPGP - Background Lecture Graphics Pipelines, OpenGL, Fragment Programs, First GPGP Programs

The University of North Carolina - Chapel Hill COMP Spring Purpose Give sufficient background to non- graphics students to program a simple GPGP program –Attempted to minimize any assumptions prior knowledge of Graphics

The University of North Carolina - Chapel Hill COMP Spring My Background in GPGP 06/ Worked with Bill Baxter on paint work using GPU to transform volume representation of paint to RGB 01/ Worked with Brandon Lloyd on shadow work –Didn’t touch GPU work, but understood what it did 09/ Taught COMP136 and we talked about GPU 10/ Wrote a simple program to remove radial distortion from images in real time 01/ Prepared for this lecture

The University of North Carolina - Chapel Hill COMP Spring Overview Raster Graphics –Where did this start? Graphics Pipeline –What’s the hardware like? OpenGL –How to talk to the hardware? GPU Programming –How to make it do something non-standard? A First GPGP Program –Hello World!

The University of North Carolina - Chapel Hill COMP Spring Raster Graphics -- “Utah” Rendering 1960s-1970s The University of Utah led raster graphics research –Ivan Sutherland How do we convert mathematical representations of objects into images on the screen? –Conversion of continuous to discrete –Solution of light-surface-eye interactions

The University of North Carolina - Chapel Hill COMP Spring Object Representations MANY continuous representations exist for objects –Planar polygons, quadrics, splines, M- Reps, general equations … Discrete representations are sparser –Generally some interpretation of an array of numbers

The University of North Carolina - Chapel Hill COMP Spring The Winner! In modern raster graphics, the triangle is king –It is the simplest continuous representation that can approximate all other surface-types –All other continuous representations must be triangulated before being rasterized Unless GPGP is used!

The University of North Carolina - Chapel Hill COMP Spring Rasterization Terms Tessellate - convert some other continuous representation to planar polygons Triangulate - converting some other continuous representation to triangles Vertex - a point in some nD space Rasterize - convert a triangle* to fragments Fragment - a potential pixel**

The University of North Carolina - Chapel Hill COMP Spring “Utah” Graphics Pipeline Obtain triangulation of model Affine Transforms Projective Transforms Clip to viewable region Rasterize

The University of North Carolina - Chapel Hill COMP Spring Raster Graphics –Where did this start? Graphics Pipeline –What’s the hardware like? OpenGL –How to talk to the hardware? GPU Programming –How to make it do something non-standard? A First GPGP Program –Hello World! Overview

The University of North Carolina - Chapel Hill COMP Spring Why Specialty Hardware? CPU can do all Turing complete operations

The University of North Carolina - Chapel Hill COMP Spring Earliest Commodity Hardware Vertex Transformation Clipping Rasterization Fragment Operations Visibility State of pipeline initialized Vertices come down the pipe Framebuffer and depth buffer set by the end

The University of North Carolina - Chapel Hill COMP Spring Cutting-edge Commodity Hardware Okay, not much changed Orange denotes programmability Power of standard set of settings increased Output can go to any/many buffers Vertex Transformation Clipping Rasterization Fragment Operations Visibility

The University of North Carolina - Chapel Hill COMP Spring Overview Raster Graphics –Where did this start? Graphics Pipeline –What’s the hardware like? OpenGL –How to talk to the hardware? GPU Programming –How to make it do something non-standard? A First GPGP Program –Hello World!

The University of North Carolina - Chapel Hill COMP Spring Talking to the GPU Two parts: –STATE: The majority of OpenGL calls modify the state machine –INPUT: Vertices Three vertices make a triangle Once a triangle is complete, the GPU runs with it

The University of North Carolina - Chapel Hill COMP Spring OpenGL Overview Most of the features in OpenGL will probably never be used in this class For the majority of GPGP work, you render a quad (two triangles) that fills the screen on a one-input- texture-to-one-output-pixel basis

The University of North Carolina - Chapel Hill COMP Spring Note on OpenGL Although OpenGL calls are supported by nVIDIA or ATi drivers, some windowing system must be used –Native to OS - a pain –GLUT - quick, easy, small, has some issues with the “nicities of coding” –Almost all windowing toolkits support OpenGL FLTK, Qt, WxWindows, etc.

The University of North Carolina - Chapel Hill COMP Spring Let’s go to the code All code is available at asses/GPGPLecture asses/GPGPLecture

The University of North Carolina - Chapel Hill COMP Spring OpenGL Gnitty-Gritties Three more important OpenGL features –Multi-pass rendering –Read-backs –Extensions

The University of North Carolina - Chapel Hill COMP Spring Overview Raster Graphics –Where did this start? Graphics Pipeline –What’s the hardware like? OpenGL –How to talk to the hardware? GPU Programming –How to make it do something non-standard? A First GPGP Program –Hello World!

The University of North Carolina - Chapel Hill COMP Spring History of Commodity GPU Programming Pre Basic rasterizers –Some texture combination ability –Vertex transformation occurs on CPU Slightly configurable –Cube maps, signed math ops –Vertex transforms added to GPU Vertex programmability 2002-present - Vertex/fragment programmability

The University of North Carolina - Chapel Hill COMP Spring History of GPU non- Commodity Programmability mid-1990’s - UNC PixelFlow later-1990’s - Stanford RTSL

The University of North Carolina - Chapel Hill COMP Spring GPU Programming Languages Assembly language Cg and HLSL GLSL

The University of North Carolina - Chapel Hill COMP Spring Types of GPU Programs Vertex Programs –Required Outputs: Vertex position and Vertex color –Optional Outputs: Hardware/language dependant maximum number of output values Fragment Programs –Required Outputs: RGBA color –Optional Outputs: Writing to multiple sources

The University of North Carolina - Chapel Hill COMP Spring Communicating with GPU Programs There are two ways of sending information to GPU Programs: –Explicitly setting parameters using specified function calls –Sending down standard values by setting OpenGL state

The University of North Carolina - Chapel Hill COMP Spring For More Info Tutorials, sample code, etc. –Go to Cg Tutorial –Amazon: Tutorial-Definitive-Programmable-Real- Time/dp/ http:// Tutorial-Definitive-Programmable-Real- Time/dp/ GLSL (Orange Book) –Amazon: Shading-Language- 2nd/dp/ /sr=1- 1/qid= /ref=pd_bbs_1/ ?ie=UTF8&s=bookshttp:// Shading-Language- 2nd/dp/ /sr=1- 1/qid= /ref=pd_bbs_1/ ?ie=UTF8&s=books

The University of North Carolina - Chapel Hill COMP Spring Overview Raster Graphics –Where did this start? Graphics Pipeline –What’s the hardware like? OpenGL –How to talk to the hardware? GPU Programming –How to make it do something non-standard? A First GPGP Program –Hello World!

The University of North Carolina - Chapel Hill COMP Spring Let’s go to the code Borrowed heavily from gpgpu.org/developer All code is available at asses/GPGPLecture asses/GPGPLecture

The University of North Carolina - Chapel Hill COMP Spring Notes No Vertex program! … no use for one. The framebuffer-to-texture transfers we were doing are slow Use the framebuffer object class available from GPGPU.org/developer GLEW is downloadable from glew.sourceforge.net/ We only passed one parameter down in this example

The University of North Carolina - Chapel Hill COMP Spring Reading the Data Back to the CPU See function SnapShot at the bottom of the last file

The University of North Carolina - Chapel Hill COMP Spring Debugging IMDebug by Bill Baxter: – mdebug/index.html

The University of North Carolina - Chapel Hill COMP Spring Questions?