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

Similar documents
Sung-Eui Yoon ( 윤성의 )

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

Ray Tracing. Outline. Ray Tracing: History

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

Lecture 11: Ray tracing (cont.)

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

Graphics 2009/2010, period 1. Lecture 8: ray tracing

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

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

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

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

Ray Tracing. Last Time? Reading for Today. Reading for Today

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

Photorealism: Ray Tracing

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

Intro to Ray-Tracing & Ray-Surface Acceleration

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Lecture 10: Ray tracing

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

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

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Hidden surface removal. Computer Graphics

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

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Triangle Rasterization

CPSC GLOBAL ILLUMINATION

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

Supplement to Lecture 16

Computer Graphics Ray Casting. Matthias Teschner

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

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

Ray tracing. EECS 487 March 19,

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

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

Topics and things to know about them:

Viewing and Ray Tracing. CS 4620 Lecture 4

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

Viewing and Ray Tracing

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Last week. Machiraju/Zhang/Möller

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

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

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

Computer Graphics. Bing-Yu Chen National Taiwan University

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

CS-184: Computer Graphics. Administrative

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

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

CS 325 Computer Graphics

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

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

Welcome to COMP 770 (236) Introduction. Prerequisites. Prerequisites

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

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

3D Rendering and Ray Casting

Ray-Tracing. Misha Kazhdan

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

Geometric optics. The University of Texas at Austin CS384G Computer Graphics Don Fussell

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

Ray Casting. Outline in Code. Outline. Finding Ray Direction. Heckbert s Business Card Ray Tracer. Foundations of Computer Graphics (Fall 2012)

Computer Graphics and Image Processing Ray Tracing I

COMP371 COMPUTER GRAPHICS

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Ray Tracing. Quiz Discussion. Announcements: Final Projects. Last Time? Durer s Ray Casting Machine. Today

3D Rendering and Ray Casting

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

Shading, Advanced Rendering. Week 7, Wed Feb 28

Advanced Ray Tracing

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Computer Graphics. Lecture 9 Environment mapping, Mirroring

8. Hidden Surface Elimination

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

Shadows. COMP 575/770 Spring 2013

Ray Tracing. Last Time? Today. Ray Casting. Durer s Ray Casting Machine. Reading for Today

Introduction to Ray-tracing Objectives

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

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

CS 130 Final. Fall 2015

Introduction to Visualization and Computer Graphics

The Traditional Graphics Pipeline

Lighting and Shading

Computer Graphics. Shi-Min Hu. Tsinghua University

03 RENDERING PART TWO

Ray Casting. To Do. Outline. Outline in Code. Foundations of Computer Graphics (Spring 2012) Heckbert s Business Card Ray Tracer

Hidden Surface Elimination Raytracing. Pre-lecture business. Outline for today. Review Quiz. Image-Space vs. Object-Space

CS559 Computer Graphics Fall 2015

Lecture 11. More Ray Casting/Tracing

CS 4204 Computer Graphics

Ray casting. Ray casting/ray tracing

The Traditional Graphics Pipeline

Photorealism. Photorealism: Ray Tracing. Ray Tracing

CEng 477 Introduction to Computer Graphics Fall 2007

Transcription:

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

From last time Hidden surface removal Painter s algorithm Clipping algorithms Area subdivision BSP trees Z-Buffer Ray casting 3/19/07 2

Today s topics Recursive ray tracing Intersection tests Plane Polygon Sphere 3/19/07 3

Recursive ray casting Ray casting generally dismissed early on: Takes no advantage of screen space coherence Requires costly visibility computation Only works for solids Forces per pixel illumination evaluations Not suited for immediate mode rendering Gained popularity in when Turner Whitted (1980) recognized that recursive ray casting could be used for global illumination effects 3/19/07 4

Generalized ray casting Ray casting used to compute visibility at the eye Visibility for arbitrary points needed for shading Reflections Refraction and transparency Shadows We need to compute the first surface hit along a ray represent ray with origin and direction compute intersections of objects with ray return closest object p(t) = o + td o d p 3/19/07 5

Generating primary rays ntan( θ width 2) height ntan( θ 2) x = r y = u width height ( width ) ( height ) c = + 0.5 x + + 0.5 y + n l 2 2 d= c + ix + jy i [0,width),j [0,height) u c y o l θ d 3/19/07 6 n

