Programmable GPUs Outline

Size: px
Start display at page:

Download "Programmable GPUs Outline"

Transcription

1 papi 1 Outline References Programmable Units Languages Programmable GPUs Outline papi 1 OpenGL Shading Language papi 1 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 1

2 papi 2 OpenGL OpenGL Shading Language References papi 2 John Kessenich, The OpenGL Shading Language, OpenGL Language Version 1.20, Document Revision 8, September OpenGL Commands for Shader Language Control Mark Segal, Kurt Akeley, The OpenGL Graphics System: A Specification (Version 2.1), OpenGL, July papi 2 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 2

3 papi 3 Programmable Units papi 3 Programmable Unit: Part of the pipeline that can be programmed (as defined by some API). Choice of what is and isn t programmable constrained by: Need to allow for parallel (multithreaded, SIMD, MIMD) execution. Simple memory access. OpenGL Programmable Units Vertex Processor: Transform vertex and texture coordinates, compute lighting. Geometry Processor: Using a transformed primitive and its neighbors generates new primitives. For example, replace one triangle with many triangles to more closely match a curved surface. (Not in OpenGL 2.1, defined in extensions.) Fragment Processor: Using interpolated coordinates, read filtered texels and combine with colors. papi 3 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 3

4 papi 4 Languages papi 4 Shader: A programmable part of a GPU. Name is now misleading but is still in common use. Shader Language: An language for programming shaders. Shader Assembly Language: An assembly-like language for programming GPUs. High-Level Shader Language: A high-level language for programming GPUs. papi 4 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 4

5 papi 5 Shader Assembly Language Shader Assembly Language papi 5 At one time, only way to program. Unlike a true assembly language no instruction encoding defined no promise of a one-to-one correspondence with machine instructions. Translated into machine instructions (or micro-instructions) by API implementation. Many APIs not picky about matching assembly language to target. Currently might be used for tuning code from high-level shader language. Separate languages defined for vertex, geometry, and fragment processors. Early languages closely match underlying hardware, so more useful for performance tuning. Defined as OpenGL extensions. papi 5 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 5

6 papi 6 Shader Assembly Languages papi 6 First-Generation Languages NV vertex program (For vertex processor) Close match to GEForce 3 hardware. No branches or memory (texture or otherwise) access. NV fragment program (2003) (For fragment processor) Arbitrary texel access. (Can ignore or modify provided texture coords.) Instructions for texture access and interpolation. No branching. papi 6 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 6

7 papi 7 Shader Assembly Languages papi 7 Second-Generation Languages NV vertex program2, NV vertex program3. NV fragment program2, Later Languages Full support for integer operations, branching. NV gpu program4: Instructions common to each kind of shader. NV vertex program4. NV geometry program4. NV fragment program4. papi 7 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 7

8 papi 8 High-Level Shader Languages papi 8 High-Level Shader Languages OpenGL Shader Language OpenGL standard. Syntax very similar to C. Language designed for vertex and fragment shaders. Current version is 1.3. Cg Originated with ATI, adopted in Direct3D. Syntax very similar to C. Language designed for stream programs geometry, vertex, and fragment programs can be in stream form. papi 8 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 8

9 papi 9 OpenGL Shader Language (OGSL) papi 9 OpenGL Shader Language Important Features C-like CPP-like preprocessor directives. Library of useful functions. papi 9 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 9

10 papi 10 Data Types OGSL Data Types papi 10 OpenGL Shading Language 1.30 Section 4.1 Scalar types: bool, int, float Vectors of bool, int, float. Element access: xyzw, rgba, stpq. E.g., var.xy, var.r Matrices of float. Structures papi 10 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 10

11 papi 11 Integer Signed and unsigned. Thirty-two bits. OGSL Data Types papi 11 Earlier versions had lower precision and lacked bitwise operations.) papi 11 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 11

12 papi 12 Float IEEE 754 Single Format OGSL Data Types papi 12 Calculations may be to less than IEEE 754 precision. papi 12 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 12

