CSE 681 Ray Tracing Geometry. The Camera Model Based on a simpile pin-hole camera model –Simplest lens model –Pure geometric optics – based on similar.

Slides:



Advertisements
Similar presentations
3D reconstruction.
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Computer vision: models, learning and inference
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Christian Lauterbach COMP 770, 2/11/2009
Chapter 11: Advanced Rendering Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Ray Tracing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of.
Viewing and Projections
Multiple View Geometry Marc Pollefeys University of North Carolina at Chapel Hill Modified by Philippos Mordohai.
Used slides/content with permission from
MSU CSE 803 Stockman Perspective algebra: quick- and-dirty first look Geometry of similar triangles yields algebra for computing world-image transformation.
Now Playing: Melody Day Caribou from Andorra Released August 21, 2007.
CS485/685 Computer Vision Prof. George Bebis
COMP322/S2000/L221 Relationship between part, camera, and robot (cont’d) the inverse perspective transformation which is dependent on the focal length.
CSE 803 Stockman Fall Stereo models Algebraic models for stereo.
The Pinhole Camera Model
Camera Calibration CS485/685 Computer Vision Prof. Bebis.
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
CSE 681 Object Intersection. CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric.
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Now Playing: Quicksand Under Carpet New Radiant Storm King from Leftover Blues: Released 2004.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Introduction to 3D viewing 3D is just like taking a photograph!
Week 13 - Wednesday CS361.
Presentation by Dr. David Cline Oklahoma State University
Computer graphics & visualization Ray-Tracing – A Quick review.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Epipolar geometry The fundamental matrix and the tensor
Course 12 Calibration. 1.Introduction In theoretic discussions, we have assumed: Camera is located at the origin of coordinate system of scene.
1 Ray Casting. CLASS 1 Ray Casting 2 3 Overview of Today Ray Casting Basics Camera and Ray Generation Ray-Plane Intersection.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
1 General Camera ©Anthony Steed Overview n Simple camera is limiting and it is necessary to model a camera that can be moved n We will define.
Geometric Camera Models
Introduction to 3D Graphics Lecture 2: Mathematics of the Simple Camera Anthony Steed University College London.
Alex YAU Important Notes Website for Assignment #2 You.
Basic Ray Tracing CMSC 435/634.
Ray Tracing. 2 Introduction OpenGL is based on a pipeline model in which primitives are rendered one at time ­No shadows (except by tricks or multiple.
1 Mathematics of the Simple Camera. 2 Overview n Simple Camera –Scenes with spheres –COP on +z COP = Centre Of Projection.
CS 376 Introduction to Computer Graphics 04 / 02 / 2007 Instructor: Michael Eckmann.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
CS 480/680 Computer Graphics Compositing and Blending Dr. Frederick C Harris, Jr.
Computer vision: models, learning and inference M Ahad Multiple Cameras
Camera Model Calibration
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
RENDERING : Global Illumination
CSE 681 Brief Review: Vectors. CSE 681 Vectors Basics Normalizing a vector => unit vector Dot product Cross product Reflection vector Parametric form.
Orthonormal Basis Cartesian Coordinate System – Unit vectors: i, j, k – Normalized to each other – Unique representation for each position!! – Convenient!
Ray Tracing I. Reading Hill, Chapter 14, Sections 14.1 to 14.5 Hill, Chapter 14, Sections and
CSE 681 Object Intersection. CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric.
Correspondence and Stereopsis. Introduction Disparity – Informally: difference between two pictures – Allows us to gain a strong sense of depth Stereopsis.
CSE 681 Brief Review: Vectors. CSE 681 Vectors Direction in space Normalizing a vector => unit vector Dot product Cross product Parametric form of a line.
3D Rendering 2016, Fall.
Rendering Pipeline Fall, 2015.
MIT EECS 6.837, Cutler and Durand
VECTORS APPLICATIONS NHAA/IMK/UNIMAP.
Ray Tracing Geometry CSE 681.
Ray Tracing Geometry CSE 681.
Object Intersection CSE 681.
Object Intersection CSE 681.
Orthogonal Base Cartesian Coordinate System Works in general:
Ray Tracing Geometry CSE 681.
Ray Tracing Geometry CSE 681.
Presentation transcript:

CSE 681 Ray Tracing Geometry

The Camera Model Based on a simpile pin-hole camera model –Simplest lens model –Pure geometric optics – based on similar triangles –Perfect image if hole infinitely small –Inverted image CSE 681 pin-hole camera simplified pin-hole camera

Basic Ray Tracing Algorithm for every pixel { cast a ray from the eye through pixel for every object in the scene find intersections with the ray keep it if closest } compute color at the intersection point } CSE 681

Construct a Ray 3D parametric line r(t) = eye + t (p-eye) r(t): ray equation eye: eye (camera) position p: pixel position t: ray parameter CSE 681 eye p r(t) t=0 Question: How to calculate the pixel position P?

