The Graphics Pipeline

Similar documents
Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Computer Graphics Hardware An Overview

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Real-Time Realistic Rendering. Michael Doggett Docent Department of Computer Science Lund university

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

GPGPU Computing. Yong Cao

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

Radeon HD 2900 and Geometry Generation. Michael Doggett

Introduction to GPGPU. Tiziano Diamanti

Graphics Cards and Graphics Processing Units. Ben Johnstone Russ Martin November 15, 2011

GPU Architecture. Michael Doggett ATI

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

Introduction to Computer Graphics

OpenGL Performance Tuning

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

1. INTRODUCTION Graphics 2

Lecture Notes, CEng 477

Introduction GPU Hardware GPU Computing Today GPU Computing Example Outlook Summary. GPU Computing. Numerical Simulation - from Models to Software

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

A Crash Course on Programmable Graphics Hardware

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

3D Computer Games History and Technology

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

L20: GPU Architecture and Models

How To Teach Computer Graphics

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

GRAPHICS CARDS IN RADIO RECONNAISSANCE: THE GPGPU TECHNOLOGY

Overview Motivation and applications Challenges. Dynamic Volume Computation and Visualization on the GPU. GPU feature requests Conclusions

Developer Tools. Tim Purcell NVIDIA

Writing Applications for the GPU Using the RapidMind Development Platform

Radeon GPU Architecture and the Radeon 4800 series. Michael Doggett Graphics Architecture Group June 27, 2008

Lecture 15: Hardware Rendering

Advanced Visual Effects with Direct3D

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Optimizing AAA Games for Mobile Platforms

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

A Short Introduction to Computer Graphics

Advanced Rendering for Engineering & Styling

Introduction to GPU Programming Languages

Image Synthesis. Transparency. computer graphics & visualization

NVIDIA GeForce GTX 580 GPU Datasheet

Procedural Shaders: A Feature Animation Perspective

Computer Graphics. Introduction. Computer graphics. What is computer graphics? Yung-Yu Chuang

INTRODUCTION TO RENDERING TECHNIQUES

Programmable Graphics Hardware

Computer Graphics. Anders Hast

Introduction to Computer Graphics

Game Development in Android Disgruntled Rats LLC. Sean Godinez Brian Morgan Michael Boldischar

Color correction in 3D environments Nicholas Blackhawk

Programming 3D Applications with HTML5 and WebGL

Midgard GPU Architecture. October 2014

Introduction to GPU Architecture

The Future Of Animation Is Games

Performance Optimization and Debug Tools for mobile games with PlayCanvas

Interactive Rendering In The Post-GPU Era. Matt Pharr Graphics Hardware 2006

In the early 1990s, ubiquitous

Dynamic Resolution Rendering

Low power GPUs a view from the industry. Edvard Sørgård

GPU Christmas Tree Rendering. Evan Hart

Instructor. Goals. Image Synthesis Examples. Applications. Computer Graphics. Why Study 3D Computer Graphics?

ATI Radeon 4800 series Graphics. Michael Doggett Graphics Architecture Group Graphics Product Group

Touchstone -A Fresh Approach to Multimedia for the PC

Hardware design for ray tracing

How To Understand The Power Of Unity 3D (Pro) And The Power Behind It (Pro/Pro)

John Carmack Archive -.plan (2002)

Vertex and fragment programs

Console Architecture. By: Peter Hood & Adelia Wong

Volume Rendering on Mobile Devices. Mika Pesonen

Optimization for DirectX9 Graphics. Ashu Rege

QCD as a Video Game?

NVIDIA workstation 3D graphics card upgrade options deliver productivity improvements and superior image quality

Modern Graphics Engine Design. Sim Dietrich NVIDIA Corporation

Introduction to Game Programming. Steven Osman

Introduction to GP-GPUs. Advanced Computer Architectures, Cristina Silvano, Politecnico di Milano 1

Teaching Introductory Computer Graphics Via Ray Tracing

Technical Brief. Quadro FX 5600 SDI and Quadro FX 4600 SDI Graphics to SDI Video Output. April 2008 TB _v01

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Masters of Science in Software & Information Systems

Real-Time Graphics Architecture

Fast and efficient dense variational stereo on GPU

OctaVis: A Simple and Efficient Multi-View Rendering System

Shadows. Shadows. Thanks to: Frédo Durand and Seth Teller MIT. Realism Depth cue

General Purpose Computation on Graphics Processors (GPGPU) Mike Houston, Stanford University

