Ray Tracing. CS116B Chris Pollett Apr 20, 2004.

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

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

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

Lighting and Shading

Ray-Tracing. Misha Kazhdan

COMP371 COMPUTER GRAPHICS

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

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

Ray Tracing. Kjetil Babington

Implementation Issues

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

Lighting Models. CS116B Chris Pollett Mar 21, 2004.

CPSC GLOBAL ILLUMINATION

Supplement to Lecture 16

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

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

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

CS5620 Intro to Computer Graphics

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

Lecture 11: Ray tracing (cont.)

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

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

Comp 410/510 Computer Graphics. Spring Shading

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

Lecture 10: Ray tracing

Recall: Basic Ray Tracer

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

CS 6620 Shading. Steve Parker Peter Shirley

Illumination Models & Shading

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

Lecture 19: All Together with Refraction

COMP30019 Graphics and Interaction Ray Tracing

Raytracing. COSC 4328/5327 Scott A. King

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

Raytracing CS148 AS3. Due :59pm PDT

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

CS 325 Computer Graphics

Dithering and Rendering. CS116B Chris Pollett Apr 18, 2004.

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Computer Graphics Lecture 11

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Photorealism: Ray Tracing

CS 4204 Computer Graphics

To Shading and Beyond. CS 6965 Fall 2011

Illumination. Courtesy of Adam Finkelstein, Princeton University

Light: Geometric Optics (Chapter 23)

Sung-Eui Yoon ( 윤성의 )

1999, Denis Zorin. Ray tracing

Ray Tracer Due date: April 27, 2011

Introduction to Ray-tracing Objectives

Review for Ray-tracing Algorithm and Hardware

Lecture 18: Primer on Ray Tracing Techniques

Assignment 6: Ray Tracing

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

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

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Lighting and Reflectance COS 426

Ray Tracing. Johns Hopkins Department of Computer Science Course : Rendering Techniques, Professor: Jonathan Cohen

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Ray tracing. EECS 487 March 19,

COMPUTER GRAPHICS AND INTERACTION

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

Indirect Illumination

Assignment 2 Ray Tracing

Shading, Advanced Rendering. Week 7, Wed Feb 28

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

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

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

Reflections and Refractions in Ray Tracing

CS 428: Fall Introduction to. Raytracing. Andrew Nealen, Rutgers, /18/2009 1

Computer Graphics Tick 1

LIGHT. Speed of light Law of Reflection Refraction Snell s Law Mirrors Lenses

w Foley, Section16.1 Reading

Reflection and Refraction

Single Scattering in Refractive Media with Triangle Mesh Boundaries

Introduction to Computer Graphics 7. Shading

Reflection and Shading

Indirect Illumination

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

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

Reflection and Refraction

Global Illumination. Connelly Barnes CS 4810: Graphics

Interpolation using scanline algorithm

Simple Lighting/Illumination Models

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

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

RAYTRACING. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION. HPCViz, KTH Royal Institute of Technology, Sweden

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

COMPLETION OF Z-buffer Graphics Pipeline

Recursion and Data Structures in Computer Graphics. Ray Tracing

Illumination & Shading

Algebra Based Physics

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Shading I Computer Graphics I, Fall 2008

Transcription:

Ray Tracing CS116B Chris Pollett Apr 20, 2004.

Outline Basic Ray-Tracing Intersections

Basic Ray-Tracing Reference Point (i,j) Projection Plane Have a set up like in the above picture. Shoot rays from a reference point through centers of each pixel of the projection plane. Find the nearest surface in scene hit by a given ray. Calculate how it would be lit in our lighting model Then calculate secondary reflection and refraction rays and see what surfaces they hit and add their value, appropriately attenuated, to the value that we just calculated.

Boundary Conditions We terminate paths through the scene if: The ray intersects no surface. The ray intersects a light source that is not a reflecting surface The tree has reached some maximum depth. Let h be the height of our tree so far, at each surface point, we: Check if a terminating condition has been reached. Use the basic illumination model to calculate a surface intensity contribution (I r, I g, I b ). Let (Rx,Ry,Rz) and (Tx, Ty, Tz) be the unit vectors for the reflected and transmitted rays. Let (Xr, Yr, Zr) and (Xt,Yt,Zt) be the pixel locations of the surface that will be intersected by the reflected and transmitted light rays respectively. Let dr and dt be the distances to these surfaces, and att(dr) and att(dt) the corresponding attenuations. Calculate (Irr, Irg, Irb) = ray_trace(rx,ry,rz, Xr, Yr, Zr, h-1) and (Itr, Itg, Itb) = ray_trace(tx,ty,tz, Xt, Yt, Zt, h-1) Return the value (I r + att(dr) *Irr + att(dt) *Itr, I g + att(dr) *Irg + att(dt) *Itg, I b + att(dr) *Irb + att(dt) *Itb).

refracted path More on calculating with rays T θ r θ i R u L H N incoming ray T -transmitted ray; N - surface normal; u unit vector for incoming ray = -V, the view vector; R - unit reflected ray; L - unit vector to light source; H -halfway vector between L and V. Ambient light is k a I a ; diffuse light is proportional to k d (N.L); and specular light is proportional to k s (H.L) n_s. R = u -(2u.N)N; T= (η i / η r )u -(cos θ r - (η i / η r ) cosθ i )N. η i and η r are the index of incidence and of refraction respectively and the formula for T comes from Snell s law.

More calculating with rays Any point on a ray can be calculated using the equation: P = P 0 +su. u depends on the pixel we are tracing through and can be calculated as u = P pix - P prp /(P pix - P prp ). For each surface we want to find the value for P where the ray intersects the surface (if it does). This involves solving a system of equations involving the ray equation and the surface equation. We ll talk more about this in the next several slides. Another issue is that their might be an obstructing surface between the light source and the surface point we are considering. We can send out a shadow ray from the surface point to the light to check for this. If we detect an opaque surface in between then we ignore that light source. (Can be lazy and not do for this homework.)

Ray-Sphere Intersections A sphere is given by the equation: P - P c 2 - r 2 = 0 Plugging in our ray equation we get: P 0 - su - P c 2 - r 2 = 0 Letting ΔP = P 0 - P c, and expanding the magnitude as a square root of a dot product, we get: s 2-2(u.ΔP)s + (ΔP - r 2 ) =0 Solving this gives: s = (u.δp) +/- [(u.δp) 2 - ΔP 2 +r 2 ] 1/2. If the equation under the square root is negative there is no intersection.

Ray-Polyhedron Intersections Usually embed polyhedron in a bounding sphere. First, check the intersection with the bounding sphere, if this fails ignore this polyhedron; otherwise,... Identify front faces of the polyhedron. i.e., those satisfying: u.n <0. For each such face, solve the plane equation: N.P = - D. That is, N.(P 0 + su)= - D. This gives s = -(D + N.P 0 )/ u.n. Finally, do an inside outside check to see if this point is inside or outside of the polygon on the polygons plane.

Reducing Object-Intersection Calculations Surface intersection calculations are the most time expensive component of a ray-tracer. We want to come up with ways to reduce the amount of time we spend on these calculations. One technique is to enclose groups of objects within a bounding object and test intersections with that bounding object. We can also create a hierarchy of such objects.