Lecture 2. Shaders, GLSL and GPGPU

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

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

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

Rendering Objects. Need to transform all geometry then

Graphics Hardware. Instructor Stephen J. Guy

Introduction to Shaders.

CS4620/5620: Lecture 14 Pipeline

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Rasterization Overview

CS451Real-time Rendering Pipeline

1.2.3 The Graphics Hardware Pipeline

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

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

Evolution of GPUs Chris Seitz

Pipeline Operations. CS 4620 Lecture 14

Spring 2009 Prof. Hyesoon Kim

Spring 2011 Prof. Hyesoon Kim

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

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

CS427 Multicore Architecture and Parallel Computing

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

Shaders (some slides taken from David M. course)

E.Order of Operations

Programming Graphics Hardware

Advanced Rendering Techniques

The Graphics Pipeline

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Shaders. Slide credit to Prof. Zwicker

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

Graphics Processing Unit Architecture (GPU Arch)

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

CS770/870 Fall 2015 Advanced GLSL

The Graphics Pipeline and OpenGL I: Transformations!

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

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

CS 354R: Computer Game Technology

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

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

Sung-Eui Yoon ( 윤성의 )

CHAPTER 1 Graphics Systems and Models 3

Models and Architectures

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

Module 13C: Using The 3D Graphics APIs OpenGL ES

Computer graphics 2: Graduate seminar in computational aesthetics

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

CSE4030 Introduction to Computer Graphics

The Rasterization Pipeline

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

COMP371 COMPUTER GRAPHICS

CS130 : Computer Graphics. Tamar Shinar Computer Science & Engineering UC Riverside

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

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

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014

OPENGL RENDERING PIPELINE

The Graphics Pipeline

2.11 Particle Systems

Scanline Rendering 2 1/42

The Graphics Pipeline and OpenGL I: Transformations!

Introduction to the OpenGL Shading Language

Case 1:17-cv SLR Document 1-3 Filed 01/23/17 Page 1 of 33 PageID #: 60 EXHIBIT C

Introduction to Computer Graphics with WebGL

The Graphics Pipeline

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Shaders CSCI 4229/5229 Computer Graphics Fall 2017

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

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

Supplement to Lecture 22

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

Introduction to OpenGL

Dave Shreiner, ARM March 2009

Graphics Pipeline & APIs

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

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

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

Cg 2.0. Mark Kilgard

Basics of GPU-Based Programming

12.2 Programmable Graphics Hardware

INF3320 Computer Graphics and Discrete Geometry

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

lecture 18 - ray tracing - environment mapping - refraction

Ciril Bohak. - INTRODUCTION TO WEBGL

Drawing Fast The Graphics Pipeline

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

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

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

Programming shaders & GPUs Christian Miller CS Fall 2011

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

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

OpenGL refresher. Advanced Computer Graphics 2012

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems

Programmable Graphics Hardware

3D Rendering Pipeline

GPU Memory Model. Adapted from:

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

Graphics Pipeline & APIs

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

CS452/552; EE465/505. Clipping & Scan Conversion

Programmable Graphics Hardware

Transcription:

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

Lecture questions 1) What kind of shaders is most interesting for GPU computing? (What part of the pipeline?) 2) What geometry is usually used for shaderbased GPU computing? 3) What is ping-ponging? Suggest an example where it is useful. Why is classic GPGPU interesting? Highly suited to all problems dealing with images, computer vision, image coding etc Parallelization comes natural, you can!t avoid it and good speedups are likely. Fewer pitfalls. Highly optimized (for graphics performance). Compatibility is vastly superior! Very much easier to install!

They say classic GPGPU is obsolete? Marketing hype! Mature technology - publishing opportunities limited. Remapping to images awkward for some problems. Limited access to local memory Double support hardware dependent extension Any given program, when running, is obsolete Shaders and GLSL Let!s have a look at how it works!

Transformations performed by 4x4 matrix multiplications Device Projected View World Model Sd T d P Rv T v T w R w Device transformation Projection transformation World-to-view transformation Model-to-world transformation The OpenGL pipeline Primitives, connectivity Vertex and normal vectors Vertex Transformed Primitive assembly Triangles etc Texture Clip, cull Frame buffer +color, texture Pixel coord Raster conversion

Out of these, two are programmable! Primitives, connectivity Vertex and normal vectors Vertex Transformed Primitive assembly Triangles etc Texture Clip, cull Frame buffer +color, texture Pixel coord Raster conversion Actually, three (on advanced GPUs) - but we focus on the two first Primitives, connectivity Vertex and normal vectors Vertex Transformed Primitive assembly Triangles etc Texture Clip, cull Frame buffer +color, texture Pixel coord Raster conversion

Shader programs Program snippets that are executed per vertex or per fragment, on the GPU! Two programs cooperate, one vertex program and one fragment program. Shader implies that the goal is lighting, but that is only one of the goals!. Vertex transform Vertexcolor, vertex-level lighting Texturing Color and light per pixel Can be done in a vertex shader Can be done in a fragment shader Vertex shader Replaces the fixed functionality of the vertex. It can: transform vertices, normals and texture generate texture calculate lighting per vertex set values for interpolation for use in a fragment shader It knows nothing about: Perspective, viewport Frustum Primitives (!) Culling

shader (a.k.a pixel shader) Replaces the fixed functionality of the fragment. It can: set the fragment color get color values from textures calculate fog and other color calculations use any kind of interpolated data from the vertices It can not change the fragment write into textures affect stencil, scissor, alpha, depth... Four different: Shader languages Assembly language: Old solution, being phased out, no longer updated. Cg: C for graphics, NVidia HLSL: High-level shading language, Microsoft GLSL: OpenGL shading language Choice depends on flatform and needs (and taste). GLSL superior for compatibility!

Typical shader examples in graphics Vertex manipulation Lighting calculations Multitexturing Bump mapping