Illumination Models III: Ray Tracing (View Dependent Global Illumination)

Similar documents
Clipping and Intersection

Supplement to Lecture 16

Ray casting. Ray casting/ray tracing

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

From Vertices To Fragments-1

Two-Dimensional Viewing. Chapter 6

Geometric Queries for Ray Tracing

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

3D Rendering Pipeline (for direct illumination)

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

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Lines and Planes in 3D

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

Ray Tracing. CS334 Fall Daniel G. Aliaga Department of Computer Science Purdue University

CS770/870 Spring 2017 Ray Tracing Implementation

Lecture 11: Ray tracing (cont.)

Lecture 11. More Ray Casting/Tracing

Topics. From vertices to fragments

Computer Graphics (CS 543) Lecture 10 (Part 1): 3D Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Questions??? Announcements Assignment 3 due today

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

1.5 Equations of Lines and Planes in 3-D

3D Rendering. Course Syllabus. Where Are We Now? Rendering. 3D Rendering Example. Overview. Rendering. I. Image processing II. Rendering III.

Sung-Eui Yoon ( 윤성의 )

3D Rendering and Ray Casting

1999, Denis Zorin. Ray tracing

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

Clipping and Scan Conversion

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17

1.5 Equations of Lines and Planes in 3-D

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

3D Rendering and Ray Casting

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

MODULE - 9. Subject: Computer Science. Module: Line Clipping. Module No: CS/CGV/9

Section 12.2: Quadric Surfaces

Set the Viewport. Set the Viewport Clipping. Set the Viewport. Set the Viewport. Set the Viewport. Resizing the Viewport W = H

Intro to Modeling Modeling in 3D

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

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

Clipping Lines. Dr. Scott Schaefer

Part IV. 2D Clipping

Review Exercise. 1. Determine vector and parametric equations of the plane that contains the

B. Section 1.1. Chapter 1 Review Booklet A. Vocabulary Match the vocabulary term with its definition. 3. A pair of opposite rays on line p.

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required: Watt, sections , (handout) Further reading:

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

Fog and Cloud Effects. Karl Smeltzer Alice Cao John Comstock

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

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

Ray Tracing. Shandong University

Ray Tracing I. Internet Raytracing Competition

Ray scene intersections

CS348B Lecture 2 Pat Hanrahan, Spring Greeks: Do light rays proceed from the eye to the light, or from the light to the eye?

Werner Purgathofer

Rendering. Generate an image from geometric primitives II. Rendering III. Modeling IV. Animation. (Michael Bostock, CS426, Fall99)

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

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

Shading, Advanced Rendering. Week 7, Wed Feb 28

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

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

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Basics of Computational Geometry

8.1 Geometric Queries for Ray Tracing

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

Part 3: 2D Transformation

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required:

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

8. Hidden Surface Elimination

Ray Tracing. CS 4620 Lecture 5

Intro to Ray-Tracing & Ray-Surface Acceleration

Computer Graphics Ray Casting. Matthias Teschner

Visible Surface Detection Methods

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Solid Modeling. Michael Kazhdan ( /657) HB , FvDFH 12.1, 12.2, 12.6, 12.7 Marching Cubes, Lorensen et al.

COMPUTATIONAL GEOMETRY

Photorealism: Ray Tracing

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

CPSC GLOBAL ILLUMINATION

Realtime 3D Computer Graphics Virtual Reality

CG Programming: 3D Texturing

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

Lecture 4: Planes, Interior Point Testing, Duality

Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Loop Boundary - ignore edge vertex near boundary rule. use the same edge vertex rule. Deadline changed to Friday night(7/20) 11:59p Selection - extra

Clipping. CSC 7443: Scientific Information Visualization

Raytracing CS148 AS3. Due :59pm PDT

Intersecting Simple Surfaces. Dr. Scott Schaefer

9. Visible-Surface Detection Methods

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Ray-tracing Cont. Ray-tracing

Advanced 3D-Data Structures

Practical 2: Ray Tracing

Transcription:

Illumination Models III: Ray Tracing (View Dependent Global Illumination) The University of Texas at Austin 1

