The Traditional Graphics Pipeline

Similar documents
The Traditional Graphics Pipeline

The Traditional Graphics Pipeline

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

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

Final projects. Rasterization. The Graphics Pipeline. Illumination (Shading) (Lighting) Viewing Transformation. Rest of semester. This week, with TAs

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Fondamenti di Grafica 3D The Rasterization Pipeline.

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

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

From Ver(ces to Fragments: Rasteriza(on

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

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

Pipeline Operations. CS 4620 Lecture 10

Last time? Rasterization. Scan Conversion (Rasterization) High-level concepts for Visibility / Display. Today

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

Line Drawing. Foundations of Computer Graphics Torsten Möller

Pipeline Operations. CS 4620 Lecture 14

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

Today. The Graphics Pipeline: Projective Transformations. Last Week: Schedule. XForms Forms Library. Questions?

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

Graphics Pipeline & Rasterization. CS-C3100 Fall 2017 Lehtinen

Computer Graphics. - Rasterization - Philipp Slusallek

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

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

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

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

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Homework #2. Shading, Ray Tracing, and Texture Mapping

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

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

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

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Clipping and Scan Conversion

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

CHAPTER 1 Graphics Systems and Models 3

CS Rasterization. Junqiao Zhao 赵君峤

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Models and Architectures

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Topic #1: Rasterization (Scan Conversion)

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Shading, Advanced Rendering. Week 7, Wed Feb 28

COMP371 COMPUTER GRAPHICS

CS 130 Final. Fall 2015

Chapter 8: Implementation- Clipping and Rasterization

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Visibility: Z Buffering

Topics and things to know about them:

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

Game Architecture. 2/19/16: Rasterization

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

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

MIT EECS 6.837, Teller and Durand 1

Hidden surface removal. Computer Graphics

Direct Rendering of Trimmed NURBS Surfaces

Realtime 3D Computer Graphics Virtual Reality

9. Illumination and Shading

Spatial Data Structures

Introduction to Computer Graphics with WebGL

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

EF432. Introduction to spagetti and meatballs

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Computer Graphics. Bing-Yu Chen National Taiwan University

CPSC GLOBAL ILLUMINATION

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Computer Graphics Geometry and Transform

Rasterization Overview

Today. Acceleration Data Structures for Ray Tracing. Cool results from Assignment 2. Last Week: Questions? Schedule

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

Introduction to Visualization and Computer Graphics

Computer Graphics I Lecture 11

Graphics Hardware and Display Devices

OXFORD ENGINEERING COLLEGE (NAAC Accredited with B Grade) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS

Spatial Data Structures

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

Institutionen för systemteknik

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

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

3D Rasterization II COS 426

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

Sung-Eui Yoon ( 윤성의 )

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

Interpolation using scanline algorithm

CS 130 Exam I. Fall 2015

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

CS602 MCQ,s for midterm paper with reference solved by Shahid

EF432. Introduction to spagetti and meatballs

Spatial Data Structures

4: Polygons and pixels

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Transcription:

Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics Pipeline [ Homework 4 due: Thursday 4/22 ] Final project progress post on LMS due: Monday 4/26 [ Quiz 2: Fri 4/30 ] In class work sessions: Tuesday 5/4 & Friday 5/7 (TA will meet with each group) Reports Due: Monday 5/10 Presentations: Wednesday 5/12, 1-5pm? Last Time? Today Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ Ray Casting / Tracing How Do We Render Interactively? Advantages? Use graphics hardware (the graphics pipeline), via OpenGL, MesaGL, or DirectX Smooth variation of normal, silhouettes Generality: can render anything that can be intersected with a ray Atomic operation, allows recursion Disadvantages? Time complexity (N objects, R pixels) Usually too slow for interactive applications Hard to implement in hardware (lacks computation coherence, must fit entire scene in memory) Graphics Pipeline (OpenGL) Ray Tracing Most global effects available in ray tracing will be sacrificed, but some can be approximated 1

Given a primitive's vertices & the illumination at each vertex: Figure out which pixels to "turn on" to render the primitive Interpolate the illumination values to "fill in" the primitive At each pixel, keep track of the closest primitive (z-buffer) glbegin(gl_triangles) glnormal3f(...) glvertex3f(...) glvertex3f(...) glvertex3f(...) glend(); Limitations of Restricted to scan-convertible primitives Object polygonization Faceting, shading artifacts Effective resolution is hardware dependent No handling of shadows, reflection, transparency Problem of overdraw (high depth complexity) What if there are many more triangles than pixels? scan conversion flat shading ray tracing scan conversion gouraud shading Ray Casting vs. Rendering Pipeline Ray Casting For each pixel For each object Send pixels into the scene Discretize first Rendering Pipeline For each triangle For each pixel Project scene to the pixels Discretize last Ray Casting vs. Rendering Pipeline Ray Casting For each pixel For each object Whole scene must be in memory Depth complexity: no computation for hidden parts Atomic computation More general, more flexible Primitives, lighting effects, adaptive antialiasing Rendering Pipeline For each triangle For each pixel Primitives processed one at a time Coherence: geometric transforms for vertices only Early stages involve analytic processing Computation increases with depth of the pipeline Good bandwidth/computation ratio Sampling occurs late in the pipeline Minimal state required Questions? Today Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ 2

The Graphics Pipeline The Graphics Pipeline Primitives are processed in a series of stages Each stage forwards its result on to the next stage The pipeline can be drawn and implemented in different ways Some stages may be in hardware, others in software Optimizations & additional programmability are available at some stages 3D models defined in their own coordinate system (object space) transforms orient the models within a common coordinate frame (world space) (Lighting) Vertices lit (shaded) according to material properties, surface properties (normal) and light sources Local lighting model (Diffuse, Ambient, Phong, etc.) Object space World space Maps world space to eye space Viewing position is transformed to origin & direction is oriented along some axis (usually z) World space Eye space Transform to Normalized Device Coordinates (NDC) Eye space Portions of the object outside the view volume (view frustum) are removed NDC 3

The objects are projected to the 2D image place (screen space) Rasterizes objects into pixels Interpolate values as we go (color, depth, etc.) NDC Screen Space Questions? Each pixel remembers the closest object (depth buffer) Almost every step in the graphics pipeline involves a change of coordinate system. are central to understanding 3D computer graphics. Today Ray Casting / Tracing vs. Traditional Graphics Pipeline Coordinate Systems Rasterization/ Common Coordinate Systems Object space local to each object World space common to all objects Eye space / Camera space derived from view frustum Clip space / Normalized Device Coordinates (NDC) [-1,-1,-1] [1,1,1] Screen space indexed according to hardware attributes 4

Coordinate Systems in the Pipeline Normalized Device Coordinates Object space World space Eye Space / Camera Space Clip Space (NDC) Screen Space is more efficient in a rectangular, axis-aligned volume: (-1,-1,-1) (1,1,1) OR (0,0,0) (1,1,1) What if the p z is > eye z? What if the p z is < eye z? (eye x, eye y, eye z ) z axis + (eye x, eye y, eye z ) z axis + image plane image plane What if the p z eye z? What if the p z eye z? (eye x, eye y, eye z ) z axis + (eye x, eye y, eye z ) z axis +??? image plane??? image plane 5

Eliminate portions of objects outside the viewing frustum View Frustum boundaries of the image plane projected in 3D left a near & far clipping plane User may define additional clipping near planes far top right bottom Why Clip? Avoid degeneracies Don t draw stuff behind the eye Avoid division by 0 and overflow Efficiency Don t waste time on objects outside the image boundary Other graphics applications (often non-convex) Hidden-surface removal, Shadows, Picking, Binning, CSG (Boolean) operations (2D & 3D) Strategies The Graphics Pipeline Don t clip (and hope for the best) Clip on-the-fly during rasterization Analytical clipping: alter input geometry Former hardware relied on full clipping Modern hardware mostly avoids clipping Only with respect to plane z=0 In general, it is useful to learn clipping because it is similar to many geometric algorithms Questions? Today Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ Line Rasterization Triangle Rasterization 6

2D Geometric primitives (point, line, polygon, circle, polyhedron, sphere... ) Primitives are continuous; screen is discrete : algorithms for efficient generation of the samples comprising this approximation Scan Converting 2D Line Segments Given: Segment endpoints (integers x1, y1; x2, y2) Identify: Set of pixels (x, y) to display for segment Line Rasterization Requirements Transform continuous primitive into discrete samples Uniform thickness & brightness Continuous appearance No gaps Accuracy Speed Algorithm Design Choices Assume: m = dy/dx, 0 < m < 1 Exactly one pixel per column fewer disconnected, more too thick Naive Line Rasterization Algorithm Simply compute y as a function of x Conceptually: move vertical scan line from x1 to x2 What is the expression of y as function of x? Set pixel (x, round (y(x))) Efficiency Computing y value is expensive Observe: y += m at each x step (m = dy/dx) 7

Bresenham's Algorithm (DDA) Select pixel vertically closest to line segment intuitive, efficient, pixel center always within 0.5 vertically Generalize to handle all eight octants using symmetry Can be modified to use only integer arithmetic Line Rasterization & Grid Marching Can be used for ray-casting acceleration March a ray through a grid Collect all grid cells, not just 1 per column (or row) Questions? Brute force solution for triangles For each pixel Compute line equations at pixel center clip against the triangle Problem? Brute force solution for triangles For each pixel Compute line equations at pixel center clip against the triangle Problem? If the triangle is small, a lot of useless computation Brute force solution for triangles Improvement: Compute only for the screen bounding box of the triangle How do we get such a bounding box? Xmin, Xmax, Ymin, Ymax of the triangle vertices 8

Can we do better? Kind of! We compute the line equation for many useless pixels What could we do? Scan-line Rasterization Compute the boundary pixels Fill the spans Interpolate vertex color along the edges & spans! But These Days Triangles are usually very small Setup cost are becoming more troublesome is annoying Brute force is tractable Modern Rasterization For every triangle Compute Compute bbox, clip bbox to screen limits For all pixels in bbox Compute line equations If all line equations>0 //pixel [x,y] in triangle Framebuffer[x,y]=triangleColor Questions? Reading for Today: Ray Tracing on Programmable Graphics Hardware Purcell, Buck, Mark, & Hanrahan SIGGRAPH 2002 Post a comment or question on the LMS discussion by 10am on Tuesday 3/18 9

Reading for Friday: Shadow Algorithms for Computer Graphics, Frank Crow, SIGGRAPH 1977 10