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

Fondamenti di Grafica 3D The Rasterization Pipeline.

Pipeline Operations. CS 4620 Lecture 10

From Ver(ces to Fragments: Rasteriza(on

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

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

Pipeline Operations. CS 4620 Lecture 14

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

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

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

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

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

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

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

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

COMP371 COMPUTER GRAPHICS

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

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

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

Models and Architectures

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

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

CS Rasterization. Junqiao Zhao 赵君峤

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

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. MIT EECS 6.837, Durand and Cutler

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

CHAPTER 1 Graphics Systems and Models 3

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

CS 130 Final. Fall 2015

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

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

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

Topic #1: Rasterization (Scan Conversion)

Chapter 8: Implementation- Clipping and Rasterization

Computer Graphics. Bing-Yu Chen National Taiwan University

Clipping and Scan Conversion

Computer Graphics Shadow Algorithms

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

3D Rasterization II COS 426

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

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

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Introduction to Visualization and Computer Graphics

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

Direct Rendering of Trimmed NURBS Surfaces

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

CPSC GLOBAL ILLUMINATION

Rasterization Overview

Introduction to Computer Graphics with WebGL

Sung-Eui Yoon ( 윤성의 )

Spatial Data Structures

Hidden Surface Removal

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

Shading, Advanced Rendering. Week 7, Wed Feb 28

Chapter 7 - Light, Materials, Appearance

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

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

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

MIT EECS 6.837, Teller and Durand 1

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

Hidden surface removal. Computer Graphics

Realtime 3D Computer Graphics Virtual Reality

Visibility: Z Buffering

9. Illumination and Shading

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

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

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

Interpolation using scanline algorithm

Game Architecture. 2/19/16: Rasterization

Graphics (Output) Primitives. Chapters 3 & 4

Intro to Ray-Tracing & Ray-Surface Acceleration

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

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

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

Computer Graphics Geometry and Transform

Other Rendering Techniques CSE 872 Fall Intro You have seen Scanline converter (+z-buffer) Painter s algorithm Radiosity CSE 872 Fall

Spatial Data Structures

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Lecture 11: Ray tracing (cont.)

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

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

CS5620 Intro to Computer Graphics

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

Institutionen för systemteknik

Transcription:

Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Reading for Today Old Method New Method "Light Scattering from Human Hair Fibers" Marschner et al., SIGGRAPH 2003 Photo

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

(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) Restricted to scan-convertible primitives glbegin(gl_triangles) glnormal3f(...) glvertex3f(...) glvertex3f(...) glvertex3f(...) glend(); Ray Casting vs. Rendering Pipeline Ray Casting Rendering Pipeline 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 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 Primitives, lighting effects, adaptive antialiasing Limitations of Good bandwidth/computation ratio Sampling occurs late in the pipeline Minimal state required 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? Questions? ray tracing scan conversion flat shading scan conversion gouraud shading

Today The Graphics Pipeline Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ 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.) Transform to Normalized Device Coordinates (NDC) Eye space World space Maps world space to eye space Viewing position is transformed to origin & direction is oriented along some axis (usually z) Eye space Portions of the object outside the view volume (view frustum) are removed NDC The objects are projected to the 2D image place (screen space) NDC Screen Space

Rasterizes objects into pixels Interpolate values as we go (color, depth, etc.) 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 in the Graphics Pipeline Rasterization/

What if the pz is > eyez? Eliminate portions of objects outside the viewing frustum View Frustum far boundaries of the image plane projected in 3D left a near & far clipping plane User may define additional clipping planes near top (eyex, eyey, eyez) right bottom image plane camera/eye What if the pz is < eyez? (eyex, eyey, eyez) + z axis What if the pz eyez? + z axis (eyex, eyey, eyez) + z axis??? image plane image plane

What if the pz eyez? Why Clip? Avoid degeneracies Don t draw stuff behind the eye Avoid division by 0 and overflow + z axis (eyex, eyey, eyez) Efficiency Don t waste time on objects outside the image boundary Other graphics applications (often non-convex)??? image plane Constructive Solid Geometry 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 http://matter.sawkmonkey.com/raytracer/csg.html http://en.wikipedia.org/wiki/ Constructive_solid_geometry#/media/File:Csg_tree.png

in the Graphics Pipeline 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 Coordinate Systems in the Pipeline Object space World space Eye Space / Camera Space Clip Space (NDC) Screen Space 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 Normalized Device Coordinates is more efficient in a rectangular, axis-aligned volume: (-1,-1,-1) (1,1,1) OR (0,0,0) (1,1,1)

Questions? Today Ray Casting / Tracing vs. Traditional Graphics Pipeline Rasterization/ Line Rasterization Triangle Rasterization 2D Scan Converting 2D Line Segments Geometric primitives Given: (point, line, polygon, circle, polyhedron, sphere... ) Primitives are continuous; screen is discrete : algorithms for efficient generation of the samples comprising this approximation Segment endpoints (integers x1, y1; x2, y2) Identify: Set of pixels (x, y) to display for segment

Line Rasterization Requirements Algorithm Design Choices Transform continuous primitive into discrete samples Uniform thickness & brightness Continuous appearance No gaps Accuracy Speed Assume: Naive Line Rasterization Algorithm Efficiency Simply compute y as a function of x Computing y value is expensive 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))) m = dy/dx, 0 < m < 1 Exactly one pixel per column fewer disconnected, more too thick Observe: y += m at each x step (m = dy/dx)

Bresenham's Algorithm (DDA) Line Rasterization & Grid Marching Select pixel vertically closest to line segment Can be used for ray-casting acceleration March a ray through a grid 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 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 Brute force solution for triangles For each pixel Improvement: Compute only for the screen bounding box of the triangle How do we get such a bounding box? Compute line equations at pixel center clip against the triangle Problem? Xmin, Xmax, Ymin, Ymax of the triangle vertices If the triangle is small, a lot of useless computation Can we do better? Kind of! Scan-line Rasterization We compute the line equation for many useless pixels What could we do? Compute the boundary pixels Fill the spans Interpolate vertex color along the edges & spans!

But These Days 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 Triangles are usually very small Setup costs are becoming more troublesome is annoying Brute force is tractable Questions? Reading for Friday: Ray Tracing on Programmable Graphics Hardware Purcell, Buck, Mark, & Hanrahan SIGGRAPH 2002

Reading for HW4: Improving Shadows and Reflections via the Stencil Buffer, Mark Kilgard, NVIDIA