What are given? Camera (eye) position View direction or center of interest Camera orientation (which way is up?) –specified by an “up” vector Field of view + aspect ratio Distance to the image plane Pixel resolutions in x and y CSE 681 eye “up” vector ray

CSE 681 Camera Setup u v n View direction “up” vector w We need to have a ‘view coordinate system, i.e., compute the u, v, w vectors u v w w image plane Eye + w goes through the image plane center

CSE 681 Camera Setup u v View direction “up” vector w w: known u = w x “up” v = u x w “up” may not be perpendicular to w x: cross product

CSE 681 Pixel Calculation Coordinate (in u,v,n space) of upper left corner of screen Assume virtual screen is one unit away (D=1) in w direction Eye + w - (xres/2)*PixelWidth*u + (yres/2)*PixelHeight *v u v w xres yres Eye + w

CSE 681 Pixel Calculation Coordinate (in u,v,n space) of upper left corner of screen Assume virtual screen is one unit away (D=1) in w direction Eye + w - (xres/2)*PixelWidth*u + (yres/2)*PixelHeight *v u v w xres yres Eye + w How do we calculate PixelWidth and PixelHeight?

CSE 681 Camera Setup D (yres/2) * pixelHeight Tan(  ) = yres*pixelHeight/2D pixelHeight = 2*Tan(  y /2 ) *D/yres pixelWidth = 2*Tan(  x /2 ) *D/xres

CSE 681 Screen Placement How do images differ if the resolution doesn’t change? Assume virtual screen is one unit away (D=1) in w direction

CSE 681 Pixel Calculation Tan(  ) = yres*pixelHeight/2 pixelHeight = 2*Tan(  y /2 ) /yres pixelWidth = 2*Tan(  x /2 ) /xres Pixel AspectRatio = pixelWidth/pixelHeight Coordinate (in xyz space) of upper left corner of screen = ?

CSE 681 Pixel Calculation Coordinate (in xyz space) of upper left corner of screen = ? Eye + w - (xres/2)*PixelWidth*u + (yres/2)*PixelHeight *v u v w Tan(  ) = yres*pixelHeight/2 pixelHeight = 2*Tan(  y /2 ) /yres pixelWidth = 2*Tan(  x /2 ) /xres

CSE 681 Pixel Calculation Coordinate (in xyz space) of upper left pixel center = ? Eye + w - (xres/2)*PixelWidth*u + (yres/2)*PixelHeight *v + (pixelWidth/2)*u - (pixelHeight/2)*v

CSE 681 Interate through pixel Centers pixelCenter = scanlineStart = Eye + w - (xres/2)*PixelWidth*u + (yres/2)*PixelHeight *v + (pixelWidth/2)*u - (pixelHeight/2)*v pixelCenter += pixelWidth * u scanlineStart -= pixelHeight * v

CSE 681 Pixel loops ScenlineStart = [from previous slide] For each scanline { pixelCenter = scanlineStart For each pixel across { form ray from camera through pixel …. pixelCenter += pixelWidth*u } scanlineStart -= pixelHeight*v }

CSE 681 Process Objects For each pixel { Form ray from eye through pixel distance min = infinity For each object { If (distance=intersect(ray,object)) { If (distance< distance min ) { closestObject = object distance min = distance } Color pixel according to intersection information }

CSE 681 After all objects are tested If (distance min > infinityThreshold) { pixelColor = background color else pixelColor = color of object at distance min along ray d ray eye object

CSE 681 Ray-Sphere Intersection - geometric C r Ray d k s t eye r 2 = k 2 + s 2 t 2 = (k+d) 2 + s 2 d+k = (C-eye) · Ray t= |C-eye| Knowns C, r Eye Ray d = (k+d) - k

CSE 681 Ray-Sphere Intersection - algebraic x 2 + y 2 + z 2 = r 2 P(t) = eye + t*Ray (eye.x+ t *ray.x) 2 + (eye.y+ t *ray.y) 2 + (eye.z+ t *ray.z) 2 = r 2 Expand squared terms and collect terms based on powers of u: A* t 2 + B* t + C = 0 Substitute definition of p into first equation:

Ray-Sphere Intersection (cont’d) CSE 681 For a sphere with its center at c A sphere with center c = (xc,yc,zc) and radius R can be represented as: (x-xc) 2 + (y-yc) 2 + (z-zc) 2 – R 2 = 0 For a point p on the sphere, we can write the above in vector form: (p-c).(p-c) – R 2 = 0 (note ‘.’ is a dot product) Solve p similarly

Quadratic Equation CSE 681 When solving a quadratic equation at 2 + bt + c = 0 Discriminant: And Solution:

Ray-Sphere Intersection CSE 681 b 2 – 4ac <0 : No intersection b 2 – 4ac >0 : Two solutions (enter and exit) b 2 – 4ac = 0 : One solution (ray grazes the sphere)

CSE 681 Determine Color N eye ray Use z-component of normalized normal vector objectColor*N z FOR LAB #1 What’s the normal at a point on the sphere? Clamp to [ ]