13 papi 13 Example OGSL Data Types papi 13 vec4 vertex_e = gl_modelviewmatrix * o_point; vec3 norm_e = gl_normalmatrix * gl_normal; vec4 light_pos = gl_lightsource[1].position; float phase_light = dot(norm_e, normalize(light_pos - vertex_e).xyz); float phase_user = dot(norm_e, -vertex_e.xyz); float phase = sign(phase_light) == sign(phase_user)? abs(phase_light) : 0.0; papi 13 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 13

14 papi 14 Variable Types OGSL Data Types papi 14 Uniforms: Read-only by shader. Changed by client, change is time consuming. Implemented as shader constants. Attributes: Read-only by vertex shader, not available to fragment shader. Changed by client, change is fast. Varying: Written by vertex shader, interpolated for fragment shader where read-only. Sampler: Read-only by vertex and fragment shader. Value is a filtered texel. papi 14 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 14

15 papi 15 Storage Qualifiers const attribute Read only. OGSL Data Types papi 15 Not allowed in fragment shaders. uniform Read only. varying Written by vertex shader. Interpolated for fragment shader. Read only for fragment shaders. papi 15 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 15

16 papi 16 papi 16 Storage Qualifier Example uniform vec3 gravity_force; uniform float gs_constant; uniform vec2 ball_size; attribute float step_last_time; attribute vec4 position_left, position_right, position_above, position_below; attribute vec3 ball_speed; varying vec4 out_position; varying vec3 out_velocity; papi 16 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 16

17 papi 17 Function Parameters OGSL Functions papi 17 OpenGL Shading Language 1.30 Section 4.4 Call by value. Parameter Qualifiers: in (default) out inout papi 17 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 17

18 papi 18 Built In Variables OGSL Functions papi 18 OpenGL Shading Language 1.30 Section 7 Pre-defined uniform, attribute, and varying variables. papi 18 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 18

19 papi 19 Built In Functions OGSL Functions papi 19 See OpenGL Shading Language 1.30 Section 8 papi 19 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 19

20 papi 20 Code Use Overview OGSL Use papi 20 Suppose something (tube) needs special lighting. Shader language code in light.cc. All steps below done by code using OpenGL. Initialize step: Load, compile, and link light.cc. During render, when ready for tube: Install light.cc. As needed, write uniform values. At this point all vertices handled by light.cc. When done with tube install another shader or switch to fixed func. papi 20 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 20

21 papi 21 See OpenGL 2.1 Section 2.15 Initialize Program OGSL Use papi 21 Create Shader Object sobject = glcreateshader(gl VERTEX SHADER) Provide Source Code to Shader Object glshadersource(sobject,1,&shader text lines,null); Compile Shader Object glcompileshader(sobject); Attach and Link glattachshader(pobject,sobject); gllinkprogram(pobject); Use gluseprogram(pobject); papi 21 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 21

22 papi 22 OGSL Use papi 22 Obtaining and Using Variable References At run time variables identified by number. At Initialization get location (index) of attributes and uniforms: vsal pinnacle = glgetattriblocation(pobject,name); sun ball size = glgetuniformlocation(pobject,name); During Render (Infrequently) Change Uniform Value (Using location) gluniform2f(sun ball size,ball size,ball size sq); During Render (Per Vertex Okay) Change Attribute Value (Using location) glvertexattrib4f(vsal pinnacle,pinnacle.x,pinnacle.y,pinnacle.z,radius); Done before each glvertex. Same options as vertex, such as client and buffer object arrays. papi 22 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 22

23 papi 23 Vertex Shader Examples OGSL Vertex Shader Examples papi 23 Minor variation on lighting. Compute geometry of bump and circle. Physics papi 23 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 23

24 papi 24 OGSL Vertex Shader Example papi 24 Example: Variation on Lighting Program: cube4.cc (gpu acceleration off) Shader Code: cube4 vshader.cc::vs main lighting() Why: Tweak lighting. Notes: Shader computes transformation, lighting, and texture coordinates. Program switches between vs main lighting and fixed func. papi 24 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 24

25 papi 25 OGSL Vertex Shader Example papi 25 Example: Compute Geometry Program: cube4.cc (gpu acceleration on) Why: Less work for CPU. Shader Code: cube4 vshader.cc::vs main circle() and vs main bump() Notes: Not a geometry shader. Program switches between vs main circle, vs main bump and fixed func. papi 25 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 25