Graphical displays are generally of two types: vector displays and raster displays. Vector displays

Cork Education and Training Board. Programme Module for. 3 Dimensional Computer Graphics. Leading to. Level 5 FETAC

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

CS 4810 Introduction to Computer Graphics

Comp 410/510. Computer Graphics Spring Introduction to Graphics Systems

Interactive Information Visualization using Graphics Hardware Študentská vedecká konferencia 2006

Deferred Shading & Screen Space Effects

GPU Shading and Rendering: Introduction & Graphics Hardware

3D Stereoscopic Game Development. How to Make Your Game Look

Computer Graphics on Mobile Devices VL SS ECTS

Interactive Level-Set Deformation On the GPU

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

Transcription:

Announcements The Graphics Pipeline Homework 3 due 02/27 Project kickoff 02/27 Patrick Cozzi University of Pennsylvania CIS 565 - Spring 2012 Course Contents Agenda Mobile Brief Graphics Review Graphics Pipeline Mapping the Graphics Pipeline to Hardware Parallel Algorithms CUDA Real-Time Rendering OpenGL / WebGL Graphics Pipeline GPU Architecture 1

Graphics Review Graphics Review: Modeling Graphics Modeling Polygons vs. triangles How do we store a triangle mesh? Modeling Rendering Animation Implicit Surfaces Real-Time Rendering Triangles Triangles 2

Implicit Surfaces Graphics Review: Rendering Images from http://http.developer.nvidia.com/gpugems3/gpugems3_ch01.html Image from http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15869-f11/www/lectures/01_intro.pdf Graphics Review: Rendering Rendering Goal: Assign color to pixels Two Parts Visible surfaces What is in front of what for a given view Shading Simulate the interaction of material and light to produce a pixel color Graphics Review: Animation Move the camera and/or agents, and rerender the scene In less than 16.6 ms (60 fps) 3

Graphics Pipeline Walkthrough Images from http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15869-f11/www/lectures/01_intro.pdf Pull together a vertex from one or more buffers Also called primitive processing (GL ES) or input assembler (D3D) Image from http://www.virtualglobebook.com/ OpenGL provides lots of flexibility for pulling vertex attributes from different buffers For example (no indices): OpenGL provides lots of flexibility for pulling vertex attributes from different buffers For example (no indices): positions texture coordinates positions texture coordinates normal, binormal, bitagent... normal, binormal, bitagent... Vertex 0 Vertex 0 4

OpenGL provides lots of flexibility for pulling vertex attributes from different buffers For example (no indices): positions texture coordinates Transform incoming vertex position from model to clip coordinates Perform additional per-vertex computations; modify, add, or remove attributes passed down the pipeline Formerly called the Transform and Lighting (T&L) stage. Why? vertex P model normal, binormal, bitagent... Vertex 1 modified vertex P clip P clip = (M model-view-projection )(P model ) Model to clip coordinates requires three transforms: model to world world to eye eye to clip Use 4x4 matrices passed to the vertex shader as uniforms Model to world: P world = (M model )(P model ) P world = (M model )(P model ) P eye = (M view ) (P world ) P clip = (M projection ) (P eye ) vertex modified vertex uniforms, e.g., matrices, etc. Image from http://msdn.microsoft.com/en-us/library/windows/desktop/bb206365(v=vs.85).aspx 5

World to eye: Eye to clip coordinates: P eye = (M view ) (P world ) P clip = (M projection ) (P eye ) Image from http://www.realtimerendering.com/ Image from http://www.realtimerendering.com/ In practice, the model, view, and projection matrices are commonly burnt into one matrix? Why? Model to clip coordinate transformation is just one use for the vertex shader. Another use: animation. P clip = (M projection )(M view )(M model )(P model ) P clip = (M model-view-projection )(P model ) How would you implement pulsing? Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter06.html 6

How would you implement pulsing? How do we compute the displacement? Displace position along surface normal over time Consider: float displacement = 0.5 * (sin(u_time) + 1.0); What are the shortcomings? How do we compute the displacement? Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter06.html Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter06.html How do we compute the displacement? How do we get the varying bulge? Consider: float displacement = u_scalefactor * 0.5 * (sin(u_frequency * u_time) + 1.0); What are the other shortcomings? Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter06.html Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter06.html 7

