Ray Tracing Tutorial. Ray Casting One type of visibility algorithm.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
Lecture 14 Illumination II – Global Models
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
 Engineering Graphics & Introductory Design 3D Graphics and Rendering REU Modeling Course – June 13 th 2014.
David Luebke1/19/99 CS 551/651: Advanced Computer Graphics David Luebke
Light Issues in Computer Graphics Presented by Saleema Amershi.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Illumination Model & Surface-rendering Method 박 경 와.
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 TRACING.
Now Playing: Melody Day Caribou from Andorra Released August 21, 2007.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 14: Ray Tracing
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
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.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
An Introduction to Ray Tracing CS /27/1998 Vic Baker.
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.
Project Raytracing. Content Goals Idea of Raytracing Ray Casting – Therory – Practice Raytracing – Theory – Light model – Practice Output images Conclusion.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
1 Dr. Scott Schaefer Ray Tracing. 2/42 Ray Tracing Provides rendering method with  Refraction/Transparent surfaces  Reflective surfaces  Shadows.
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.
Gene Au-yeung, Daniel Quach, Jeffrey Su, Albert Wang, Jessica Wang, David Woo.
1 Ray-Tracing ©Anthony Steed Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!

COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa ( ) Muhammad Zaki Shaheen ( )
Basic Ray Tracing CMSC 435/634.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
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.
Computer Graphics Lecture 08 Fasih ur Rehman. Last Class Ray Tracing.
CS380: Computer Graphics Distributed Ray Tracing TA Course URL:
Ray-tracing.
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.
In the name of God Computer Graphics. Last Time Some techniques for modeling Today Global illumination and raytracing.
Physics.
CS 445 / 645 Introduction to Computer Graphics Lecture 16 Lighting Lighting.
RENDERING : Global Illumination
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
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.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
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.
Ray Tracing I. Reading Hill, Chapter 14, Sections 14.1 to 14.5 Hill, Chapter 14, Sections and
CS552: Computer Graphics Lecture 36: Ray Tracing.
Review Ray Tracing III Review. Pseudo codes RayCast-1  Plain ray caster (direct illumination) RayCast-2  RayCast-1 + shadow rays RayTrace-1  Recursive.
Basic Ray Tracing CMSC 435/634.
RAY TRACING.
(c) 2002 University of Wisconsin
Ray Tracing.
Lighting.
CS5500 Computer Graphics May 29, 2006
GR2 Advanced Computer Graphics AGR
Presentation transcript:

Ray Tracing Tutorial

Ray Casting One type of visibility algorithm

Basic Idea RayCast(Camera, Scene, img_w, img_h) { for (row=0; row < img_h; row++) { for (col=0; col< img_h; col++) { ray = constructRay(camera, row, col); (hit,color)=getIntersection(ray, scene); image[row][col] = color; } return image }

Constructing Primary Rays CoP u n v X min, Y min

Constructing Primary Rays CoP

Constructing Primary Rays CoP

Constructing Primary Rays CoP

Gathering all the info from.dat file Camera specification Viewport Resolution Camera {perspective, orthographic} CoP point lookat point up vector

Visualizing the components CoP Look at point up vector Width (in pixels) Height (in pixels) x_res y_res focal length

Constructing the Orthogonal Basis CoP Look at point up vector u n v n = normalize lookat vector u = n x up v = u x n

Computing Starting Point CoP u n v X, Y Beware of units. Pixels versus world units focal length

Constructing a Primary Ray CoP

Cast Ray Current Pixel Color (0.2,0.8,0.2) due to ambient term

CoP Check for Intersections Current Pixel Color (0.2,0.8,0.2) due to ambient term Beware of near and far clipping planes as well

Some Tips Try the simplest test case you can think of (eg one sphere, and simple camera location) Break Down into steps –Ray Cast in BW with spheres (ensure generation of primary rays is correct) –Shade with Primary Ray contribution. –Try more complex surfaces Normalize, Normalize, Normalize Clamp color [0,1]

CoP Pick Nearest Current Pixel Color (0.2,0.8,0.2) due to ambient term

Computing the Surface Lighting Effect

CoP Connect Light Ray Current Pixel Color (0.2,0.8,0.2) due to ambient term

I R = I R,ambdiff + I R,diffused + I R,specular I G = I G,ambdiff + I G,diffused + I G,specular I B = I B,ambdiff + I B,diffused + I B,specular

I = I ambdiff + I diffused + I specular For example (0.2, 0.8, 0.2) for this material. A constant. Independent of lighting And viewing direction

I = I ambdiff + I diffused + I specular N L I diffused = k d I l (N.L) Compute for all 3 channels. For example (0.1, 0.1, 0.1). Independent of Viewpoint

I = I ambdiff + I diffused + I specular N L I specular = k s I l (V.R) ns Compute for all 3 channels. For example (0.2, 0.2, 0.2). V R

I = I ambdiff + I diffused + I specular = ( 0.2, 0.8, 0.2) + (0.1, 0.1, 0.1) + (0.2, 0.2, 0.2) = (0.5, 1.0, 0.5) Clamp to [0,1]

CoP Current Pixel Color (0.5,1.0,0.5) Connect Light Ray

What about areas in shadow?

CoP Current Pixel Color (0.2,0.8,0.2) due to Ambient term Connect Light Ray

Ray Tracing Physical World : –Photons shoot out from light sources, reflect off surfaces and into the eye. –Problem : Only small fraction reaches the eye (or image plane). Difficult to simulate. Alternative way to simulate : –Reverse the process! –Trace the path backwards i.e from the eye (or pixels) back to the light sources. –Ray Tracing!

We modify the Ray-Casting algorithm to trace rays bouncing off the surfaces.

Outer Loop Select center of projection and window on view plane; For (each scan line in image) { For (each pixel in scan line) { 1) Construct ray from center of projection through pixel 2) pixel = trace(ray,1); }

color trace(RT_ray ray, int depth) { Determine closest intersection of ray with an object if there is an intersection { 1) compute normal at intersection 2) return shade ( closest object hit, ray, intersection, normal, depth ) } Shade will return the cumulative color by recursively calling trace with depth counter decremented at each invocation.

CoP Contribution From Primary Ray (0.5,1.0,0.5)

CoP Contribution From Secondary Ray (0.5,1.0,0.5) V2V2 V1V1 L (0.8,0.8,0.0)

CoP Final Pixel Color (0.5,1.0,0.5) V2V2 V1V1 L (0.8,0.8,0.0) + = ksks

The End