26 papi 26 Example: Physics Program: cube5.cc OGSL Vertex Shader Example papi 26 What: Shader time-steps lattice of masses. Why: Less work for CPU. papi 26 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 26

27 papi 27 Sample Program cube4.cc Displays a rotating cube. Sample Program cube4.cc papi 27 Cube faces have textures: syllabus, pic of EE building, etc. Ball bouncing around cube. Low-speed impact: color circle. High-speed impact: bump. Vertex Shader Uses Lighting tweak. Circle painting. Bump painting. papi 27 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 27

28 papi 28 Data Representations Cube: Sample Program cube4.cc papi 28 Admittedly messy part of code. Cube position: transformation matrix in pcube. Textures: pcube Face Info (6-element array). History of ball contact: pcontact List (6-element array). Ball: position, speed, size. papi 28 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 28

29 papi 29 Physics Sample Program cube4.cc papi 29 At each time step move cube to new position move ball to new position. To move cube: update rotation matrix using time and spin rate. To move ball: Find next intercept of ball trajectory with cube face. If intercept after end of time step, done. Record intercept position and ball velocity. Recompute ball trajectory and repeat. papi 29 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 29

30 papi 30 Graphics Sample Program cube4.cc papi 30 Trivial Case: no translucency and ball doesn t leave marks: Render cube faces and ball. Middle Case: no translucency but ball does leave marks: Stencil holes at collision points. Render face using stencil to leave hole positions unchanged. Render bumps. Render ball. Code as Written: translucency and ball leaves marks: Sort faces so that face never under one already rendered. Render bumps before face if bump behind face. papi 30 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 30

31 papi 31 Code Organization Sample Program cube4.cc papi 31 Initialization: Set idle callback. Idle Callback: Wait for beginning of display refresh (or 30ms) request redisplay. Redisplay: Advance physics (time step), then render frame. papi 31 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 31

32 papi 32 Use of Vertex Shaders Sample Program cube4.cc papi 32 Lighting (vs lighting). Used for cube faces (except marks). Circle (vs circle). Used for stenciling and drawing circles. Bump (vs bump). Used for drawing bump. papi 32 EE Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api. papi 32

OpenGL Programmable Shaders

OpenGL Programmable Shaders h gpup 1 Topics Rendering Pipeline Shader Types OpenGL Programmable Shaders sh gpup 1 OpenGL Shader Language Basics h gpup 1 EE 4702-X Lecture Transparency. Formatted 9:03, 20 October 2014 from shaders2.

More information

OpenGL Rendering Pipeline and Programmable Shaders

OpenGL Rendering Pipeline and Programmable Shaders h gpup Topics OpenGL Rendering Pipeline and Programmable s sh gpup Rendering Pipeline Types OpenGL Language Basics h gpup EE 4702- Lecture Transparency. Formatted 8:06, 7 December 205 rom rendering-pipeline.

More information

OpenGL Rendering Pipeline and Programmable Shaders

OpenGL Rendering Pipeline and Programmable Shaders h gpup Topics OpenGL Rendering Pipeline and Programmable s sh gpup Rendering Pipeline Types OpenGL Language Basics h gpup EE 4702- Lecture Transparency. Formatted 8:59, 29 September 206 rom rendering-pipeline.

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Updates! for 24h lab access:

More information

Information Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C

Information Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Straight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things

More information

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011 Shader Programs Lecture 30 Subsections 2.8.2, 2.8.3 Robb T. Koether Hampden-Sydney College Wed, Nov 16, 2011 Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, 2011 1 / 43 Outline 1

More information

Supplement to Lecture 22

Supplement to Lecture 22 Supplement to Lecture 22 Programmable GPUs Programmable Pipelines Introduce programmable pipelines - Vertex shaders - Fragment shaders Introduce shading languages - Needed to describe shaders - RenderMan

More information

Grafica Computazionale: Lezione 30. Grafica Computazionale. Hiding complexity... ;) Introduction to OpenGL. lezione30 Introduction to OpenGL