How do we get the varying bulge? What varies per-vertex and what does not? Consider float displacement = u_scalefactor * 0.5 * (sin(position.y * u_frequency * u_time) + 1.0); float displacement = u_scalefactor * 0.5 * (sin(position.y * u_frequency * u_time) + 1.0); Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter06.html On all modern GPUs, vertex shaders can read from textures as well as uniform variables. Example: Textures can provide height maps for displacement mapping What is this useful for? vertex uniforms textures modified vertex Images from http://developer.nvidia.com/content/vertex-texture-fetch 8

Technology preview: vertex shaders are becoming available to CSS on the web as CSS shaders RenderMonkey Demos Bounce Demo Morph Particle System http://www.adobe.com/devnet/html5/articles/css-shaders.html More info on CSS shaders: https://dvcs.w3.org/hg/fxtf/raw-file/tip/custom/index.html RenderMonkey: http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. VS VS 9

A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. VS VS A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. VS VS 10

A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. A vertex shader processes one vertex. Primitive assembly groups vertices forming one primitive, e.g., a triangle, line, etc. VS VS Perspective Division and Viewport Transform Clipping There are a series of stages between primitive assembly and rasterization. Perspective division P ndc = (P clip ).xyz / (P clip ).w There are a series of stages between primitive assembly and rasterization. Clipping Viewport transform P window = (M viewport-transform )(P ndc ) Image from http://www.realtimerendering.com/ Image from http://www.realtimerendering.com/ 11

Rasterization Determine what pixels a primitive overlaps Shades the fragment by simulating the interaction of light and material Loosely, the combination of a fragment shader and its uniform inputs is a material Also called a Pixel Shader (D3D) How would you implement this? What about aliasing? fragment fragment s color uniforms textures What happens to non-position vertex attributes during rasterization? What is the triangle-to-fragment ratio? What exactly is the fragment input? What are examples of useful uniforms? Useful textures? Example: Blinn-Phong Lighting Example: Blinn-Phong Lighting float diffuse = max(dot(n, L), 0.0); float specular = max(pow(dot(h, N), u_shininess), 0.0); Why not evaluate per-vertex and interpolate during rasterization? Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter05.html Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter05.html 12

Per-fragment vs. per-vertex lighting Effects of tessellation on per-vertex lighting Which is which? Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter05.html Image from http://http.developer.nvidia.com/cgtutorial/cg_tutorial_chapter05.html Another example: Texture Mapping Lighting and texture mapping Image from http://www.realtimerendering.com/ Image from http://www.virtualglobebook.com/ 13

Another example: Bump mapping Another example: Bump mapping Fragment shaders can be computationally intense A fragment shader can output color, but what else would be useful? Image from http://http.developer.nvidia.com/gpugems3/gpugems3_ch14.html 14

A fragment shader can output color, but what else would be useful? Discard the fragment. Why? Depth. Why? Multiple colors. Why? RenderMonkey Demos NPR Glass RenderMonkey: http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx Scissor Test A fragment must go through a series of tests to make to the framebuffer What tests are useful? Discard a fragment if it is within a rectangle defined in window coordinates Why is this useful? Does this need to happen after fragment shading? Scissor Test Stencil Test Depth Test 15

Scissor Test Stencil Test The scissor test is useful for scissoring out parts of the window that do not need to be shaded For performance. Why? Post-processing effects Multipass rendering The stencil test can discard arbitrary areas of the window, and count per-fragment A stencil is written to the stencil buffer, and later fragments can be tested against this buffer What is this useful for? Scissor Test Scissor Test Stencil Test Stencil Test Depth Test Depth Test Stencil Test Stencil Test Example: Stencil shadow volumes Example: Stencil shadow volumes Scissor Test Scissor Test Stencil Test Stencil Test Depth Test Depth Test Image from http://www.virtualglobebook.com/ Image from http://www.ozone3d.net/tutorials/stencil_shadow_volumes.php 16

Depth Test Depth Test Finds visible surfaces Once called ridiculously expensive Also called the z-test Does it need to be after fragment shading? Scissor Test Stencil Test Depth Test Image from http://www.virtualglobebook.com/ Depth Test ing Combine fragment color with framebuffer color Can weight each color Can use different operations: +, -, etc. Why is this useful? Image from http://www.virtualglobebook.com/ 17

