The Graphics Pipeline

Similar documents
Rendering Objects. Need to transform all geometry then

Rasterization Overview

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

Lecture 2. Shaders, GLSL and GPGPU

CS451Real-time Rendering Pipeline

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

CS4620/5620: Lecture 14 Pipeline

Introduction to Computer Graphics with WebGL

Shaders. Slide credit to Prof. Zwicker

Models and Architectures

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

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

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

Ciril Bohak. - INTRODUCTION TO WEBGL

Spring 2009 Prof. Hyesoon Kim

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Computergrafik. Matthias Zwicker. Herbst 2010

Pipeline Operations. CS 4620 Lecture 14

Spring 2011 Prof. Hyesoon Kim

Graphics Hardware. Instructor Stephen J. Guy

CS770/870 Fall 2015 Advanced GLSL

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

Programming shaders & GPUs Christian Miller CS Fall 2011

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

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

- Rasterization. Geometry. Scan Conversion. Rasterization

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

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

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Scanline Rendering 2 1/42

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

Graphics Hardware and Display Devices

3D Graphics and OpenGl. First Steps

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

Game Architecture. 2/19/16: Rasterization

CS 354R: Computer Game Technology

03 RENDERING PART TWO

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

Game Graphics & Real-time Rendering

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

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

Pipeline Operations. CS 4620 Lecture 10

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

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

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

COMP371 COMPUTER GRAPHICS

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

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

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

Chapter 1 Introduction

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

Texture Mapping II. Light maps Environment Maps Projective Textures Bump Maps Displacement Maps Solid Textures Mipmaps Shadows 1. 7.

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

Computer Graphics and Visualization. Graphics Systems and Models

Could you make the XNA functions yourself?

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

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

Drawing Fast The Graphics Pipeline

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Rasterization. CS4620 Lecture 13

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

CS 464 Review. Review of Computer Graphics for Final Exam

Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics

Direct Rendering of Trimmed NURBS Surfaces

CS475/CS675 - Computer Graphics. OpenGL Drawing

Computer Graphics. Shadows

Deferred Rendering Due: Wednesday November 15 at 10pm

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

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

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

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

Drawing Fast The Graphics Pipeline

Approximate Catmull-Clark Patches. Scott Schaefer Charles Loop

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

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Pipeline and Rasterization. COMP770 Fall 2011

Advanced Lighting Techniques Due: Monday November 2 at 10pm

Graphics Pipeline 2D Geometric Transformations

Dave Shreiner, ARM March 2009

The Rasterization Pipeline

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

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

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Hardware Accelerated Volume Visualization. Leonid I. Dimitrov & Milos Sramek GMI Austrian Academy of Sciences

Drawing Fast The Graphics Pipeline

Computer Graphics 10 - Shadows

Projection Matrix Tricks. Eric Lengyel

E.Order of Operations

Hardware-driven Visibility Culling Jeong Hyun Kim

Transcription:

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 100-1000 rays/pixel

Rendering: Rasterization Tessellate objects into primitives

Rendering: Rasterization Tessellate objects into primitives Draw each separately: determine position and color draw pixels to screen

Rendering: Rasterization Tessellate objects into primitives Draw each separately: determine position and color draw pixels to screen Embarrassingly parallel Fast

Rendering: Rasterization How to deal with overlaps?

Rendering: Rasterization How to deal with overlaps? Keep track of depth of previously-drawn pixels Depth image or depth buffer

Rendering: Rasterization How to deal with overlaps? depth buffer How to deal with shadows/reflections?

Rendering: Rasterization How to deal with overlaps? depth buffer How to deal with shadows/reflections? hmm

Ray Tracing vs Rasterization Ray Tracing Rasterization Loop over pixels Light effects easy shadows, reflections, caustics, Slow-ish Used in movies Loop over triangles Light effects require hacks and tricks Blazingly fast Used in games

Ray Tracing vs Rasterization

Rasterization Algorithms Actually rasterizing objects not so easy

Rasterization Algorithms Actually rasterizing objects not so easy so use specialized hardware to do it

Vertex Shader Vertex List Tessellation/ Geometry Shaders Triangle List Primitive Assembly Fragment Shader Textures Rasterization CPU GPU Framebuffer Screen

Vertices and Triangles

Sending Data to the GPU One vertex/triangle at a time: very slow Vertex Buffer Objects: big arrays of data vertex positions vertex colors texture info etc

Shaders Small arbitrary programs that run on GPU Massively parallel

Shaders Small arbitrary programs that run on GPU Massively parallel Four kinds: vertex, tessellation, geometry, fragment

Shaders Small arbitrary programs that run on GPU Massively parallel Four kinds: vertex, tessellation, geometry, fragment These days: used for many non-rendering applications (GPGPU)

Vertex Shader Runs in parallel on every vertex no access to triangles or other verts

Vertex Shader Runs in parallel on every vertex no access to triangles or other verts Main job: transform vertex positions