Grafica Computazionale: Lezione 30. Grafica Computazionale. Hiding complexity... ;) Introduction to OpenGL. lezione30 Introduction to OpenGL Grafica Computazionale: Lezione 30 Grafica Computazionale lezione30 Introduction to OpenGL Informatica e Automazione, "Roma Tre" May 20, 2010 OpenGL Shading Language Introduction to OpenGL OpenGL (Open

More information

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 Objectives Simple Shaders - Vertex shader - Fragment shaders Programming shaders with

More information

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1 Programmable GPUs Real Time Graphics Virtua Fighter 1995 (SEGA Corporation) NV1 Dead or Alive 3 2001 (Tecmo Corporation) Xbox (NV2A) Nalu 2004 (NVIDIA Corporation) GeForce 6 Human Head 2006 (NVIDIA Corporation)

More information

Programmable Graphics Hardware

Programmable Graphics Hardware Programmable Graphics Hardware Outline 2/ 49 A brief Introduction into Programmable Graphics Hardware Hardware Graphics Pipeline Shading Languages Tools GPGPU Resources Hardware Graphics Pipeline 3/ 49

More information

Programmable Graphics Hardware

Programmable Graphics Hardware CSCI 480 Computer Graphics Lecture 14 Programmable Graphics Hardware [Ch. 9] March 2, 2011 Jernej Barbic University of Southern California OpenGL Extensions Shading Languages Vertex Program Fragment Program

More information

12.2 Programmable Graphics Hardware

12.2 Programmable Graphics Hardware Fall 2018 CSCI 420: Computer Graphics 12.2 Programmable Graphics Hardware Kyle Morgenroth http://cs420.hao-li.com 1 Introduction Recent major advance in real time graphics is the programmable pipeline:

More information

The Application Stage. The Game Loop, Resource Management and Renderer Design

The Application Stage. The Game Loop, Resource Management and Renderer Design 1 The Application Stage The Game Loop, Resource Management and Renderer Design Application Stage Responsibilities 2 Set up the rendering pipeline Resource Management 3D meshes Textures etc. Prepare data

More information

Shaders. Slide credit to Prof. Zwicker

Shaders. Slide credit to Prof. Zwicker Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

More information

Introduction to Shaders.

Introduction to Shaders. Introduction to Shaders Marco Benvegnù hiforce@gmx.it www.benve.org Summer 2005 Overview Rendering pipeline Shaders concepts Shading Languages Shading Tools Effects showcase Setup of a Shader in OpenGL

More information

The Transition from RenderMan to the OpenGL Shading Language (GLSL)

The Transition from RenderMan to the OpenGL Shading Language (GLSL) 1 The Transition from RenderMan to the OpenGL Shading Language (GLSL) Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International

More information

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico 0 Objectives Shader Basics Simple Shaders Vertex shader Fragment shaders 1 Vertex

More information

Lecture 13: OpenGL Shading Language (GLSL)

Lecture 13: OpenGL Shading Language (GLSL) Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 18, 2018 1/56 Motivation } Last week, we discussed the many of the new tricks in Graphics require low-level access to the Graphics

More information

Spring 2009 Prof. Hyesoon Kim

Spring 2009 Prof. Hyesoon Kim Spring 2009 Prof. Hyesoon Kim Application Geometry Rasterizer CPU Each stage cane be also pipelined The slowest of the pipeline stage determines the rendering speed. Frames per second (fps) Executes on

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences

More information

Lecture 2. Shaders, GLSL and GPGPU

Lecture 2. Shaders, GLSL and GPGPU Lecture 2 Shaders, GLSL and GPGPU Is it interesting to do GPU computing with graphics APIs today? Lecture overview Why care about shaders for computing? Shaders for graphics GLSL Computing with shaders

More information

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics Why GPU? Chapter 1 Graphics Hardware Graphics Processing Unit (GPU) is a Subsidiary hardware With massively multi-threaded many-core Dedicated to 2D and 3D graphics Special purpose low functionality, high

More information

Programming shaders & GPUs Christian Miller CS Fall 2011

Programming shaders & GPUs Christian Miller CS Fall 2011 Programming shaders & GPUs Christian Miller CS 354 - Fall 2011 Fixed-function vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable

More information

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1 X. GPU Programming 320491: Advanced Graphics - Chapter X 1 X.1 GPU Architecture 320491: Advanced Graphics - Chapter X 2 GPU Graphics Processing Unit Parallelized SIMD Architecture 112 processing cores

More information

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1 Markus Hadwiger, KAUST Reading Assignment #2 (until Feb. 17) Read (required): GLSL book, chapter 4 (The OpenGL Programmable

More information

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Objectives Shader Programming Basics Simple Shaders Vertex shader Fragment shaders

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name GPU Programming EE 4702-1 Final Examination Tuesday, 5 December 2017 12:30 14:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Exam Total (15 pts) (20 pts) (30 pts) (35 pts) (100 pts) Good Luck!

More information

Could you make the XNA functions yourself?

Could you make the XNA functions yourself? 1 Could you make the XNA functions yourself? For the second and especially the third assignment, you need to globally understand what s going on inside the graphics hardware. You will write shaders, which

More information

Spring 2011 Prof. Hyesoon Kim

Spring 2011 Prof. Hyesoon Kim Spring 2011 Prof. Hyesoon Kim Application Geometry Rasterizer CPU Each stage cane be also pipelined The slowest of the pipeline stage determines the rendering speed. Frames per second (fps) Executes on

More information

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI Tutorial on GPU Programming #2 Joong-Youn Lee Supercomputing Center, KISTI Contents Graphics Pipeline Vertex Programming Fragment Programming Introduction to Cg Language Graphics Pipeline The process to

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Lecture Overview! Review

More information

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL Today Rendering - III CS148, Summer 2010 Graphics Pipeline and Programmable Shaders Artist Workflow Siddhartha Chaudhuri 1 2 Outline Texturing: The 10,000m View Intro to textures The fixed-function graphics

More information

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp Next-Generation Graphics on Larrabee Tim Foley Intel Corp Motivation The killer app for GPGPU is graphics We ve seen Abstract models for parallel programming How those models map efficiently to Larrabee

More information

SHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming

SHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming SHADER PROGRAMMING Based on Jian Huang s lecture on Shader Programming What OpenGL 15 years ago could do http://www.neilturner.me.uk/shots/opengl-big.jpg What OpenGL can do now What s Changed? 15 years

More information

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer Real-Time Rendering (Echtzeitgraphik) Michael Wimmer wimmer@cg.tuwien.ac.at Walking down the graphics pipeline Application Geometry Rasterizer What for? Understanding the rendering pipeline is the key

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing

More information

Why modern versions of OpenGL should be used Some useful API commands and extensions

Why modern versions of OpenGL should be used Some useful API commands and extensions Michał Radziszewski Why modern versions of OpenGL should be used Some useful API commands and extensions Timer Query EXT Direct State Access (DSA) Geometry Programs Position in pipeline Rendering wireframe

More information

Some advantages come from the limited environment! No classes. Stranight ans simple code. Remarkably. Avoids most of the bad things with C/C++.

Some advantages come from the limited environment! No classes. Stranight ans simple code. Remarkably. Avoids most of the bad things with C/C++. GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Stranight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things

More information

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline Introduction to Shaders for Visualization Mike Bailey The Basic Computer Graphics Pipeline Model Transform View Transform Per-vertex Lighting Projection Transform Homogeneous Division Viewport Transform

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Programmable Shaders //per vertex inputs from main attribute aposition; attribute anormal; //outputs to frag. program varying

More information

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský Real - Time Rendering Graphics pipeline Michal Červeňanský Juraj Starinský Overview History of Graphics HW Rendering pipeline Shaders Debugging 2 History of Graphics HW First generation Second generation

More information

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation Lecture 5 Vertex and Fragment Shaders-1 CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives The rendering pipeline and the shaders Data

More information

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1 Markus Hadwiger, KAUST Reading Assignment #4 (until Feb. 23) Read (required): Programming Massively Parallel Processors book, Chapter

More information

Lecture 09: Shaders (Part 1)

Lecture 09: Shaders (Part 1) Lecture 09: Shaders (Part 1) CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA November 9, 2010 OpenGL Rendering Pipeline OpenGL Rendering Pipeline (Pseudo-Code) 1 f o r gl_vertex

More information