Generating secondary rays The origin is the intersection point p 0 Direction depends on the type of ray shadow rays use direction to the light source reflection rays use incoming direction and normal to compute reflection direction transparency continue with same direction refraction use snell s law 3/19/07 7

Intersection tests Go through all of the objects in the scene to determine the one closest to the origin of the ray (the eye). Strategy: Solve of the intersection of the Ray with a mathematical description of the object. 3/19/07 8

Simple strategy Parametric ray equation Gives all points along the ray as a function of the parameter p(t) = o + td Implicit surface equation Describes all points on the surface as the zero set of a function f (p) = Substitute ray equation into surface function and solve for t 0 f (o + td) = 0 3/19/07 9

Ray plane intersection Implicit equation of a plane: Substitute ray equation: Solve for t: n p d= 0 n(o + td) d= 0 t(n d) = d n o d n o t = nd 3/19/07 10

Generalizing to Triangles Find of the point of intersection on the plane containing the triangle Determine if the point is inside the triangle barycentric coordinate method half-plane method v 1 o v 3 p v 2 3/19/07 11

Barycentric coordinates Points in a triangle have positive barycentric coordinates: p = α v + α v + α v α + α + α = 1 1 0 2 1 3 2 1 2 3 Expressed as a matrix equation: v 1 V -1 can be precomputed to accelerate this calculation px v1x v2x v3x α1 p = v v v α y 1y 2y 3y 2 pz v1z v2z v3z α 3 p = Vα 1 α = V p v 3 p v 2 3/19/07 12

Barycentric coordinates Since we only care about the signs of the barycentric coordinates, we don t have to compute a complete inverse V (v v ) T 2 3 1 Adjoint( V) T = Adjoint( V) = (v3 v 1) Det( ) V T (v1 v 2) 3/19/07 13

Issues Numerical robustness. There are lots of places that errors could creep in. What if the point p is slightly off the plane? What if the weights don t sum exactly to 1? Could be caused by p being off the plane as above, or by slight errors in computing Adjoint(V). Manifest itself when triangle is viewed near a grazing angle. No advantage in computing the Adjoint(V) rather than the full inverse if inverse is precomputed Ray-tracing is, in general, dominated by ray-intersection test It pays to precompute as much as possible Barycentric coordinates can be used for interpolating vertex parameters normals, colors, texture coordinates, etc. v 3 v 1 p v 2 3/19/07 14

Half-Plane Method Test intersection point against planes connecting each triangle edge with the eye s position Closely related to the Adjoint(V) of barycentric coordinates but more general v 1 v3 p v 2 o 3/19/07 15

Implementation Steps Compute plane equations: n p d = 0 n = (v a o) (v b Find d value: n o = d o) Pick a plane orientation: Several choices here. The easiest is to evaluate p in the for the first plane, and make sure that all subsequent planes have the same sign. Assuming that you traverse the edges in a consistent order. 3/19/07 16

Tradeoffs of Half-Plane Method Can still preprocess all triangles, but the cross products depend on the viewing position Numerically more robust including the eye as in our computation avoids problems when the intersection point lies slightly off the plane. Relation to the barycentric coordinate method cross products of half plane method are the same as in Adjoint(V) if the eye position is the origin 3/19/07 17

Spheres Intersecting a sphere with a ray originating from the outside: t v A sphere is defined by its center, s, and its radius r. The intersection of a ray with a sphere can be computed as follows: A vector from the eye to the sphere s center. b c 2 = = Apply the Pythagorean law to find b s eye c c v 2 t And once more to find t = v v = c dx r 2 b 2 How many dx -sized steps to the rays point of closest approach from the sphere s center. 3/19/07 18

Speeding up Intersection Test Early Rejection Ray tracing dominated by intersection tests Try to reduce unnecessary work Test for sphere within range of ray When testing all the objects, we want the closest. At any point we usually have a t best that is the closest intersection we have found so far. 3/19/07 19

More Trivial Rejections Test the radicand r 2 -b 2 < 0 Have to test anyway to avoid generating an exception Means that the ray misses the sphere (no real roots) t = v r 2 b 2 b e dx c r s 3/19/07 20

Next time Robustness issues Optimizations Acceleration structures Distribution ray tracing anti-aliasing depth of field soft shadows motion blur Volume effects Code structure 3/19/07 21