Vertex Shader Runs in parallel on every vertex no access to triangles or other verts Main job: transform vertex positions Also used for shading

Vertex Shader Vertex List Tessellation/ Geometry Shaders Triangle List Primitive Assembly Fragment Shader Textures Rasterization CPU GPU Framebuffer Screen

Processing Primitives Assembly: group verts into polygons

Processing Primitives Assembly: group verts into polygons Tessellation shader: runs on each triangle can split triangles into subtriangles increase level of detail near camera, etc

Processing Primitives Assembly: group verts into polygons Tessellation shader: runs on each triangle can split triangles into subtriangles increase level of detail near camera, etc Geometry shader: runs on each triangle can access verts and neighbors more general than tessellation, slower

Vertex Shader Vertex List Tessellation/ Geometry Shaders Triangle List Primitive Assembly Fragment Shader Textures Rasterization CPU GPU Framebuffer Screen

Fragment Shader Runs in parallel on each fragment (pixel) rasterization: one tri -> many fragments Writes color and depth for one pixel (only) Final texturing/coloring of the pixels

Fragment Shader Many fragments per triangle

Fragment Shader Many fragments per triangle GPU automatically applies barycentric interpolation UV coords, normals, colors,

Vertex Shader Vertex List Tessellation/ Geometry Shaders Triangle List Primitive Assembly Fragment Shader Textures Rasterization CPU GPU Framebuffer Screen

Normalized Device Coordinates Before rasterization, must decide what geometry to show and where

Normalized Device Coordinates Before rasterization, must decide what geometry to show and where GPU draws everything in unit cube

Normalized Device Coordinates Before rasterization, must decide what geometry to show and where GPU draws everything in unit cube Everything clipped

Normalized Device Coordinates X & Y axes map to screen width & height

Normalized Device Coordinates X & Y axes map to screen width & height Z used for depth

Normalized Device Coordinates Notice: deeper points have higher z (not right-handed)

Camera Coordinates Notice: look down negative z direction

Camera Coordinates Notice: look down negative z direction Projection: transform from camera to NDC (typically in vertex shader)

Coordinate Systems in Graphics model matrix world object view matrix camera perspective matrix normalized device

For Extra Confusion Screen coordinates

Framebuffer Memory region containing pixel data The old days: mapped to RAM with DMA CPU could write to it directly

Framebuffer Memory region containing pixel data The old days: mapped to RAM with DMA CPU could write to it directly Now: GPU controls it

Framebuffer Several layers: Color buffer: RGB of each pixel

Framebuffer Several layers: Color buffer: RGB of each pixel Depth buffer

Framebuffer Several layers: Color buffer: RGB of each pixel Depth buffer Stencil buffer, etc

Framebuffer Several layers: Color buffer: RGB of each pixel Depth buffer Stencil buffer, etc Can be saved to file, to texture, to screen

Displaying the Framebuffer CRTs: beam sweeps across screen drawing pixels one pass: 1/60 secs

Displaying the Framebuffer CRTs: beam sweeps across screen drawing pixels one pass: 1/60 secs LCDs: grabs framebuffer every 1/60 secs

Flickering and Tearing Framebuffer changes while monitor draws

Double-Buffering to Stop Tearing Use two framebuffers Render to back buffer while showing front buffer Then swap

Double-Buffering to Stop Tearing On CRTs: must wait for vertical retrace to swap

Double-Buffering to Stop Tearing On CRTs: must wait for vertical retrace to swap vsync occurs 1/60 sec

Double-Buffering to Stop Tearing On CRTs: must wait for vertical retrace to swap vsync occurs 1/60 sec On LCDs: swap when not reading

Communicating with GPU Very low level / awkward

Communicating with GPU Very low level / awkward Two types of data: vertex attributes in VBOs global variables ( uniforms )

Shaders GPU CPU VBOs vertpos[] vertnormals[] Uniforms view lightpos

Communicating with GPU Very low level / awkward Two types of data: vertex attributes in VBOs global variables ( uniforms ) GPU stores no variable names just location numbers

Shaders GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view lightpos

Communicating with GPU Very low level / awkward Two types of data: vertex attributes in VBOs global variables ( uniforms ) GPU stores no variable names just location numbers GPU programming is lots of plumbing binding inputs and outputs correctly

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view lightpos

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view lightpos when shader is compiled

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view lightpos glbindattriblocation()

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view (2) lightpos (1) glgetuniformlocation()

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view (2) lightpos (1) at render time: glvertexattribpointer()

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view (2) lightpos (1) at render time: glvertexattribpointer() gluniform**()

Shaders Inputs position normal Uniforms view lightpos GPU Vertex Attributes 1 2 3 Global Memory 1 2 3 CPU VBOs vertpos[] vertnormals[] Uniforms view (2) lightpos (1) VAOs store the VBO state

Ray Tracing: Why Slow? Reprise Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing 100-1000 rays/pixel Much less hardware support inhomogeneous / unpredictable work