Ray Tracing I. Internet Raytracing Competition

Similar documents
Ray Tracing I. History

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

Ray tracing. EECS 487 March 19,

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

3D Rendering and Ray Casting

3D Rendering and Ray Casting

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

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

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

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

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

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

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

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

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

Photorealism: Ray Tracing

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

Intro to Ray-Tracing & Ray-Surface Acceleration

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

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

Recursion and Data Structures in Computer Graphics. Ray Tracing

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

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

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

Lecture 11. More Ray Casting/Tracing

Computer Graphics and Image Processing Ray Tracing I

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

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

Ray Tracing. Outline. Ray Tracing: History

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

Ray casting. Ray casting/ray tracing

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

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

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

Questions??? Announcements Assignment 3 due today

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

Ray Tracer Due date: April 27, 2011

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

Computer Graphics 7: Viewing in 3-D

1999, Denis Zorin. Ray tracing

COMPUTER GRAPHICS AND INTERACTION

COMP371 COMPUTER GRAPHICS

COMPLETION OF Z-buffer Graphics Pipeline

Rendering. Mike Bailey. Rendering.pptx. The Rendering Equation

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Ray scene intersections

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

Rectangular Coordinates in Space

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

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

Sung-Eui Yoon ( 윤성의 )

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

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Lecture 11: Ray tracing (cont.)

these real phenomena because in Computer Graphics we know that we are creating reality.

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

Ray Tracing I: Basics

Geometric Queries for Ray Tracing

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

CS 4204 Computer Graphics

CS770/870 Spring 2017 Ray Tracing Implementation

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

CMSC427 Final Practice v2 Fall 2017

Werner Purgathofer

Ray Tracing. Shandong University

Computer Graphics. - Ray Tracing I - Marcus Magnor Philipp Slusallek. Computer Graphics WS05/06 Ray Tracing I

Topics and things to know about them:

Shading, Advanced Rendering. Week 7, Wed Feb 28

Spatial Data Structures

Illumination Algorithms

Visible Surface Detection Methods

Assignment 2 Ray Tracing

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

Spatial Data Structures

Computer Graphics Viewing

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

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

Simple Nested Dielectrics in Ray Traced Images

Recursive Ray Tracing

light light light B E

Photorealism. Ray Tracing Texture Mapping Radiosity

782 Schedule & Notes

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]

CS384G Midterm Examination Spring 2008

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Spatial Data Structures

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

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

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

Algebra Based Physics

Ray Tracing. CS 4620 Lecture 5

1. What is the law of reflection?

Ray Tracing. Yogitha Golla Indiana State University Terre Haute IN, USA. December 13, Abstract This project is about Ray Tracing Mechanism.

2. Give an example of a non-constant function f(x, y) such that the average value of f over is 0.

Real-Time Ray Tracing Using Nvidia Optix Holger Ludvigsen & Anne C. Elster 2010

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when time is announced or risk not having it accepted.

Transcription:

History Ray Tracing came from the Physics of lens making. The process was that of drawing lines or rays through a glass shape to determine it s lens properties. It is also related to early perspective painting technique of Durer. The ideas of using rays to make computers images was first tried in the early 60 s, but with the computer power of that time was so much slower than other methods that it was considered not to worth the effort. By the early 80 s the computer power had developed and ray tracing was given another try. These images showed promise and lead to the research that has made today's images possible. 1 Internet Raytracing Competition 2 1

Imagery Casey Uhrig Povray Image 7200x10800 6 hours 3 Imagery 4 2

Raytracing Not in hardware Full freedom on what you can do! Simple! As sophisticated as you want Great way to learn graphics concepts 5 Ray Tracing for all pixels (x,y) { for all objects { compare z } } 6 3

Ray tracing uses geometric optics. We can look back at the pin hole camera to see the basics of ray tracing. 7 Ray tracing can also be used to generate parallel view images. In this mode we look from each pixel in the same direction. 8 4

Remember the Camera Models. 9 The Camera Model is used to generate the initial rays. In ray tracing we do not use the Viewing Transformations. The relationship between pixel and initial ray direction is simple for the orthographic camera model. Each ray takes on the X-Y-Z position of the pixel and all rays have the same vector direction, that of the look vector. The relationship between pixel and initial ray direction is more complex for the Perspective camera model. It is a rectangular to polar transformation. 10 5

Pixel Plane FL Look Vector θ Aperture θ = tan-1(aperture/(2*fl)) 11 Forward Ray Tracing Rays emanate from light sources and bounce around Rays that pass through the image plane and enter the eye contribute to the final image 12 6

Forward ray tracing So what is wrong with this forward ray tracing? 13 Backward ray tracing Which rays do contribute to the image? Ray Tracing for all pixels (x,y) { for all objects { compare z } } 14 7

Kinds of rays Primary ray leaves the eye and travels out to the scene When hit - spawn three new rays to collect light shadow ray towards lights reflection ray transparency ray 15 The ray tree so we have a tree. 16 8

