Graphics Pipeline. CS535 Fall Daniel G. Aliaga Department of Computer Science Purdue University

Similar documents
Models and Architectures

CS 130 Final. Fall 2015

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

Pipeline Operations. CS 4620 Lecture 14

CS4620/5620: Lecture 14 Pipeline

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Pipeline Operations. CS 4620 Lecture 10

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

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

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

CS 130 Exam I. Fall 2015

Introduction to Computer Graphics with WebGL

CS 130 Exam I. Fall 2015

Rasterization Overview

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

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

The Traditional Graphics Pipeline

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

CHAPTER 1 Graphics Systems and Models 3

The Traditional Graphics Pipeline

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

CS451Real-time Rendering Pipeline

Institutionen för systemteknik

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

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

The Traditional Graphics Pipeline

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

Computer Graphics Shadow Algorithms

- Rasterization. Geometry. Scan Conversion. Rasterization

Chapter 4. Chapter 4. Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

The Viewing Pipeline Coordinate Systems

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

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

Ray Tracing. Outline. Ray Tracing: History

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1

Chapter 7 - Light, Materials, Appearance

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19

3D Viewing Transformations

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

CS 464 Review. Review of Computer Graphics for Final Exam

Einführung in Visual Computing

Sung-Eui Yoon ( 윤성의 )

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

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Graphics Pipeline 2D Geometric Transformations

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Rendering Objects. Need to transform all geometry then

CPSC GLOBAL ILLUMINATION

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

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

CS452/552; EE465/505. Intro to Lighting

3D Rasterization II COS 426

Intro to Ray-Tracing & Ray-Surface Acceleration

CS 4620 Program 3: Pipeline

Graphics for VEs. Ruth Aylett

Computer Graphics Lecture 11

Prof. Feng Liu. Fall /19/2016

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Course Title: Computer Graphics Course no: CSC209

