CS148: Introduction to Computer Graphics and Imaging Programmable Graphics Pipelines. Topics

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

Vertex and fragment programs

GPGPU Computing. Yong Cao

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

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

Computer Graphics Hardware An Overview

Introduction to GPGPU. Tiziano Diamanti

CS418 GLSL Shader Programming Tutorial (I) Shader Introduction. Presented by : Wei-Wen Feng 3/12/2008

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

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

Introduction to Computer Graphics with WebGL

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

OpenGL Performance Tuning

L20: GPU Architecture and Models

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

Introduction to GPU Architecture

GPU Architecture. Michael Doggett ATI

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

Radeon HD 2900 and Geometry Generation. Michael Doggett

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

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

A Crash Course on Programmable Graphics Hardware

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

Introduction to Computer Graphics

QCD as a Video Game?

A.R.I.S.E. Architectural Real-time Interactive Showing Environment. Supervisor: Scott Chase

Programmable Graphics Hardware

Computer Graphics on Mobile Devices VL SS ECTS

Introduction to GPU Programming Languages

The Future Of Animation Is Games

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

OpenGL Shading Language Course. Chapter 5 Appendix. By Jacobo Rodriguez Villar jacobo.rodriguez@typhoonlabs.com

Developer Tools. Tim Purcell NVIDIA

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

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

Midgard GPU Architecture. October 2014

Data Parallel Computing on Graphics Hardware. Ian Buck Stanford University

3D graphic acceleration history and architecture

GPU Architecture. An OpenCL Programmer s Introduction. Lee Howes November 3, 2010

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

Parallel Web Programming

Performance Optimization and Debug Tools for mobile games with PlayCanvas

Optimizing AAA Games for Mobile Platforms

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

An Introduction to Modern GPU Architecture Ashu Rege Director of Developer Technology

Ray Tracing on Graphics Hardware

Graphics and Computing GPUs

A Survey of General-Purpose Computation on Graphics Hardware

Introduction to Computer Graphics

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

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

INTRODUCTION TO RENDERING TECHNIQUES

GPGPU: General-Purpose Computation on GPUs

Accelerating Intensity Layer Based Pencil Filter Algorithm using CUDA

Deconstructing Hardware Usage for General Purpose Computation on GPUs

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

GPU Shading and Rendering: Introduction & Graphics Hardware

Computer Graphics. Anders Hast

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

In the early 1990s, ubiquitous

The OpenGL R Graphics System: A Specification (Version 3.3 (Core Profile) - March 11, 2010)

Interactive Computer Graphics

GPU Christmas Tree Rendering. Evan Hart

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Lecture 15: Hardware Rendering

How To Teach Computer Graphics

GPU Parallel Computing Architecture and CUDA Programming Model

NVIDIA Corporation 2701 San Tomas Expressway Santa Clara, CA

3D Augmented Reality Mobile Application Prototype for Visual Planning Support

GPU Architectures. A CPU Perspective. Data Parallelism: What is it, and how to exploit it? Workload characteristics

LBM BASED FLOW SIMULATION USING GPU COMPUTING PROCESSOR

Lecture 11: Multi-Core and GPU. Multithreading. Integration of multiple processor cores on a single chip.

Real-Time Graphics Architecture

Lecture Notes, CEng 477

CUDA. Multicore machines

Aston University. School of Engineering & Applied Science

AMD GPU Architecture. OpenCL Tutorial, PPAM Dominik Behr September 13th, 2009

NVFX : A NEW SCENE AND MATERIAL EFFECT FRAMEWORK FOR OPENGL AND DIRECTX. TRISTAN LORACH Senior Devtech Engineer SIGGRAPH 2013

GPU architecture II: Scheduling the graphics pipeline

Efficient, High-Quality Bayer Demosaic Filtering on GPUs

Procedural Shaders: A Feature Animation Perspective

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

1. INTRODUCTION Graphics 2

Console Architecture. By: Peter Hood & Adelia Wong

Touchstone -A Fresh Approach to Multimedia for the PC

3D Graphics and Cameras

Hardware design for ray tracing

NVIDIA GeForce GTX 580 GPU Datasheet

Faster Rendering of Human Skin

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

3D Computer Games History and Technology

How To Use An Amd Graphics Card In Greece And (Amd) With Greege (Greege) With An Amd Greeper 2.2.

Vulkan on NVIDIA GPUs. Piers Daniell, Driver Software Engineer, OpenGL and Vulkan

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

Interactive visualization of multi-dimensional data in R using OpenGL

Web Based 3D Visualization for COMSOL Multiphysics

Fast cone-beam CT image reconstruction using GPU hardware

Writing Applications for the GPU Using the RapidMind Development Platform

The Design of the OpenGL Graphics Interface

Nicolas P. Rougier PyConFr Conference 2014 Lyon, October 24 25

Transcription:

CS148: Introduction to Computer Graphics and Imaging Programmable Graphics Pipelines Topics The fixed-function graphics pipeline Programmable stages Vertex shaders Fragment shaders GL shading language (GLSL) Mapping other applications to GPUs

A Trip Down The Graphics Pipeline J. Blinn A Trip Down the Graphics Pipeline Command Vertex Assembly Rasterization Fragment Texture FB ops Display

Command Processor Command queue Command interpretation Unpack and perform format conversion Maintain graphics state Vertex (per-vertex) Vertex transformation Normal transformation Texture coordinate generation Texture coordinate transformation Lighting (light sources and surface reflection) Object-space triangles Screen-space shaded triangles

