GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind.

Slides:



Advertisements
Similar presentations
GPGPU Programming Dominik G ö ddeke. 2Overview Choices in GPGPU programming Illustrated CPU vs. GPU step by step example GPU kernels in detail.
Advertisements

COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
Lecture 38: Chapter 7: Multiprocessors Today’s topic –Vector processors –GPUs –An example 1.
Graphics Pipeline.
Shading CMSC 435/634. RenderMan Light Displacement Surface Volume Imager.
Control Flow Virtualization for General-Purpose Computation on Graphics Hardware Ghulam Lashari Ondrej Lhotak University of Waterloo.
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408, University of Illinois, Urbana-Champaign 1 Programming Massively Parallel Processors Chapter.
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Hardware-Based Nonlinear Filtering and Segmentation using High-Level Shading Languages I. Viola, A. Kanitsar, M. E. Gröller Institute of Computer Graphics.
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.
Vertex & Pixel Shaders CPS124 – Computer Graphics Ferdinand Schober.
GPU Tutorial 이윤진 Computer Game 2007 가을 2007 년 11 월 다섯째 주, 12 월 첫째 주.
Graphics Processors CMSC 411. GPU graphics processing model Texture / Buffer Texture / Buffer Vertex Geometry Fragment CPU Displayed Pixels Displayed.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Real-time Graphical Shader Programming with Cg (HLSL)
Geometric Objects and Transformations. Coordinate systems rial.html.
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.
A Crash Course in HLSL Matt Christian.
Cg Programming Mapping Computational Concepts to GPUs.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
Shading CMSC 435/634. RenderMan Light Displacement Surface Volume Imager.
1 Dr. Scott Schaefer Programmable Shaders. 2/30 Graphics Cards Performance Nvidia Geforce 6800 GTX 1  6.4 billion pixels/sec Nvidia Geforce 7900 GTX.
Real-Time High Quality Rendering CSE 291 [Winter 2015], Lecture 4 Brief Intro to Programmable Shaders
Shading CMSC 435/634.
The programmable pipeline Lecture 3.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
GPU Shading and Rendering: OpenGL Shading Language Marc Olano UMBC.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS418 Computer Graphics John C. Hart
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.
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408, University of Illinois, Urbana-Champaign 1 Programming Massively Parallel Processors Lecture.
From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University.
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.
OpenGL Shading Language
Efficient Partitioning of Fragment Shaders for Multiple-Output Hardware Tim Foley Mike Houston Pat Hanrahan Computer Graphics Lab Stanford University.
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.
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 CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
Programmable Pipelines
Graphics Processing Unit
Chapter 6 GPU, Shaders, and Shading Languages
From Turing Machine to Global Illumination
The Graphics Rendering Pipeline
Shading CMSC 435/634.
Introduction to Computer Graphics with WebGL
UMBC Graphics for Games
UMBC Graphics for Games
Graphics Processing Unit
Programming with OpenGL Part 3: Shaders
Ray Tracing on Programmable Graphics Hardware
RADEON™ 9700 Architecture and 3D Performance
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
CIS 6930: Chip Multiprocessor: GPU Architecture and Programming
Presentation transcript:

GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind (:50–McCool) 11:20 OpenGL Shading Language (:50–Olano) 1:45 Cg / NVIDIA (:50–Kilgard) 2:35HLSL / ATI (:50–Scheuermann) GPUs in Production Rendering 3:45 GPU Production Animation (:45–Wexler) 4:30 Interactive Cinematic Shading. Where are we? (:45–Pellacini) Wrap Up 5:15Discussion and Q&A (:15–All)

GPU Shading and Rendering: Introduction Marc Olano UMBC

Americas Army GPU GPU: Graphics Processing Unit –Designed for real-time graphics –Present in almost every PC –Increasing realism and complexity

GPU computation Texture / Buffer Texture / Buffer Vertex Geometry Fragment CPU Displayed Pixels Displayed Pixels

Low-level code !!ARBvp1.0 # Transform the normal to view space TEMP Nv,Np; DP3 Nv.x,state.matrix.modelview.invtrans.row[0],vertex.normal; DP3 Nv.y,state.matrix.modelview.invtrans.row[1],vertex.normal; DP3 Nv.z,state.matrix.modelview.invtrans.row[2],vertex.normal; MAD Np,Nv,{.9,.9,.9,0},{0,0,0,1}; # screen position from vertex TEMP Vp; DP4 Vp.x, state.matrix.mvp.row[0], vertex.position; DP4 Vp.y, state.matrix.mvp.row[1], vertex.position; DP4 Vp.z, state.matrix.mvp.row[2], vertex.position; DP4 Vp.w, state.matrix.mvp.row[3], vertex.position; […] # interpolate MAD Np, Np, -vertex.color.x, Np; MAD result.position, Vp, vertex.color.x, Np; END