ing Graphics Pipeline Walkthrough Example: Translucency After all that, write to the framebuffer! Additive ing C dest = (C source.rgb)(c source.a) + (C dest.rgb); Alpha ing C dest = (C source.rgb)(c source.a) + (C dest.rgb) (1 - C source.a); Image from http://http.developer.nvidia.com/gpugems/gpugems_ch06.html Images from http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15869-f11/www/lectures/01_intro.pdf Evolution of the Programmable Graphics Pipeline Early 90s Pre GPU Pre GPU Fixed function GPU Programmable GPU Unified Shader Processors Slide from http://s09.idav.ucdavis.edu/talks/01-bps-siggraph09-mhouston.pdf 18

Why GPUs? 3dfx Voodoo (1996) Exploit Parallelism Pipeline parallel Data-parallel CPU and GPU executing in parallel Still Software In hardware: Fixed-function rasterization, texture mapping, depth testing, etc. 4-6 MB memory PCI bus $299 Hardware: texture filtering, rasterization, MAD, sqrt, etc. Hardware Image from http://www.thedodgegarage.com/3dfx/v1.htm Aside: Mario Kart 64 High fragment load / low vertex load Aside: Mario Kart Wii High fragment load / low vertex load? Image from http://www.gamespot.com/users/my_shoe/ Image from http://wii.ign.com/dor/objects/949580/mario-kart-wii/images/ 19

NVIDIA GeForce 256 (1999) NVIDIA GeForce 3 (2001) Hardware In hardware: Fixed-function vertex shading (T&L) Multi-texturing: bump maps, light maps, etc. 10 million polygons per second Direct3D 7 AGP bus Hardware Optionally bypass fixed-function T&L with a programmable vertex shader Optionally bypass fixed-function fragment shading with a programmable fragment shader Many programming limits Direct3D 8 Pentium IV 20 stages GeForce 3 600-800 stages Fixed-function stage Programmable stage Image from http://en.wikipedia.org/wiki/file:visiontek_geforce_256.jpg NVIDIA GeForce 6 (2004) NVIDIA GeForce 6 (2004) textures Hardware Much better programmable fragment shaders Vertex shader can read textures Dynamic branches Multiple render targets PCIe bus OpenGL 2 / Direct3D 9 Vertex shader can read textures Dynamic branches Multiple render targets PCIe bus OpenGL 2 / Direct3D 9 Image from ftp://download.nvidia.com/developer/presentations/2004/gpu_jackpot/shader_model_3.pdf 20

NVIDIA GeForce 6 (2004) Dynamic Branches Vertex shader can read textures Dynamic branches Multiple render targets PCIe bus OpenGL 2 / Direct3D 9 Image from ftp://download.nvidia.com/developer/presentations/2004/gpu_jackpot/shader_model_3.pdf Image from http://developer.amd.com/media/gpu_assets/03_clever_shader_tricks.pdf Dynamic Branches For best performance, fragment shader dynamic branches should be coherent in screen-space How does this relate to warp partitioning in CUDA? NVIDIA GeForce 6 (2004) 6 vertex shader processors 16 fragment shader processors Image from http://http.developer.nvidia.com/gpugems2/gpugems2_chapter30.html 21

NVIDIA GeForce 8 (2006) Geometry Shader Ground-up GPU redesign Geometry Shaders Transform-feedback OpenGL 3 / Direct3D 10 Unified shader processors Support for GPU Compute Geometry Shaders Image from David Blythe : http://download.microsoft.com/download/f/2/d/f2d5ee2c-b7ba-4cd0-9686-b6508b5479a1/direct3d10_web.pdf NVIDIA G80 Architecture Why Unify Shader Processors? Slide from http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf Slide from http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf 22

Why Unify Shader Processors? Terminology Shader Model Direct3D OpenGL Video card 3 9 2.x Example NVIDIA GeForce 6800 ATI Radeon X800 4 10.x 3.x NVIDIA GeForce 8800 ATI Radeon HD 2900 5 11.x 4.x NVIDIA GeForce GTX 480 ATI Radeon HD 5870 Slide from http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf Shader Capabilities Shader Capabilities Table courtesy of A K Peters, Ltd. http://www.realtimerendering.com/ Table courtesy of A K Peters, Ltd. http://www.realtimerendering.com/ 23

Evolution of the Programmable Graphics Pipeline Evolution of the Programmable Graphics Pipeline Slide from Mike Houston: http://s09.idav.ucdavis.edu/talks/01-bps-siggraph09-mhouston.pdf Slide from Mike Houston: http://s09.idav.ucdavis.edu/talks/01-bps-siggraph09-mhouston.pdf 24