Primitive Assembly Combine transformed/shaded vertices into primitives 1 vert -> point 2 verts -> line 3 verts -> triangle Clipping Perspective projection Transform to window coordinates (viewport) Determine orientation (CW/CCW) Back-face cull Rasterization Setup (per-triangle) Sampling (triangle = {fragments}) Interpolation (interpolate colors and coordinates) Triangles Fragments

Texture Textures are arrays indexed by floats (Sampler) Texture address calculation Texture bilinear interpolation and filtering Fragments Texture Fragments Fragment Combine texture sampler outputs Per-fragment shading Fragments Textured Fragments

Framebuffer Operations Operation Test window ownership Test scissor and stencil mask Test alpha Test depth Blending or compositing Textured Fragments Framebuffer Pixels Display Gamma correction Analog to digital conversion Display Framebuffer Pixels Light

Programable Stages Programmable Graphics Pipeline Command Vertex Assembly Rasterization Fragment Texture FB ops Display Programmable stage

Programmable Graphics Pipeline Command Vertex Texture Assembly Rasterization Fragment Texture FB ops Display Programmable stage Programmable Graphics Pipeline Command Vertex Assembly Transform Lighting Texture Rasterization Fragment Texture FB ops Display Programmable stage

Programmable Graphics Pipeline Command Vertex Assembly Rasterization Fragment FB ops Transform Lighting Texture Texture Inputs Vertex Program Outputs Display Programmable stage Program Architecture Inputs Registers Program Texture Constant Outputs

What s in a GPU? NVIDIA GeForce GTX 480 What s in a GPU? Core Core Core Core Tex Tex Primitive Assembly Rasterizer Framebuffer Ops Core Core Tex Work Distributor Core Core Tex

GLSL OpenGL Shading Language Simple Vertex and Fragment s // simple.vert void main() { gl_position = gl_modelviewmatrix * gl_projectionmatrix * gl_vertex; gl_normal = gl_normalmatrix * gl_normal; gl_frontcolor = gl_color; gl_backcolor = gl_color; } // simple.frag void main() { gl_fragcolor = gl_color; }

Uniform Variables uniform variables are changed at most once per geometric primitive // Predefined OpenGL state uniform mat4 gl_modelviewmatrix; uniform mat4 gl_projectionmatrix; uniform mat4 gl_normalmatrix; // User-defined uniform float time; Attribute Variables attribute variables are properties of a vertex They are the inputs of the vertex shader attribute vec4 gl_color; attribute vec4 gl_normal; attribute vec4 gl_vertex; N. B. that points, vectors, normals and colors are all vec4

Varying Variables attribute variables are the vertex shader inputs The outputs of the vertex shader are varying attribute vec4 gl_color; varying vec4 gl_frontcolor; varying vec4 gl_backcolor; // vert shader void main() {! gl_frontcolor = gl_color; } Varying Variables varying variables are interpolated across the triangle gl_color is set to gl_frontcolor or gl_backcolor depending on whether the triangle is frontfacing or back-facing varying vec4 gl_color; vec4 gl_fragcolor; void main() {! gl_fragcolor = gl_color; }

Vectors Constructors vec3 V3 = vec3(1.0, 2.0, 3.0); vec4 V4 = vec4(v3, 4.0); Swizzling vec2 V2 = V4.xy; vec4 V4Reverse = V4.wzyx; vec4 res = V4.xyzw + V4.xxxx; Basic Vector Operators float res = dot(v4, V4Reverse); vec3 res = cross(v3, vec3(1.0,0.0,0.0)); Textures uniform sampler2d SomeTexture; void main() { vec4 SomeTextureColor = texture2d(sometexture, vec2(0.5, 0.5)); } N. B. Textures coordinates are from (0, 0) to (1, 1)

The OpenGL Pipeline in GLSL - Vertex Built-in attributes GLSL OpenGL! vec4 gl_vertex glvertex*()! vec4 gl_color!! glcolor*()! vec4 gl_secondarycolor glsecondarycolor*()! vec4 gl_normal glnormal()! vec4 gl_multitexcoord0 glmultitexcoord() OpenGL in GLSL - Fragment Built-in varying vec4 gl_position!! vec4 gl_frontcolor, gl_backcolor vec4 gl_frontsecondarycolor, gl_backsecondarycolor vec4 gl_texcoord[n] vec4 gl_fragcoord Outputs vec4 gl_fragcolor! vec4 gl_fragdepth

Communicating with GLSL Can extend uniform state! uniform float x;! addr = GetUniformLocation( program, x ):! gluniform1f( addr, value ); Can extend attribute (inside glbegin/glend)! uniform float y;! addr = GetAttributeLocation(program, y );! glvertexattribute1f( addr, value ); Limitations Memory No access to neighboring fragments Limited stack space, instruction count Cannot read and write framebuffer Performance Branching support is limited and slow Graphics card will timeout if code takes too long Variable support across different graphics cards

GPU Computing How to Get a TeraFLOP 16 cores x 32 SIMD functional units x 2 flops/cycle x 1 GHz = 1 TFLOP

Why GPU Computing? 1500 1125 >20x 750 >14x 375 0 Peak GFLOPS GFLOPS/W (x100) Intel Core i7 975 NVIDIA GeForce GTX 285 Computation on GPU s Beyond basic graphics Collision detection Fluid and cloth Ray tracing Beyond graphics Protein folding Speech recognition Fourier transforms Check out CUDA and OpenCL