Clipping. Administrative. Assignment 1 Gallery. Questions about previous lectures? Overview of graphics pipeline? Assignment 2

Similar documents
MIT EECS 6.837, Teller and Durand 1

The Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping

521493S Computer Graphics Exercise 3 (Chapters 6-8)

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

CS 428: Fall Introduction to. Geometric Transformations. Andrew Nealen, Rutgers, /15/2010 1

Lecture 3: Geometric Algorithms(Convex sets, Divide & Conquer Algo.)

The Traditional Graphics Pipeline

CMSC 425: Lecture 16 Motion Planning: Basic Concepts

The Traditional Graphics Pipeline

Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme

COT5405: GEOMETRIC ALGORITHMS

The Traditional Graphics Pipeline

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

Dr Pavan Chakraborty IIIT-Allahabad

Triangle Rasterization

Convex Hulls. Helen Cameron. Helen Cameron Convex Hulls 1/101

Global Illumination with Photon Map Compensation

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

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

L ENSES. Lenses Spherical refracting surfaces. n 1 n 2

Cross products. p 2 p. p p1 p2. p 1. Line segments The convex combination of two distinct points p1 ( x1, such that for some real number with 0 1,

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

Last time: Disparity. Lecture 11: Stereo II. Last time: Triangulation. Last time: Multi-view geometry. Last time: Epipolar geometry

Visibility. Tom Funkhouser COS 526, Fall Slides mostly by Frédo Durand

11/2/2010. In the last lecture. Monte-Carlo Ray Tracing : Path Tracing. Today. Shadow ray towards the light at each vertex. Path Tracing : algorithm

Frédo Durand, George Drettakis, Joëlle Thollot and Claude Puech

Efficient Algorithms for Computing Conservative Portal Visibility Information

CS5620 Intro to Computer Graphics

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

Physically Based Rendering ( ) Intersection Acceleration

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

Shuigeng Zhou. May 18, 2016 School of Computer Science Fudan University

Lecture 2: Fixed-Radius Near Neighbors and Geometric Basics

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Graphics and Interaction Rendering pipeline & object modelling

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

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

A Novel Iris Segmentation Method for Hand-Held Capture Device

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

Grouping of Patches in Progressive Radiosity

Computer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1

Visibility and Occlusion Culling

Introduction to Visualization and Computer Graphics

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

Some Thoughts on Visibility

Texture Mapping with Vector Graphics: A Nested Mipmapping Solution

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

Last Time? Ray Casting. Administrivia: Lab & Office Hours. Notes on Assignments. Ray Casting. Overview of Today

Rasterization Overview

Shading Models. Simulate physical phenomena

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

MIT Ray Tracing Ray Tracing

Lecture 18. Today, we will discuss developing algorithms for a basic model for parallel computing the Parallel Random Access Machine (PRAM) model.

CS 450: COMPUTER GRAPHICS 2D TRANSFORMATIONS SPRING 2016 DR. MICHAEL J. REALE

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

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

FRUSTUM-TRACED RASTER SHADOWS: REVISITING IRREGULAR Z-BUFFERS

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

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

Schedule. MIT Monte-Carlo Ray Tracing. Radiosity. Review of last week? Limitations of radiosity. Radiosity

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

What is Clipping? Why do we Clip? Lecture 9 Comp 236 Spring Clipping is an important optimization

Shadows in Computer Graphics

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

From Vertices To Fragments-1

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Shadows. Shadows. Spatial relationship between objects. Shadows as depth cue. Spatial relationship between objects

CS4620/5620: Lecture 14 Pipeline

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Perception of Shape from Shading

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

Occluder Simplification using Planar Sections

Hidden Surface Removal

Efficient Clipping of Arbitrary Polygons

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]

CMSC 754 Computational Geometry 1

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

Drawing Fast The Graphics Pipeline

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Lecture 7: Computational Geometry

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Image-Based Modeling and Rendering. Image-Based Modeling and Rendering. Final projects IBMR. What we have learnt so far. What IBMR is about

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

Spatial Data Structures

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

FRUSTUM-TRACED RASTER SHADOWS: REVISITING IRREGULAR Z-BUFFERS

Hidden Surfaces II. Week 9, Mon Mar 15

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

Lecture 7: Objects (Chapter 15) CS 1110 Introduction to Computing Using Python

RASTERISED RENDERING

Pipeline Operations. CS 4620 Lecture 10

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

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

Culling. Computer Graphics CSE 167 Lecture 12

Real-Time Non- Photorealistic Rendering

Shadows. COMP 575/770 Spring 2013

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms

Transcription:

