Ray Tracing I. History

Similar documents
Ray Tracing I. Internet Raytracing Competition

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

3D Rendering and Ray Casting

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

Rectangular Coordinates in Space

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

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

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

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

Lecture 11. More Ray Casting/Tracing

CS770/870 Spring 2017 Ray Tracing Implementation

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

Geometric Queries for Ray Tracing

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?

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

1999, Denis Zorin. Ray tracing

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

Ray casting. Ray casting/ray tracing

Computer Graphics and Image Processing Ray Tracing I

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

Intro to Ray-Tracing & Ray-Surface Acceleration

Computer Graphics Viewing

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]

1.5 Equations of Lines and Planes in 3-D

Spatial Data Structures

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

Computer Graphics 7: Viewing in 3-D

Intersecting Simple Surfaces. Dr. Scott Schaefer

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

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

Spatial Data Structures

Ray Tracing I: Basics

Ray Tracing. Shandong University

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

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

ECE-161C Cameras. Nuno Vasconcelos ECE Department, UCSD

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

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

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

Spatial Data Structures

Topics and things to know about them:

Polygon Meshes and Implicit Surfaces

Polygon Meshes and Implicit Surfaces

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

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

CMSC427 Final Practice v2 Fall 2017

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

Ray Tracing. CS 4620 Lecture 5

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

9. Visible-Surface Detection Methods

QUIZ 4 (CHAPTER 17) SOLUTIONS MATH 252 FALL 2008 KUNIYUKI SCORED OUT OF 125 POINTS MULTIPLIED BY % POSSIBLE

Werner Purgathofer

FIND RECTANGULAR COORDINATES FROM POLAR COORDINATES CALCULATOR

11/1/13. Polygon Meshes and Implicit Surfaces. Shape Representations. Polygon Models in OpenGL. Modeling Complex Shapes

Computer Graphics: Viewing in 3-D. Course Website:

Ray Tracer Due date: April 27, 2011

Three-Dimensional Coordinate Systems

Properties of Quadratic functions

1.5 Equations of Lines and Planes in 3-D

Lecture 11: Ray tracing (cont.)

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

Introduction to Mathematica and Graphing in 3-Space

Efficient Lipschitz function evaluation for CSG implicit surfaces

Section 7.2 Volume: The Disk Method

Chapter 23. Geometrical Optics (lecture 1: mirrors) Dr. Armen Kocharian

COMPUTER GRAPHICS AND INTERACTION

Ray Tracing. Outline. Ray Tracing: History

CS 4620 Midterm, March 21, 2017

Graphics (INFOGR ): Example Exam

521493S Computer Graphics Exercise 1 (Chapters 1-3)

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

CS4670: Computer Vision

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

Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Computer Graphics Ray Casting. Matthias Teschner

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

Moore Catholic High School Math Department

Contents. MATH 32B-2 (18W) (L) G. Liu / (TA) A. Zhou Calculus of Several Variables. 1 Homework 1 - Solutions 3. 2 Homework 2 - Solutions 13

The Three Dimensional Coordinate System

8.1 Geometric Queries for Ray Tracing

Visible Surface Detection Methods

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

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

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

Scene Modeling for a Single View

9.5 Polar Coordinates. Copyright Cengage Learning. All rights reserved.

782 Schedule & Notes

AP Physics: Curved Mirrors and Lenses

Math 113 Calculus III Final Exam Practice Problems Spring 2003

ü 12.1 Vectors Students should read Sections of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

Introduction to Computer Graphics. Modeling (3) April 27, 2017 Kenshi Takayama

CS 130 Exam I. Fall 2015

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 Ray Tracing for all pixels (x,y) { for all objects { compare z } } 2 1

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

Remember the Camera Models. 5 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. 6 3

Pixel Plane FL Look Vector? Aperture? = tan-1(aperture/(2*fl)) 7 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. 8 4

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 9 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 r 2 = 0 10 5

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 11 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 r 2 = 0 Simplified this results in: (X d 2 + Y d 2 + Z d 2 )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 r 2 = 0 12 6

We now solve for t. Note that the above equation is a simple quadratic A*t 2 where A = (X d 2 + Y d 2 + Y d 2 ) + 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 13 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 14 7

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. 15 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. 16 8

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] 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 18 9

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 ) 19 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. 20 10

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. 21 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. 22 11

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 23 12