Now Playing: Quicksand Under Carpet New Radiant Storm King from Leftover Blues: 1991-2003 Released 2004.

Slides:



Advertisements
Similar presentations
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Advertisements

Graphics Pipeline.
3D Graphics Rendering and Terrain Modeling
Eyes for Relighting Extracting environment maps for use in integrating and relighting scenes (Noshino and Nayar)
Light Issues in Computer Graphics Presented by Saleema Amershi.
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Ray Tracing Tutorial. Ray Casting One type of visibility algorithm.
Christian Lauterbach COMP 770, 2/11/2009
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Now Playing: Melody Day Caribou from Andorra Released August 21, 2007.
CS485/685 Computer Vision Prof. George Bebis
Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
Now Playing: Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Now Playing: Gong Sigur Rós From Takk... Released September 13, 2005.
Ray Tracing Outline For each pixel { Shoot ray r from eye to center of pixel with trace( r ) } function trace( r ) For each object { Find object with closest.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
The Pinhole Camera Model
CS 376 Introduction to Computer Graphics 04 / 06 / 2007 Instructor: Michael Eckmann.
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.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
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.
Presentation by Dr. David Cline Oklahoma State University
Computer graphics & visualization Ray-Tracing – A Quick review.
COMP 175: Computer Graphics March 24, 2015
Viewing and Projections
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
CS 325 Introduction to Computer Graphics 02 / 17 / 2010 Instructor: Michael Eckmann.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS Lecture 4, September 17 th 2002.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Computer Graphics Zhen Jiang West Chester University.
Basic Ray Tracing CMSC 435/634.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Computer Graphics Lecture 08 Fasih ur Rehman. Last Class Ray Tracing.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
A Photograph of two papers
RENDERING : Global Illumination
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
RAYTRACER PART I OF II.  Loosely based on the way we perceive the world around us (visually)  A (near) infinite number of photons are emitted by a light.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
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
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Basic Ray Tracing CMSC 435/634.
Rendering Pipeline Fall, 2015.
Photorealistic Rendering vs. Interactive 3D Graphics
CSCE 441 Computer Graphics 3-D Viewing
3D Graphics Rendering PPT By Ricardo Veguilla.
CS451Real-time Rendering Pipeline
© University of Wisconsin, CS559 Fall 2004
A Photograph of two papers
Chapter V Vertex Processing
Image synthesis using classical optics
Orthogonal Base Cartesian Coordinate System Works in general:
Presentation transcript:

Now Playing: Quicksand Under Carpet New Radiant Storm King from Leftover Blues: Released 2004

Movie: Geri’s Game Pixar, 1997 Academny Award Winner, Best Short Film

Ray Casting 2 Rick Skarbez, Instructor COMP 575 October 30, 2007

Announcements Programming Assignment 3 (Rasterization) is out Due Saturday, November 3 by 11:59pm If you do hand in by Thursday midnight, +10 bonus points Remember that you need to talk to me about your final project Send an to schedule a meeting, or come by office hours

Programming 2 Recap Spherical Coordinates Demo on board Per-Vertex Normals Demo on board

Programming 3 Info Test data for part 1 (Lines) is available As C/C++ array, or just as a text file In both cases, each line has 7 parameters (x 1, y 1, x 2, y 2, R, G, B) This data set anticipates a 512x512 window To read the array (line.data), use something like the following code:

Programming 3 Info For parts 2 and 3, the program should respond to user input Can do this several ways Accept coordinates as command line input Prompt for user input while running Allow user to click and choose points (like polygon creation in assignment 1

Programming 3 Info For part 3 (line clipping), should display a window bigger than the clip window i.e. Viewport Clip against this

Last Time Derived the math for ray casting Intersecting rays and objects Generating rays aka generating a camera matrix Coloring pixels Phong shading for each ray

Today Extending some of the ideas from last time Briefly discussing the software architecture of a raycaster Optional course feedback survey

for each pixel / subpixel shoot a ray into the scene find nearest object the ray intersects if surface is (nonreflecting OR light) color the pixel else calculate new ray direction recurse Ray-Tracing Algorithm

for each pixel / subpixel shoot a ray into the scene find nearest object the ray intersects if surface is (nonreflecting OR light) color the pixel else calculate new ray direction recurse Ray-Tracing Algorithm Ray Casting

Generating an Image 1. Generate the rays from the eye One (or more) for each pixel 2. Figure out if those rays “see” anything Compute ray-object intersections 3. Determine the color seen by the ray Compute object-light interactions

Computing Ray- Object Intersections If a ray intersects an object, want to know the value of t where the intersection occurs: t < 0: Intersection is behing the ray, ignore it t = 0: Undefined t > 0: Good intersection If there are multiple intersections, we want the one with the smallest t This will be the closest surface r(t) = p + td

Generating Rays Now, given a ray, we know how to test if it intersects an object But we don’t yet know how to generate the rays We talked a bit about lenses last time, but an ideal pinhole camera is still the simplest model So let’s assume that

Generating Rays Recall the pinhole camera model Every point p in the image is imaged through the center of projection C onto the image plane Note that this means every point in the scene maps to a ray, originating at C That is, r(t) = C + tV C is the same for every ray, so just need to compute new Vs

Generating Rays in 2D Eye Once we know this ray, the rest are easy This is referred to as a “Pencil of Rays”

Generating Rays in 3D Eye +x +y +z D v = D u = V0V0 DvDv DuDu V 0 =

Generating Rays in 3D D u = D v = V 0 =V i,j = [D u D v V 0 ]

A Basic 3D Camera Matrix Assumes: Camera on the z-axis Looking down -z Ideal pinhole model Fixed focal length (focal length = 1)

Determining Color Since we’re not yet talking about tracing rays Really just talking about OpenGL-style lighting and shading Since surfaces are implicitly defined, can solve Phong lighting equation at every intersection

Doing it Better We now know how to generate a simple raycasted image However, we’ve assumed only a very simple/limited camera definition Now we’re going to extend our notion of cameras

Camera Intrinsics and Extrinsics We normally divide camera properties into two classes: intrinsic and extrinsic Intrinsic properties are those belonging to the camera itself Intrinsic properties are inside the camera Extrinsic properties define how the camera is situated in the world

Camera Intrinsics These describe the behavior of the camera Focal length Aspect ratio Resolution Aperture Shutter speed etc.

Camera Extrinsics These locate and orient the camera in the world Camera position Camera orientation

Camera Extrinsics These are easy to describe Camera position 3D point Camera orientation 2 3D vectors LookAt vector Up vector

Camera Orientation So why do we need two vectors after all? Why not just a look vector? LookAt vector describes which way the camera is pointed But not where the top of the film is That’s what the up vector gives us

Building a Frustum Let’s take a step back: What are we trying to do? Want to build a camera matrix that will generate our rays

Building a Frustum That’s what we want Here’s what we have to work with: Field of view Resolution (vertical & horizontal) Gets us aspect ratio Eye point & center point Gets us look vector Up vector θ vRes, hRes eye, center Up

Building a Frustum So, we have: θ, hRes, vRes, eye, center, Up Want to use these to compute D u, D v, V 0 These three vectors define the image plane Ey e V0V0 DvDv DuDu

The “Right” Vector Need a vector that points in the “D u direction” Any ideas? Cross the look vector and the up vector D u = LookAt x Up +x +y +z LookAt Up DuDu Note that LookAt and Up should be unit vectors

Finding D u So now we have a vector that points in the correct direction But we originally said that D u was one pixel width long If LookAt and Up are unit vectors, D u now has length 1 Too long We’ll need to rescale our vectors

The “Down” Vector We also need a vector in the D v direction That is, we need a vector perpendicular to D u and LookAt Could we just use -Up? Not necessarily We have not required Up to be perpendicular to LookAt

Finding D v So how to we find a vector perpendicular to two other vectors Cross product D v = LookAt x D u +x +y +z LookAt DuDu DvDv Note that if LookAt and Up are both unit vectors, then D u and D v are also unit vectors

Finding V 0 So now we have 2 out of our 3 vectors Need to find the “origin” vector

Finding V 0 Eye +x +y +z V0V0 DvDv DuDu ✓ ✓ ? LookAt -Du-Du hRes 2 -Dv-Dv vRes 2 1 -Du-Du hRes 2 -Dv-Dv vRes 2 1

Focal Length Remember this equation? We want to know how far along the LookAt vector the image plane lies Before, we assumed it was 1, so the distance from the center of the image to the left edge was just tan (θ/2) Now it is hRes/2 Distance to film Focal Length Distance to scene

Complete Frustum Specification Given Points: Given Unit Vector: Given FOV Angle: Given Dimensions: NOTE: Normalize D u and D v ! NOTE: Normalize D u and D v ! D u = LookAt x Up D v = LookAt x D u eye, center θ vRes, hRes Up LookAt = ||center - eye|| center - eye

Raycaster System Overview For Each Pixel Camera Ray Generates Linked List of Objects Sphere Plane Etc. App Camera Matrix Test For Closest Sphere Closest Object Linked List of Materials Material #1 Material #2 Linked List of Lights Ambient #1 Point #1 Point #2 Shade() Material #2 Shade() Surface Material Illuminated By Pixel Color

Next Time Figuring out what raycasting/raytracing really buys us over OpenGL Shadows Reflection Refraction i.e. Real Ray Tracing

Course Feedback Survey