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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

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

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.

From Ver(ces to Fragments: Rasteriza(on

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

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

Computer Graphics. - Rasterization - Philipp Slusallek

Pipeline Operations. CS 4620 Lecture 14

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

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

Graphics Pipeline & Rasterization. CS-C3100 Fall 2017 Lehtinen

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

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

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

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

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

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

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

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

COMP371 COMPUTER GRAPHICS

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

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

Models and Architectures

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

CHAPTER 1 Graphics Systems and Models 3

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

CS Rasterization. Junqiao Zhao 赵君峤

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

Computer Graphics Shadow Algorithms

Clipping and Scan Conversion

Topic #1: Rasterization (Scan Conversion)

CS 130 Final. Fall 2015

Chapter 8: Implementation- Clipping and Rasterization

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

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

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

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

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

Direct Rendering of Trimmed NURBS Surfaces

Rasterization Overview

Spatial Data Structures

3D Rasterization II COS 426

Computer Graphics. Bing-Yu Chen National Taiwan University

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

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

CPSC GLOBAL ILLUMINATION

Hidden surface removal. Computer Graphics

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

Sung-Eui Yoon ( 윤성의 )

Visibility: Z Buffering

9. Illumination and Shading

Realtime 3D Computer Graphics Virtual Reality

Introduction to Computer Graphics with WebGL

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

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

Chapter 7 - Light, Materials, Appearance

Shading, Advanced Rendering. Week 7, Wed Feb 28

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Interpolation using scanline algorithm

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

Overview. A real-time shadow approach for an Augmented Reality application using shadow volumes. Augmented Reality.

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

Computer Graphics Geometry and Transform

Real-Time Shadows. Computer Graphics. MIT EECS Durand 1

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]

Spatial Data Structures

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Introduction to Visualization and Computer Graphics

Lecture 17: Shadows. Projects. Why Shadows? Shadows. Using the Shadow Map. Shadow Maps. Proposals due today. I will mail out comments

Graphics Hardware and Display Devices

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

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

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

Graphics (Output) Primitives. Chapters 3 & 4

Game Architecture. 2/19/16: Rasterization

Computer Graphics I Lecture 11

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Spatial Data Structures

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

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

Acknowledgement: Images and many slides from presentations by Mark J. Kilgard and other Nvidia folks, from slides on developer.nvidia.

MIT EECS 6.837, Teller and Durand 1

Hidden Surface Removal

Rasterization Computer Graphics I Lecture 14. Scan Conversion Antialiasing Compositing [Angel, Ch , ]

Transcription:

Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ Smooth variation of normal, exact 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) How Do We Render Interactively? Ray Casting vs. Rendering Pipeline Use graphics hardware (the graphics pipeline), via OpenGL, MesaGL, or DirectX Ray Casting Rendering Pipeline For each pixel For each object For each triangle For each pixel Send pixels into the scene Discretize first Project scene to the pixels Discretize last Graphics Pipeline (OpenGL) Ray Tracing Most global effects available in ray tracing will be sacrificed, but some can be approximated 1

(Rendering Pipeline) 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 Must polygonize all objects 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 Whole scene must be in memory Depth complexity: w/ spatial acceleration data structures no computation needed 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/ The Graphics Pipeline 2

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) Object space World space (Lighting) Vertices lit (shaded) according to material properties, surface properties (normal) and light sources Local lighting model (Diffuse, Ambient, Phong, etc.) Maps world space to eye space Viewing position is transformed to origin & direction is oriented along some axis (usually z) Eye space World space Transform to Normalized Device Coordinates (NDC) The objects are projected to the 2D image place (screen space) Eye space Portions of the object outside the view volume (view frustum) are removed NDC NDC Screen Space 3

Rasterizes objects into pixels Interpolate values as we go (color, depth, etc.) 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. Questions? Today Ray Casting / Tracing vs. Traditional Graphics Pipeline Coordinate Systems in the Graphics Pipeline Rasterization/ What if the p z is > eye z? 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 near additional clipping planes camera/eye far top right bottom (eye x, eye y, eye z ) image plane z axis + 4

What if the p z is < 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 What if the p z eye z? (eye x, eye y, eye z )??? image plane z axis + 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 Don t clip (and hope for the best) Clip on-the-fly during rasterization Analytical clipping: alter input geometry 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 5

Coordinate Systems in the Pipeline Normalized Device Coordinates Object space World space Eye Space / Camera Space is more efficient in a rectangular, axis-aligned volume: (-1,-1,-1) (1,1,1) OR (0,0,0) (1,1,1) Clip Space (NDC) Screen Space in the Graphics Pipeline Questions? 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 Today Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ Line Rasterization Triangle Rasterization 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 6

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) 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 7

Line Rasterization & Grid Marching Questions? Can be used for ray-casting acceleration March a ray through a grid Collect all grid cells, not just 1 per column (or row) 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 Can we do better? Kind of! We compute the line equation for many useless pixels What could we do? 8

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 costs are becoming more troublesome is annoying Brute force is tractable Modern Rasterization Questions? 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 Reading for Today: Ray Tracing on Programmable Graphics Hardware Purcell, Buck, Mark, & Hanrahan SIGGRAPH 2002 Reading for Tuesday: Shadow Algorithms for Computer Graphics, Frank Crow, SIGGRAPH 1977 9

Reading for HW4: (start reading this weekend) Improving Shadows and Reflections via the Stencil Buffer, Mark Kilgard, NVIDIA 10