Texture Mapping. Michael Kazhdan ( /467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, , 16.6

Lecture 4. Viewing, Projection and Viewport Transformations

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

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Last week. Machiraju/Zhang/Möller

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

CSE4030 Introduction to Computer Graphics

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

For each question, indicate whether the statement is true or false by circling T or F, respectively.

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Spring 2009 Prof. Hyesoon Kim

CS535 Fall Department of Computer Science Purdue University

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Illumination and Shading

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

Ray Tracer Due date: April 27, 2011

Parallel Rendering. Johns Hopkins Department of Computer Science Course : Rendering Techniques, Professor: Jonathan Cohen

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

CS 4620 Midterm 1. Tuesday 22 October minutes

Computer Graphics I Lecture 11

Hidden Surfaces II. Week 9, Mon Mar 15

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

CS 4620 Midterm, March 21, 2017

Drawing Fast The Graphics Pipeline

Viewing COMPSCI 464. Image Credits: Encarta and

Transcription:

Graphics Pipeline CS535 Fall 2016 Daniel G. Aliaga Department of Computer Science Purdue University

Ray-tracing Inverse mapping for every pixel construct a ray from the eye for every object in the scene intersect ray with object find closest intersection with the ray compute normal at point of intersection compute color for pixel shoot secondary rays

Pipeline Forward mapping Start from the geometric primitives to find the values of the pixels

Fixed Pipeline Programmable Pipeline (High-level Shading Language)

Standard pipeline. Alternate Pipelines?

A Sorting Classification of (Parallel) Graphics Pipelines Sort-first Sort-middle Sort-last

Sort First

Sort Middle

Sort Last

Sort First Advantages: Low communication requirements when the tessellation ratio and the degree of oversampling are high, or when frame-to-frame coherence can be exploited. Processors implement entire rendering pipeline for a portion of the screen. Disadvantages: Susceptible to load imbalance. Primitives may clump into regions, concentrating the work on a few renderers. To take advantage of frame-to-frame coherence, retained mode and complex data handling code are necessary.

Sort Middle Advantages: General and straightforward; redistribution occurs at a natural place in the pipeline. Disadvantages: High communication costs if tessellation ratio is high. Susceptible to load imbalance between rasterizers when primitives are distributed unevenly over the screen.

Sort Last Advantages: Renderers implement the full rendering pipeline and are independent until pixel merging. Less prone to load imbalance. SL-full merging can be embedded in a linear network, making it linearly scalable. Disadvantage: Pixel traffic may be extremely high, particularly when oversampling.

Graphics Rendering History IKONAS Graphics System (1978) (basically a dedicated CPU)

Graphics Rendering History TAAC Graphics Accelerator Board (a GPU ) Graphics Rendering History

Graphics Rendering History Silicon Graphics Personal Iris (1986) CPU and GPU (a sort first architecture) gl appeared HP had starbase (OpenGL appeared in 1991)

Graphics Rendering History Renderman: a programmable shading language (1986)

Graphics Rendering History PixelPlanes 1,2,3,4,5 (a sort middle architecture)

Graphics Rendering History PixelFlow A sort-last architecture Formally supports programmable shading

Graphics Rendering History PixelFlow -> HP

Graphics Rendering History PixelFlow -> HP

Graphics Rendering History PixelFlow -> NVIDIA

Graphics Rendering History

Standard Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Standard Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Modeling Transformations Most popular transformations in graphics Translation Rotation Scale Projection In order to use a single matrix for all, we use homogeneous coordinates

Modeling Transformations

Modeling Transformations And many more

Standard Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Diffuse (mostly)

Specular++

Environment Mapping

Subsurface Scatterring

Others Transparency Radiosity Ambient occlusion

Others

Lighting and Shading Light sources Point light Models an omnidirectional light source (e.g., a bulb) Directional light Models an omnidirectional light source at infinity Spot light Models a point light with direction Light model Ambient light Diffuse reflection Specular reflection

Lighting and Shading Diffuse reflection Lambertian model

Lighting and Shading Diffuse reflection Lambertian model

Lighting and Shading Diffuse reflection Lambertian model

Lighting and Shading Specular reflection Phong model

Lighting and Shading Specular reflection Phong model

Lighting and Shading Specular reflection Phong model

Computer Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Viewing Transformation ~ x c ~ x c ~ R( X C) RX ~ RC t ~ x c World-to-camera matrix M R 0 X t Y 1 Z 1 R R t x R y R z 3x3 rotation matrices t x t y t T z translation vector

Standard Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Standard Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Perspective projection eye/viewpoint f Z z (x, y) y? image plane (X, Y, Z) Y optical axis y = Y f Z y = f Y Z & x = f X Z

Perspective Projection 1 0 1 0 0 0 0 0 0 0 0 Z Y X f f Z fy fx Z fy Z fx / / y x

OpenGL 3D Viewing 3D Viewing in OpenGL: Position camera; Specify projection. H&B 10-10:365-371

OpenGL 3D Viewing View volume y x z Camera always in origin, in direction of negative z-axis. Convenient for 2D, but not for 3D.

OpenGL 3D Viewing Solution for view transform: Transform your model such that you look at it in a convenient way. Approach 1: Carefully do it yourself. Apply rotations, translations, scaling, etc., before rendering the model. Approach 2: Use glulookat();

OpenGL 3D Viewing MatrixMode(GL_MODELVIEW); glulookat(x0,y0,z0, xref,yref,zref, Vx,Vy,Vz); x0,y0,z0: xref,yref,zref: P ref, centerpoint; Vx,Vy,Vz: P 0, viewpoint, location of camera; V, view-up vector. Default: P 0 = (0, 0, 0); P ref = (0, 0, 1); V=(0, 1, 0).

OpenGL 3D Viewing Orthogonal projection: MatrixMode(GL_PROJECTION); glortho(xwmin, xwmax, ywmin, ywmax, dnear, dfar); xwmin, xwmax, ywmin,ywmax: specification window dnear: distance to near clipping plane ywmax ywmin xwmin xwmax y x z dfar : distance to far clipping plane Select dnear and dfar right: dnear < dfar, model fits between clipping planes.

OpenGL 3D Viewing Perspective projection: MatrixMode(GL_PROJECTION); glfrustrum(xwmin, xwmax, ywmin, ywmax, dnear, dfar); xwmin, xwmax, ywmin,ywmax: specification window dnear: distance to near clipping plane ywmax ywmin xwmin xwmax y x z dfar : distance to far clipping plane Select dnear and dfar right: 0 < dnear < dfar, model fits between clipping planes. Standard projection: xwmin = -xwmax, ywmin = -ywmax H&B 10-10:365-371

OpenGL 3D Viewing Finally, specify the viewport (just like in 2D): glviewport(xvmin, yvmin, vpwidth, vpheight); xvmin, yvmin: coordinates lower left corner (in pixel coordinates); vpwidth, vpheight: width and height (in pixel coordinates); vpheight vpwidth (xvmin, yvmin) H&B 8-4:265-267

OpenGL 2D Viewing In short: glmatrixmode(gl_projection); glfrustrum(xwmin, xwmax, ywmin, ywmax, dnear, dfar); glviewport(xvmin, yvmin, vpwidth, vpheight); glmatrixmode(gl_modelview); glulookat(x0,y0,z0, xref,yref,zref, Vx,Vy,Vz); To prevent distortion, make sure that: (ywmax ywmin)/(xwmax xwmin) = vpwidth/vpheight Make sure that you can deal with resize/reshape of the (OS) window. H&B 8-4:265-267

Standard Graphics Pipeline Geometry Modeling Transformation Transform into 3D world coordinate system Lighting Simulate illumination and reflectance Viewing Transformation Transform into 3D camera coordinate system Clipping Clip primitives outside camera s view Projection Transform into 2D camera coordinate system Scan Conversion Draw pixels (incl. texturing, hidden surface ) Image

Scan Conversion/Rasterization Determine which fragments get generated Interpolate parameters (colors, textures, normals, etc.)

Scan Conversion/Rasterization Determine which fragments get generated Interpolate parameters (colors, textures, normals, etc.)

Scan Conversion/Rasterization Determine which fragments get generated Interpolate parameters (colors, textures, normals, etc.) How?

Scan Conversion/Rasterization Determine which fragments get generated Interpolate parameters (colors, textures, normals, etc.) E.g., Barycentric coords (see whiteboard!)

Barycentric coordinates p 1 q p 3 p 2 q = αp 1 + βp 2 + γp 3 If [α + β + γ = 1 and α, β, γ 0], then q inside triangle (p 1, p 2, p 3 ) Can also write: q = αp 1 + βp 2 + (1 α β)p 3

Barycentric coordinates p 1 q p 3 p 2 How to solve for α and β in q = αp 1 + βp 2 + 1 α β p 3? Two equations, two unknowns: use 2x2 matrix inversion