Cliing MIT EECS 6.837 Frédo Durand and Seth Teller Some slides and images courtesy of Leonard McMillan MIT EECS 6.837, Teller and Durand 1 MIT EECS 6.837, Teller and Durand 2 Administrative Assignment 1 Gallery Assignment 2 Due Friday 27 at 5m Model a scene using iv files from assignt 1 Lighting: at least one sot and one other light MIT EECS 6.837, Teller and Durand 3 MIT EECS 6.837, Teller and Durand 4 Overview of grahics ieline? Questions about revious lectures? MIT EECS 6.837, Teller and Durand 5 MIT EECS 6.837, Teller and Durand 6

Today s lecture: Cliing Overview of grahics ieline? Overview and motivation Scene Database Camera+Viewort arameters lane euation & oint cliing 0 Traverse Geometric Model Transform to World sace Aly lighting Euation at vertices Line & segment cliing Transform to Eye sace ersective transform to NDC Cli Acceleration using outcodes Transform to 3D Screen sace Rasterize Resolve visibility olygon cliing MIT EECS 6.837, Teller and Durand 7 Framebuffer Values MIT EECS 6.837, Teller and Durand 8 Cliing Eliminate arts of rimitives outside the viewing frustum Shirley 210 Jim Blinn s Corner, A Tri Down The Grahics ieline, Morgan Kaufman, chater 13 MIT EECS 6.837, Teller and Durand 9 Why cliing? Avoid degeneracy Don t draw outside image Avoid division by 0 and overflow Efficiency Don t waste time on object outside the screen Other grahics methods (usually more comlex cases, non convex) Hidden-surface removal Shadows icking Binning CSG (Boolean) oerations (2D & 3D) MIT EECS 6.837, Teller and Durand 10 Cliing strategies lan Don t cli (and hoe for the best) Cli on the-fly during rasterization Analytical cliing: alter inut geometry This is the subject of today s lecture Overview and motivation lane euation & oint cliing 0 Line & segment cliing Acceleration using outcodes MIT EECS 6.837, Teller and Durand 11 olygon cliing MIT EECS 6.837, Teller and Durand 12

3D lane euation Imlicit lane euation H() = Ax+By+Cz+D = 0 Gradient of H? 3D lane euation Imlicit lane euation H() = Ax+By+Cz+D = 0 Gradient of H? lane defined by 0(x,y,z,1) n(a, B, C, 1) H 0 H MIT EECS 6.837, Teller and Durand 13 MIT EECS 6.837, Teller and Durand 14 lane-oint distance lane H=0 If n is normalized d=h Signed distance! Homogeneous lane euation H=(A,B,C,D) =(x,y,z,1) Dot roduct in homogeneous coordinates H.=0 ( H T =0 ) Duality between oints and hyerlanes 0 H n 0 H MIT EECS 6.837, Teller and Durand 15 MIT EECS 6.837, Teller and Durand 16 Homogeneous lane euation H=(A,B,C,D) =(x,y,z,1) Infinite number of euivalent lane exressions sax+sby+scz+sd=0 Infinite number of homogeneous coordinate (sx, sy, sz, sw) n 0 H MIT EECS 6.837, Teller and Durand 17 Cliing wrt 1 lane ass through if H 0 Cli (or cull or reject) if H<0 0 MIT EECS 6.837, Teller and Durand 18

oint cliing Test against each of the 6 lanes Normals oriented towards the interior Cli (or cull or reject) if H<0 oint cliing & transformation Transform M (e.g. from world sace to NDC) The lane euation is transformed with (M -1 ) T MIT EECS 6.837, Teller and Durand 19 MIT EECS 6.837, Teller and Durand 20 lan Overview and motivation arametric exression of line? lane euation & oint cliing 0 Line & segment cliing 1 Acceleration using outcodes 0 olygon cliing MIT EECS 6.837, Teller and Durand 21 MIT EECS 6.837, Teller and Durand 22 Line-lane intersection Insert exlicit euation of line into imlicit euation of lane 1 Segment cliing If H < 0 and H > 0, cli to lane If H < 0 and H > 0, cli to lane If H > 0 andh> 0, ass through If H < 0 and H < 0, clied out arameter t can be used to interolate attributes (color, etc.) 0 MIT EECS 6.837, Teller and Durand 23 MIT EECS 6.837, Teller and Durand 24