Shaders CSCI 4229/5229 Computer Graphics Fall 2017

Shaders CSCI 4229/5229 Computer Graphics Fall 2017 Shaders CSCI 4229/5229 Computer Graphics Fall 2017 What is a Shader? A shader is a computer program that runs on the GPU to calculate the properties of vertexes, pixels and other graphical processing Examples:

More information

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014 Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014 What is a Shader? Wikipedia: A shader is a computer program used in 3D computer graphics to determine the final surface properties of an object

More information

GPU Memory Model. Adapted from:

GPU Memory Model. Adapted from: GPU Memory Model Adapted from: Aaron Lefohn University of California, Davis With updates from slides by Suresh Venkatasubramanian, University of Pennsylvania Updates performed by Gary J. Katz, University

More information

Shading Languages. Ari Silvennoinen Apri 12, 2004

Shading Languages. Ari Silvennoinen Apri 12, 2004 Shading Languages Ari Silvennoinen Apri 12, 2004 Introduction The recent trend in graphics hardware has been to replace fixed functionality in vertex and fragment processing with programmability [1], [2],

More information

EE 4702 GPU Programming

EE 4702 GPU Programming fr 1 Final Exam Review When / Where EE 4702 GPU Programming fr 1 Tuesday, 4 December 2018, 12:30-14:30 (12:30 PM - 2:30 PM) CST Room 226 Tureaud Hall (Here) Conditions Closed Book, Closed Notes Bring one

More information

Real-Time Graphics Architecture

Real-Time Graphics Architecture Real-Time Graphics Architecture Kurt Akeley Pat Hanrahan http://www.graphics.stanford.edu/courses/cs448a-01-fall Geometry Outline Vertex and primitive operations System examples emphasis on clipping Primitive

More information

Graphics Processing Unit Architecture (GPU Arch)

Graphics Processing Unit Architecture (GPU Arch) Graphics Processing Unit Architecture (GPU Arch) With a focus on NVIDIA GeForce 6800 GPU 1 What is a GPU From Wikipedia : A specialized processor efficient at manipulating and displaying computer graphics

More information

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures Shader Programming 1 Examples Daniel Wesslén, dwn@hig.se Per-pixel lighting Texture convolution filtering Post-processing, animated procedural textures Vertex displacement mapping Daniel Wesslén 1 Fragment

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name GPU Programming EE 4702-1 Final Examination Monday, 5 December 2016 17:30 19:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Exam Total (20 pts) (20 pts) (15 pts) (20 pts) (25 pts)

More information

Sung-Eui Yoon ( 윤성의 )

Sung-Eui Yoon ( 윤성의 ) Introduction to Computer Graphics and OpenGL Graphics Hardware Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/etri_cg/ Class Objectives Understand how GPUs have been evolved Understand

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name Solution GPU Programming EE 4702-1 Final Examination Friday, 11 December 2015 15:00 17:00 CST Alias Methane? Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (15 pts)

More information

Shading Language Update

Shading Language Update 3 Shading Language Update Bill Licea-Kane Copyright Khronos Group, 2007 - Page 1 About this talk - Caveat BOFor Contributions to arb-glsl workgroup - NOT final, subject to (minor?) changes Not exhaustive