Raytracing is recursive I(incident-out) = I(shadow-local-in) + Kr * I(reflection-in) + Kt * I(transparent-in) what is a range of Kr and Kt? Without recursion we have raycasting The core of any ray tracing systems, as well as the bottle neck, is the finding of the intersection points between an object an ray. All ray intersection problems boil down to the mathematical process of finding roots. 18 9

Sphere Intersection The vector is defined as: P origin = P o =[X 0,Y 0,Z 0 ] P direction = P d = [X d,y d,z d ] where P d is normalized. This defines a ray as a set of points on the line P(t) = P o + P d *t, where t >0 19 The sphere is defined as: Sphere center = S c = [X c,y c,z c ] Sphere radius = S r = r There sphere s surface is defined as all points [X s,y s,z s ] in the implicit equation: (X s X c ) 2 + (Ys Y c ) 2 + (Z s Z c ) 2 - S r2 = 0 20 10

The intersection of the sphere and the ray can now be found by placing the ray equation into the sphere equations. X = X 0 + X d *t Y = Y 0 + Y d *t Z = Z 0 + Z d *t 21 Resulting in: (X 0 + X d *t X c ) 2 + (Y 0 + Y d *t Y c ) 2 + (Z 0 + Z d *t Z c ) 2 - S r2 = 0 Simplified this results in: (X d2 + Y d2 + Z d2 )t 2 + 2*( X d *( X 0 X c ) + Y d *( Y 0 Y c ) + Z d *( Z 0 Z c ))*t + ( X 0 X c ) 2 + ( Y 0 Y c ) 2 + ( Z 0 Z c ) 2 - S r2 = 0 22 11

We now solve for t. Note that the above equation is a simple quadratic A*t 2 where A = (X d2 + Y d2 + Y d2 ) + B*t where B = 2*( X d *( X 0 X c ) + Y d *( Y 0 Y c ) + Z d *( Z 0 Z c )) + C = 0 where C = ( X 0 X c ) 2 + ( Y 0 Y c ) 2 + ( Z 0 Z c ) 2 - S r 2 23 Because the direction ray is normalized A is always equal to 1. So the solutions for t can be found by using the quadratic formula: t 0 = (-B - sqrt(b 2-4*C))/2 t 1 = (-B + sqrt(b 2-4*C))/2 24 12

Cones and spheres and such http://www.c-wilkie.pwp.blueyonder.co.uk/index.html 25 Only the real roots show that the ray and sphere intersect. Non-real roots indicate the sphere was missed. Negative values of t are not used and indicate that the ray started in the sphere and only the positive roots are valid. We can then compare t 0 and t 1 to find out which is smaller indicating the point on the sphere that is closer to the ray starting point P o. 26 13

Once we have selected t 0 or t 1 we can then place it back in the ray definition and find the true intersection point in X,Y,Z. P(intersection) = P o + P d *t 0/1 We can then find the sphere s surface normal at this point and other properties needed to render the image. 27 Plane Intersection For the plane use the same definition of the ray. The definition of a plane is: Plane = A*x + B*y + C*z + D = 0 where A 2 + B 2 + C 2 = 1 The unit normal of the Plane defines A, B, C: P normal = P n = [A B C] 28 14

D is defined as the distance from coordinate system origin [0 0 0]. The sign of D determines which side of the plane the system origin is located. Again we substitute the Ray into the plane definition. A *(X 0 + X d *t) + B*(Y 0 + Y d *t) +C*(Z 0 + Z d *t) + D = 0 29 We again solve for t: t = -(A*X 0 + B*Y 0 + C*Z 0 + D) / (A*X d + B*Y d + C*Z d ) We can write this is vector notation: t = -(P n P o +D)/(P n P d ) 30 15

Now we can look at the components of the solution for t and find that we can test for simple things to save time and computations. First lets look at the bottom part: V d = P n P d = (A*X d + B*Y d + C*Z d ) If this is equal to zero then the ray is parallel to the plane and there is no intersection. Even if the ray lays in the plane you can not have an intersection with the edge of a plane. 31 Once again we can put t back into the ray equation and find the intersection point. P(intersection) = P o + P d *t We can then quickly determine if this intersection point is within a four sided polygon by testing min and max X,Y,Z points. These polygons are often used to bound complex shapes and object. The ray tracer would first see if the ray hits the bounding volume before it proceeds to find intersection of the complex objects contained in the volume. 32 16

Constructive Solid Geometry Find intersection along ray with each object that makes up the solid. Follow CSG tree to combine intersection pairs to find the final intersection pair. Example: two spheres t A1, t A2, t B1, t B2 A B 33 References An Introduction to Ray Tracing by Andrew S. Glassner (Editor) Academic Press; ISBN: 0122861604 Ray Tracing Worlds With Pov-Ray Book and 2 Disks by Alexander Enzmann, Lutz Kretzschmar, Chris Young ISBN: 1878739646 Realistic Ray Tracing by Peter Shirley AKPeters Ltd. 2000 34