Segment cliing If H < 0 and H > 0, cli to lane If H < 0 and H > 0, cli to lane If H > 0 andh> 0, ass through If H < 0 and H < 0, clied out Segment cliing If H < 0 and H > 0, cli to lane If H < 0 and H > 0, cli to lane If H > 0 andh> 0, ass through If H < 0 and H < 0, clied out MIT EECS 6.837, Teller and Durand 25 MIT EECS 6.837, Teller and Durand 26 Segment cliing If H < 0 and H > 0, cli to lane If H < 0 and H > 0, cli to lane If H > 0 andh> 0, ass through If H < 0 and H < 0, clied out Segment cliing If H < 0 and H > 0, cli to lane If H < 0 and H > 0, cli to lane If H > 0 andh> 0, ass through If H < 0 and H < 0, clied out MIT EECS 6.837, Teller and Durand 27 Note ualitative contrast with oint cliing Triage" MIT EECS 6.837, Teller and Durand 28 Cliing against the frustum For each frustum lane H If H<0 and H<0, clied out; break If H>0 and>h 0, ass through If H < 0 and H > 0, cli to H If H < 0 and H > 0, cli to H Segment cliing Note: must interolate associated attributes (color, normal, texture, etc.) MIT EECS 6.837, Teller and Durand 29 MIT EECS 6.837, Teller and Durand 30

Line cliing Questions? Result is a single segment Why? MIT EECS 6.837, Teller and Durand 31 MIT EECS 6.837, Teller and Durand 32 lan Acceleration using outcodes Overview and motivation lane euation & oint cliing Line & segment cliing 0 Avoid many geometric calculations Eliminate obvious rejects We ll show it in 2D Same rincile in n-d Acceleration using outcodes olygon cliing MIT EECS 6.837, Teller and Durand 33 MIT EECS 6.837, Teller and Durand 34 Is it efficient? For each frustum lane H If H<0 and H<0, clied out; break If H>0 and>h 0, ass through If H < 0 and H > 0, cli to H If H < 0 and H > 0, cli to H Is it efficient? For each frustum lane H If H<0 and H<0, clied out; break If H>0 and>h 0, ass through If H < 0 and H > 0, cli to H If H < 0 and H > 0, cli to H MIT EECS 6.837, Teller and Durand 35 MIT EECS 6.837, Teller and Durand 36

Is it efficient? For each frustum lane H If H<0 and H<0, clied out; break If H>0 and>h 0, ass through If H < 0 and H > 0, cli to H If H < 0 and H > 0, cli to H Is it efficient? For each frustum lane H If H<0 and H<0, clied out; break If H>0 and>h 0, ass through If H < 0 and H > 0, cli to H If H < 0 and H > 0, cli to H What is the roblem? MIT EECS 6.837, Teller and Durand 37 MIT EECS 6.837, Teller and Durand 38 Is it efficient? For each frustum lane H If H<0 and H<0, clied out; break If H>0 and>h 0, ass through If H < 0 and H > 0, cli to H If H < 0 and H > 0, cli to H What is the roblem? The comutation of the intersections were unnecessary How can we detect this earlier? Outcodes Comute the n lane euations for oint Combine into an outcode (binary) 0 means : is valid wrt this lane 1010 0010 0110 Outcode of : 1010 MIT EECS 6.837, Teller and Durand 39 MIT EECS 6.837, Teller and Durand 40 Outcodes Comute the n lane euations for oint and Combine into an outcode (binary) Logical AND Outcodes When do we fail to save comutation? 1010 0010 0110 Outcode of : 1010 Outcode of : 0110 Outcode of [] : 0010 Rejected because there is a 1 MIT EECS 6.837, Teller and Durand 41 MIT EECS 6.837, Teller and Durand 42

Outcodes When do we fail to save comutation? Conservative rejection And we have the info on what to intersect Outcode of : 1000 Outcode of : 0010 Outcode of [] : 0000 Not rejected MIT EECS 6.837, Teller and Durand 43 Outcodes It works for arbitrary rimitives Outcode of : 1010 Outcode of : 1010 Outcode of r : 0110 Outcode of s : 0010 Outcode of t : 0110 Outcode of u : 0010 Outcode : 0010 Rejected MIT EECS 6.837, Teller and Durand 44 When to cli? Before ersective transform in 3D sace Use the euation of 6 lanes Advantages? roblems? In homogeneous coordinates after ersective transform (NDC) Before ersective divide Advantages? roblems In the transformed 3D screen sace after ersective division Advantages? roblems? MIT EECS 6.837, Teller and Durand 45 When to cli? Before ersective transform in 3D sace Use the euation of 6 lanes Natural, not too degenerate In homogeneous coordinates after ersective transform (Cli sace) Before ersective divide (4D sace, weird w values) Canonical,indeendent of camera The simlest to imlement in fact In the transformed 3D screen sace after ersective division roblem: objects in the lane of the camera MIT EECS 6.837, Teller and Durand 46 lan olygon cliing Overview and motivation lane euation & oint cliing 0 Line & segment cliing Acceleration using outcodes olygon cliing MIT EECS 6.837, Teller and Durand 47 MIT EECS 6.837, Teller and Durand 48