More information

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Abbott, Connor (cwa2112) Pan, Wendy (wp2213) Qinami, Klint (kq2129) Vaccaro, Jason (jhv2111) [System

More information

The GPGPU Programming Model

The GPGPU Programming Model The Programming Model Institute for Data Analysis and Visualization University of California, Davis Overview Data-parallel programming basics The GPU as a data-parallel computer Hello World Example Programming

More information

GPGPU. Peter Laurens 1st-year PhD Student, NSC

GPGPU. Peter Laurens 1st-year PhD Student, NSC GPGPU Peter Laurens 1st-year PhD Student, NSC Presentation Overview 1. What is it? 2. What can it do for me? 3. How can I get it to do that? 4. What s the catch? 5. What s the future? What is it? Introducing

More information

Graphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1

Graphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1 Graphics Hardware Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/26/07 1 From last time Texture coordinates Uses of texture maps reflectance and other surface parameters lighting

More information

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

Computer Graphics Coursework 1

Computer Graphics Coursework 1 Computer Graphics Coursework 1 Deadline Deadline: 4pm, 24/10/2016 4pm 23/10/2015 Outline The aim of the coursework is to modify the vertex and fragment shaders in the provided OpenGL framework to implement

More information

Shader Programming. Daniel Wesslén, Stefan Seipel, Examples

Shader Programming. Daniel Wesslén, Stefan Seipel, Examples Shader Programming Daniel Wesslén, dwn@hig.se Stefan Seipel, ssl@hig.se Examples 1 Per-pixel lighting Texture convolution filtering 2 Post-processing, animated procedural textures Vertex displacement mapping

More information

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer

More information

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Level: Intermediate Area: Graphics Programming Summary This document is an introduction to the series of samples,

More information

2.11 Particle Systems

2.11 Particle Systems 2.11 Particle Systems 320491: Advanced Graphics - Chapter 2 152 Particle Systems Lagrangian method not mesh-based set of particles to model time-dependent phenomena such as snow fire smoke 320491: Advanced

More information

GeForce4. John Montrym Henry Moreton

GeForce4. John Montrym Henry Moreton GeForce4 John Montrym Henry Moreton 1 Architectural Drivers Programmability Parallelism Memory bandwidth 2 Recent History: GeForce 1&2 First integrated geometry engine & 4 pixels/clk Fixed-function transform,

More information

Programming Graphics Hardware

Programming Graphics Hardware Programming Graphics Hardware Computer Graphics, VT 2013 Lecture 10 Johan Nysjö Centre for Image analysis Swedish University of Agricultural Sciences Uppsala University Recap: The fixed-function OpenGL

More information

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL Preview CS770/870 Spring 2017 Open GL Shader Language GLSL Review traditional graphics pipeline CPU/GPU mixed pipeline issues Shaders GLSL graphics pipeline Based on material from Angel and Shreiner, Interactive

More information

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL CS770/870 Spring 2017 Open GL Shader Language GLSL Based on material from Angel and Shreiner, Interactive Computer Graphics, 6 th Edition, Addison-Wesley, 2011 Bailey and Cunningham, Graphics Shaders 2

More information

Mali Demos: Behind the Pixels. Stacy Smith

Mali Demos: Behind the Pixels. Stacy Smith Mali Demos: Behind the Pixels Stacy Smith Mali Graphics: Behind the demos Mali Demo Team: Doug Day Stacy Smith (Me) Sylwester Bala Roberto Lopez Mendez PHOTOGRAPH UNAVAILABLE These days I spend more time

More information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program Comp 410/510 Computer Graphics Spring 2017 Programming with OpenGL Part 2: First Program Objectives Refine the first program Introduce a standard program structure - Initialization Program Structure Most

More information

Ciril Bohak. - INTRODUCTION TO WEBGL

Ciril Bohak. - INTRODUCTION TO WEBGL 2016 Ciril Bohak ciril.bohak@fri.uni-lj.si - INTRODUCTION TO WEBGL What is WebGL? WebGL (Web Graphics Library) is an implementation of OpenGL interface for cmmunication with graphical hardware, intended

More information

CS 4620 Program 3: Pipeline

CS 4620 Program 3: Pipeline CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.

More information

Dave Shreiner, ARM March 2009

Dave Shreiner, ARM March 2009 4 th Annual Dave Shreiner, ARM March 2009 Copyright Khronos Group, 2009 - Page 1 Motivation - What s OpenGL ES, and what can it do for me? Overview - Lingo decoder - Overview of the OpenGL ES Pipeline

More information

GPU Programming EE Final Examination

GPU Programming EE Final Examination Name GPU Programming EE 4702-1 Final Examination Friday, 11 December 2015 15:00 17:00 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (15 pts) (15 pts) (20 pts)

More information

Cg 2.0. Mark Kilgard

Cg 2.0. Mark Kilgard Cg 2.0 Mark Kilgard What is Cg? Cg is a GPU shading language C/C++ like language Write vertex-, geometry-, and fragmentprocessing kernels that execute on massively parallel GPUs Productivity through a

More information

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel, EDAF80 Introduction to Computer Graphics Seminar 3 Shaders Michael Doggett 2017 Slides by Carl Johan Gribel, 2010-13 Today OpenGL Shader Language (GLSL) Shading theory Assignment 3: (you guessed it) writing

More information

Lecture 9(B): GPUs & GPGPU

Lecture 9(B): GPUs & GPGPU Lecture 9(B): GPUs & GPGPU John-Philip Taylor 26 March 2015 Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) Outline OpenGL Primitives and Vertices Vertex Shader Rasteriser Fragment Shader OpenCL