High-level code void main() { vec4 Kin = gl_Color; // key input // screen position from vertex, texture and normal vec4 Vp = ftransform(); vec4 Tp = vec4(gl_MultiTexCoord0.xy*1.8-.9, 0,1); vec4 Np = vec4(nn*.9,1); // interpolate between Vp, Tp and Np gl_Position = Vp; gl_Position = mix(Tp,gl_Position,pow(1.-Kin.x,8.)); gl_Position = mix(Np,gl_Position,pow(1.-Kin.y,8.)); // copy to output gl_TexCoord[0] = gl_MultiTexCoord0; gl_TexCoord[1] = Vp; gl_TexCoord[3] = Kin; }

Non-real time vs. Real time Not real-time –Developed from General CPU code –Seconds to hours per frame –1000s of lines –“Unlimited” computation, texture, memory, … Real-time –Developed from fixed- function hardware –Tens of frames per second –1000s of instructions –Limited computation, texture, memory, …

Non-real time vs. Real-time Non-real timeReal-time Texture/ Buffer Texture/ Buffer Vertex Geometry Fragment Application Displayed Pixels Displayed Pixels Light Displayed Pixels Displayed Pixels Application Displacement Surface Volume Atmosphere Imager

History (not real-time) Testbed [Whitted and Weimer 1981] Shade Trees [Cook 1984] Image Synthesizer [Perlin 1985] RenderMan [Hanrahan and Lawson 1990] Multi-pass RenderMan [Peercy et al. 2000] GPU acceleration [Wexler et al. 2005]

History (real-time) Custom HW [Olano and Lastra 1998] Multi-pass standard HW [Peercy et al. 2000] Register combiners [NVIDIA 2000] Vertex programs [Lindholm et al. 2001] Compiling to mixed HW [Proudfoot et al. 2001] Fragment programs Standardized languages Geometry shaders [Blythe 2006]

Choices OS: Windows, Mac, Linux API: DirectX, OpenGL Language: HLSL, GLSL, Cg, … Compiler: DirectX, OpenGL, Cg, ASHLI Runtime: CgFX, ASHLI, OSG (& others), sample code

Major Commonalities Vertex & Fragment/Pixel C-like, if/while/for Structs & arrays Float + small vector and matrix –Swizzle & mask (a.xyz = b.xxw) Common math & shading functions

PipelinePipeline Texture / Buffer Texture / Buffer Vertex Geometry Fragment GPU Parallelism

PipelinePipeline SPMD Parallel Fragment Stream Texture / Buffer Texture / Buffer Vertex Geometry Fragment GPU Parallelism

SPMD Parallel Fragment Stream Fragment SIMD Parallel 2x2 Block

Fragment GPU Parallelism Shader Unit Shader Unit Shader Unit Shader Unit Branch Unit Branch Unit Fog Texture Unit Texture Unit L1 Cache L2 Cache Pipeline(NVIDIA)Pipeline(NVIDIA) SIMD Parallel 2x2 Block

GPU Parallelism Shader Unit Shader Unit Shader Unit Shader Unit Branch Unit Branch Unit Fog Texture Unit Texture Unit L1 Cache L2 Cache Pipeline(NVIDIA) Vector Parallel Limited MIMD ALUALUALUALU ALUALUALUALU

Managing GPU Programming Simplified computational model –Bonus: consistent as hardware changes All stages SIMD –Explicit 4-element SIMD vectors Fixed conversion / remapping between each stage Buffer Vertex (stream) Geometry (stream) Fragment (array)

Vertex One element in / one out NO communication Can select fragment address Buffer Vertex (stream) Geometry (stream) Fragment (array)

Geometry More next (Blythe talk) One element in / 0 to ~100 out –Limited by hardware buffer sizes Like vertex: –NO communication –Can select fragment address Buffer Vertex (stream) Geometry (stream) Fragment (array)

Fragment Biggest computational resource One element in / 0 – 1 out Cannot change destination address –I am element x,y in an array, what is my value? Effectively no communication Conditionals expensive –Better if block coherence Buffer Vertex (stream) Geometry (stream) Fragment (array)

Program / Multiple Passes Communication –None in one pass –Arbitrary read addresses between passes Data layout –No persistent per- processor memory –No penalty to change Buffer Vertex (stream) Geometry (stream) Fragment (array)

Multiple passes GPGPU Non-local effects –Shadow maps –Texture space Precomputation –Fix some degrees of freedom –Factor into functions of 1-3D –Project input or output into another space

GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind (:50–McCool) 11:20 OpenGL Shading Language (:50–Olano) 1:45 Cg / NVIDIA (:50–Kilgard) 2:35HLSL / ATI (:50–Scheuermann) GPUs in Production Rendering 3:45 GPU Production Animation (:45–Wexler) 4:30 Interactive Cinematic Shading. Where are we? (:45–Pellacini) Wrap Up 5:15Discussion and Q&A (:15–All)