olygon cliing olygon cliing Cliing is symmetric MIT EECS 6.837, Teller and Durand 49 MIT EECS 6.837, Teller and Durand 50 olygon cliing is comlex Even when the olygons are convex olygon cliing is nasty When the olygons are concave MIT EECS 6.837, Teller and Durand 51 MIT EECS 6.837, Teller and Durand 52 Weiler-Atherton Cliing Strategy: Walk" olygon/window boundary olygons are oriented (CCW) Weiler-Atherton Cliing Comute intersection oints MIT EECS 6.837, Teller and Durand 53 MIT EECS 6.837, Teller and Durand 54

Weiler-Atherton Cliing Comute intersection oints Mark oints where olygons enters cliing window (green here) Cliing While there is still an unrocessed entering intersection Walk" olygon/window boundary MIT EECS 6.837, Teller and Durand 55 MIT EECS 6.837, Teller and Durand 56 Walking rules Out-to-in air: Record clied oint Follow olygon boundary (ccw) In-to-out air: Record clied oint Follow window boundary (ccw) Walking rules Out-to-in air: Record clied oint Follow olygon boundary (ccw) In-to-out air: Record clied oint Follow window boundary (ccw) MIT EECS 6.837, Teller and Durand 57 MIT EECS 6.837, Teller and Durand 58 Walking rules Out-to-in air: Record clied oint Follow olygon boundary (ccw) In-to-out air: Record clied oint Follow window boundary (ccw) Walking rules Out-to-in air: Record clied oint Follow olygon boundary (ccw) In-to-out air: Record clied oint Follow window boundary (ccw) MIT EECS 6.837, Teller and Durand 59 MIT EECS 6.837, Teller and Durand 60

Walking rules While there is still an unrocessed entering intersection Walk" olygon/window boundary Walking rules While there is still an unrocessed entering intersection Walk" olygon/window boundary MIT EECS 6.837, Teller and Durand 61 MIT EECS 6.837, Teller and Durand 62 Walking rules While there is still an unrocessed entering intersection Walk" olygon/window boundary Walking rules While there is still an unrocessed entering intersection Walk" olygon/window boundary MIT EECS 6.837, Teller and Durand 63 MIT EECS 6.837, Teller and Durand 64 Weiler-Atherton Cliing Imortance of good adjacency data structure (here simly list of oriented edges) Robustness, recision, degeneracies What if a vertex is on the boundary? What haens if it is almost on the boundary? roblem with floating oint recision Welcome to the real world of 3D geometry! MIT EECS 6.837, Teller and Durand 65 MIT EECS 6.837, Teller and Durand 66

Cliing Constructive Solid Geometry (CSG) Many other cliing algorithms: arametric, general windows, region-region, One-lane-at-a-Time Cliing, etc. Sort of generalized cliing Boolean oerations Very oular in CAD/CAM CSG tree Union Intersection MIT EECS 6.837, Teller and Durand 67 Difference Ari Raoort, Steven Sitz 97 MIT EECS 6.837, Teller and Durand 68 Constructive Solid Geometry (CSG) Simle with some rendering algorithms (Ray Tracing) Constructive Solid Geometry (CSG) Simle with some rendering algorithms (Ray Tracing) MIT EECS 6.837, Teller and Durand 69 MIT EECS 6.837, Teller and Durand 70 Constructive Solid Geometry (CSG) Questions? Simle with some rendering algorithms (Ray Tracing) Very hard with olygonal models Can also be done with hardware tricks MIT EECS 6.837, Teller and Durand 71 MIT EECS 6.837, Teller and Durand 72

laytime: Sunset We have seen why the sunset is red laytime: The Green Flash Novel by Jules Verne (19 th century) Movie by Rohmer, Summer Visual henomenon at sunset MIT EECS 6.837, Teller and Durand 73 MIT EECS 6.837, Teller and Durand 74 laytime: The Green Flash Green Flash htt://mintaka.sdsu.edu/gf/ htt://www.mtwilson.edu/tour/lot/green_flash/ htt://www.intersoft.it/galaxlux/greenflashgallery.htm htt://www.isc.tamu.edu/~astro/research/sandiego.html htt://www.meteores.net/rv.html htt://flzhgn.home.mindsring.com/grnray.htm MIT EECS 6.837, Teller and Durand 75 MIT EECS 6.837, Teller and Durand 76 Green flash Green flash MIT EECS 6.837, Teller and Durand 77 MIT EECS 6.837, Teller and Durand 78

Green flash Mirage Refraction temerature gradient Ω shae Deends on wavelength MIT EECS 6.837, Teller and Durand 79 MIT EECS 6.837, Teller and Durand 80 Green flash Green flash Simulation MIT EECS 6.837, Teller and Durand 81 MIT EECS 6.837, Teller and Durand 82 Green flash Why don t you see green flash at sunrise? MIT EECS 6.837, Teller and Durand 83