More information

GPU Memory Model Overview

GPU Memory Model Overview GPU Memory Model Overview John Owens University of California, Davis Department of Electrical and Computer Engineering Institute for Data Analysis and Visualization SciDAC Institute for Ultrascale Visualization

More information

PowerVR Hardware. Architecture Overview for Developers

PowerVR Hardware. Architecture Overview for Developers Public Imagination Technologies PowerVR Hardware Public. This publication contains proprietary information which is subject to change without notice and is supplied 'as is' without warranty of any kind.

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 2 Part 2 Introduction to Shaders Matt Burlick - Drexel University - CS 432 1 Shaders To understand shaders, let s look at the graphics pipeline again The job

More information

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University Graphics Programming Computer Graphics, VT 2016 Lecture 2, Chapter 2 Fredrik Nysjö Centre for Image analysis Uppsala University Graphics programming Typically deals with How to define a 3D scene with a

More information

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 2 due tomorrow at 2pm Grading window

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Chapter 1 Introduction

Chapter 1 Introduction Graphics & Visualization Chapter 1 Introduction Graphics & Visualization: Principles & Algorithms Brief History Milestones in the history of computer graphics: 2 Brief History (2) CPU Vs GPU 3 Applications

More information

OPENGL AND GLSL. Computer Graphics

OPENGL AND GLSL. Computer Graphics OPENGL AND GLSL Computer Graphics 1 OUTLINE I. Detecting GLSL Errors II. Drawing a (gasp) Triangle! III. (Simple) Animation 2 Interactive Computer Graphics, http://www.mechapen.com/projects.html WHAT IS

More information

Graphics Hardware. Instructor Stephen J. Guy

Graphics Hardware. Instructor Stephen J. Guy Instructor Stephen J. Guy Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability! Programming Examples Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability!

More information

Sign up for crits! Announcments

Sign up for crits! Announcments Sign up for crits! Announcments Reading for Next Week FvD 16.1-16.3 local lighting models GL 5 lighting GL 9 (skim) texture mapping Modern Game Techniques CS248 Lecture Nov 13 Andrew Adams Overview The

More information

GPU Programming EE Midterm Examination

GPU Programming EE Midterm Examination Name Solution GPU Programming EE 4702- Midterm Examination Wednesday, 2 November 204 9:30 0:20 CST Alias Phylæ has landed! Problem Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (8 pts) (2

More information

CS8803SC Software and Hardware Cooperative Computing GPGPU. Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology

CS8803SC Software and Hardware Cooperative Computing GPGPU. Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology CS8803SC Software and Hardware Cooperative Computing GPGPU Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology Why GPU? A quiet revolution and potential build-up Calculation: 367

More information

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015 WebGL and GLSL Basics CS559 Fall 2015 Lecture 10 October 6, 2015 Last time Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

GLSL 1: Basics. J.Tumblin-Modified SLIDES from:

GLSL 1: Basics. J.Tumblin-Modified SLIDES from: GLSL 1: Basics J.Tumblin-Modified SLIDES from: Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico and

More information

OPENGL RENDERING PIPELINE

OPENGL RENDERING PIPELINE CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript

More information

CS770/870 Fall 2015 Advanced GLSL

CS770/870 Fall 2015 Advanced GLSL Expanded Graphics Pipeline CS770/870 Fall 2015 Advanced GLSL Geometry definition Shaders can actually be inserted in more places in pipeline Vertex and fragment shaders are most important Vertex shader

More information

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside CS230 : Computer Graphics Lecture 4 Tamar Shinar Computer Science & Engineering UC Riverside Shadows Shadows for each pixel do compute viewing ray if ( ray hits an object with t in [0, inf] ) then compute

More information

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

More information