Basic Definitions Ray Tracing/Casting: Setting: eyepoint, virtual screen (an array of virtual pixels, and scene are organized in convenient coordinate frames (e.g., all in view or world frames) Ray: a half line determined by the eyepoint and a point associated with a chosen pixel Interpretations: Ray is the path of photons that successfully reach the eye (we simulate selected photon transport through the scene) Ray is a sampling probe that gathers color/visibility information screen ray scene eye The University of Texas at Austin 2

Ray Tracing: Recursive Eye-screen ray is the primary ray Backward tracking of photons that could have arrived along primary Intersect with objects Determine nearest object Generate secondary rays to light sources in reflection-associated directions in refraction-associated directions Continue recursively for each secondary ray Terminate after suitably many levels Accumulate suitably averaged information for primary ray Deposit information in pixel See raytrace psuedo-code document http://www.cs.utexas.edu/ bajaj/graphics10/cs354/raytrace1.pdf The University of Texas at Austin 3

Ray Casting: Nonrecursive As above for ray tracing, but stop before generating secondary rays Apply illumination model at nearest object intersection with no regard to light occlusion Ray becomes a sampling probe that just gathers information on visibility color The University of Texas at Austin 4

Intersection Computations General Issues: Ray: express in parametric form E + t(p E) where E is the eyepoint and P is the pixel point Scene Object: direct implicit form express as f(q) = 0 when Q is a surface point, where f is a given formula intersection computation is an equation to solve: find t such that f(e + t(p E)) = 0 Scene Object: procedural implicit form f is not a given formula f is only defined procedurally A(f(E + t(p E)) = 0) yields t, where A is a root finding method (secant, Newton, bisection, etc.) The University of Texas at Austin 5

Quadric Surfaces: Surface given by Ray given by Ax 2 + Bxy + Cxy + Dy 2 + Eyz + Fz 2 + Gx + Hy + Jz + K = 0 x = x E + t(x P x E ) y = y E + t(y P y E ) z = z E + t(z P z E ) Substitute ray x,y,z into surface formula quadratic equation results for t organize expression terms for numerical accuracy; i.e., to avoid cancellation combinations of numbers with widely different magnitudes The University of Texas at Austin 6

Polygons: The plane of the polygon should be known (A,B,C,0) is the normal vector pick three successive vertices Ax + By + Cz + D = 0 v i 1 = (x i 1,y i 1,z i 1 ) v i = (x i,y i,z i ) v i+1 = (x i+1,y i+1,z i+1 ) should subtend a reasonable angle (bounded away from 0 or 180 degrees) normal vector is the cross product v i 1 v i v i+1 v i D = (Ax + By + Cz) for any vertex (x,y,z,1) of the polygon The University of Texas at Austin 7

Substitute ray x,y,z into surface formula linear equation results for t Solution provides planar point (x,y,z) is this inside or outside the polygon? The University of Texas at Austin 8

Clipping and Intersection Clipping: Remove points, line segments, polygons outside a region of interest. Need to discard everything that s outside of our window. Point clipping: Remove points outside window. A point is either entirely inside the region or not. Line clipping: Remove portion of line segment outside window. Line segments can straddle the region boundary. The Liang-Barsky algorithm efficiently clips line segments against a halfspace. Halfspaces can be combined to bound a convex region. Use outcodes to organize combination of halfspaces. Can use some of the ideas in Liang-Barsky to clip points. The University of Texas at Austin 9

Polygon clipping: Remove portion of polygon outside window. Polygons can straddle the region boundary. Concave polygons can be broken into convex. Sutherland-Hodgemen algorithm also deals with all cases efficiently. Built upon efficient line segment clipping. The University of Texas at Austin 10

Parametric representation of line: P(t) = (1 t)p 0 + tp 1 or equivalently: P(t) = P 0 + t(p 1 P 0 ) P 0 and P 1 are non-coincident points. For t R, P(t) defines an infinite line. For t [0,1],P(t) defines a line segment from P 0 to P 1. Good for generating points on a line. Not so good for testing if a given point is on a line. The University of Texas at Austin 11

Implicit representation of line: l(q) = (Q P) n P is a point on the line. n is a vector perpendicular to the line. l(q) gives us the signed distance from any point Q to the line. The sign of l(q) tells us if Q is on the left or right of the line, relative to the direction of n. If l(q) is zero, then Q is on the line. Use same form for the implicit representation of a halfspace. n P Q The University of Texas at Austin 12

Clipping a point to a halfspace: Represent a window edge implicitly... Use the implicit form of a line to classify a point Q. Must choose a convention for the normal: point to the inside. Check the sign of l(q): If l(q) > 0, the Q is inside. Otherwise clip (discard) Q; it is on, or outside. The University of Texas at Austin 13

Clipping a line segment to a halfspace: There are three cases: The line segment is entirely inside. The line segment is entirely outside. The line segment is partially inside and partially outside. n P The University of Texas at Austin 14

Do the easy stuff first: We can devise easy (and fast!) tests for the first two cases: (P 0 P) n < 0 AND (P 1 P) n < 0 = Outside (P 0 P) n > 0 AND (P 1 P) n > 0 = Inside We will also need to decide whether on the boundary is inside or outside. Trivial tests are important in computer graphics: Particularly if the trivial case is the most common one. Particularly if we can reuse the computation for the non-trivial case. The University of Texas at Austin 15

Do the hard stuff only if we have to: If line segment partially inside and partially outside, need to clip it: Represent the segment from P 0 to P 1 in parametric form: P(t) = (1 t)p 0 + tp 1 = P 0 + t(p 1 P 0 ) When t = 0,P(t) = P 0. When t = 1,P(t) = P 1. We now have the following: n 1P P P(t)=(1-t)P 0 +tp 1 P 0 The University of Texas at Austin 16

We want t such that P(t) is on l: Solving for t gives us (P(t) P) n = (P 0 + t(p 1 P 0 ) P) n = (P 0 P) n + t(p 1 P 0 ) n = 0 t = (P 0 P) n (P 0 P 1 ) n NOTE: The values we use for our simple test can be used to compute t: t = (P 0 P) n (P 0 P) n (P 1 P) n The University of Texas at Austin 17

Clipping a line segment to a window: Just clip to each of four halfspaces. Pseudo-code: given: P, n defining a window edge for each edge (A,B) = (P0,P1) weca = (A-P). n wecb = (B-P). n if ( weca < 0 AND wecb < 0 ) then reject if ( weca >= 0 AND wecb >= 0 ) then next t = weca / (weca - wecb) if (weca < 0 ) then A = A + t (B-A) else B = B + t (B-A) endif endfor NOTE: Liang-Barsky Algorithm generalizes to 3D The University of Texas at Austin 18

Line-clip Algorithm generalizes to 3D: Half-space now lies on one side of a plane. The implicit formula for a plane in 3D is the same as that for a line in 2D. The parametric formula for the line to be clipped is unchanged. The University of Texas at Austin 19

Reading Assignment and News Please review the appropriate sections related to this lecture in chapter 11, and associated exercises, of the recommended text. (Recommended Text: Interactive Computer Graphics, by Edward Angel, Dave Shreiner, 6th edition, Addison-Wesley) Please track Blackboard for the most recent Announcements and Project postings related to this course. (http://www.cs.utexas.edu/users/bajaj/graphics2012/cs354/) The University of Texas at Austin 20