MIT EECS 6.837, Cutler and Durand 1 MIT 6.837 - Ray Tracing.

Slides:



Advertisements
Similar presentations
MIT Ray Tracing MIT EECS 6.837, Cutler and Durand 1.
Advertisements

13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Computer graphics & visualization Global Illumination Effects.
Week 5 - Friday.  What did we talk about last time?  Quaternions  Vertex blending  Morphing  Projections.
Lecture 14 Illumination II – Global Models
Local Reflection Model Jian Huang, CS 594, Fall 2002.
3D Graphics Rendering and Terrain Modeling
Physically Based Illumination Models
Light Issues in Computer Graphics Presented by Saleema Amershi.
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.
Photon Tracing with Arbitrary Materials Patrick Yau.
Computer Graphics (Spring 2008) COMS 4160, Lecture 20: Illumination and Shading 2
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Computer Graphics (Fall 2008) COMS 4160, Lecture 19: Illumination and Shading 2
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Shading / Light Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
12/05/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling Very brief intro to global illumination.
MIT EECS 6.837, Durand and Cutler Local Illumination.
-Global Illumination Techniques
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.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
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.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
Advanced Illumination Models Chapter 7 of “Real-Time Rendering, 3 rd Edition”
Announcements Office hours today 2:30-3:30 Graded midterms will be returned at the end of the class.
04/30/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling We are now all done with modeling, the standard hardware pipeline.
Global Illumination: Radiosity, Photon Mapping & Path Tracing Rama Hoetzlein, 2009 Lecture Notes Cornell University.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Material Representation K. H. Ko School of Mechatronics Gwangju Institute.
CSCE 641 Computer Graphics: Reflection Models Jinxiang Chai.
BRDF models and their use in Global Illumination Algorithms László Szirmay-Kalos.
Monte-Carlo Ray Tracing and
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
In the name of God Computer Graphics. Last Time Some techniques for modeling Today Global illumination and raytracing.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
RENDERING : Global Illumination
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
11/29/01CS 559, Fall 2001 Today Photorealistic rendering Algorithms for producing high-quality images Ways of deciding which algorithm for use.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Light. Intensity calculation = wavelength I( ) = wavelength intensity of light reaching eye I( ) = I diff ( ) + I spec ( ) + I refl ( ) + I trans ( )
CS552: Computer Graphics Lecture 36: Ray Tracing.
Computer Graphics: Illumination
MIT EECS 6.837, Durand and Cutler Transformations & Local Illumination.
Introduction to Ray Tracing Dr. B. Raghu Professor /CSE Sri Ramanujar Engineering College.
Basic Ray Tracing CMSC 435/634.
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Spring 2004
Shading Revisited Some applications are intended to produce pictures that look photorealistic, or close to it The image should look like a photograph A.
(c) 2002 University of Wisconsin
Lighting.
(c) 2002 University of Wisconsin
CS5500 Computer Graphics May 29, 2006
Presentation transcript:

MIT EECS 6.837, Cutler and Durand 1 MIT Ray Tracing

MIT EECS 6.837, Cutler and Durand 2 Tony DeRose - Math in the Movies Tony DeRose: Pixar Animation Studios - Senior Scientist Date: (one week from today!) Time: 1:00 PM - 2:00 PM Location: 32–D449 (Stata Center, Patil/Kiva) Film making is undergoing a digital revolution brought on by advances in areas such as computer technology, computational physics and computer graphics. This talk will provide a behind the scenes look at how fully digital films --- such as Pixar's "Monster's Inc" and "Finding Nemo" --- are made, with particular emphasis on the role that mathematics plays in the revolution.

MIT EECS 6.837, Cutler and Durand 3 Final Exam … has been scheduled Thursday December 16 th, 1:30-3:30pm DuPont Open Book

MIT EECS 6.837, Cutler and Durand 4 Last Week: Transformations Linear, affine and projective transforms Homogeneous coordinates Matrix notation Transformation composition is not commutative

MIT EECS 6.837, Cutler and Durand 5 Last Week: Transformations Transformations in Ray Tracing –Transforming the ray Remember: points & directions transform differently! –Normalizing direction & what to do with t –Normal transformation v WS n WS n WS T = n OS (M -1 )

MIT EECS 6.837, Cutler and Durand 6 Last Time: Local Illumination BRDF – Bidirectional Reflectance Distribution Function Phong Model - Sum of 3 components: –Diffuse Shading –Specular Highlight –Ambient Term Surface

MIT EECS 6.837, Cutler and Durand 7 Phong Examples Shininess coefficient controls the “spread” of the specular highlight Phong Blinn-Torrance (scaled to approximate Phong) diffuse onlyq = 1 q = 128q = 64q = 32 q = 16q = 8q = 4 q = 2diffuse onlyq = 1 q = 128q = 64q = 32 q = 16q = 8q = 4 q = 2

MIT EECS 6.837, Cutler and Durand 8 The Phong Model Parameters –k s : specular reflection coefficient –q : specular reflection exponent Surface l n r Camera v 

MIT EECS 6.837, Cutler and Durand 9 Blinn-Torrance Variation Parameters –k s : specular reflection coefficient –q : specular reflection exponent Surface l Camera v h  Implement this version of Phong (because it’s what OpenGL uses & we want to match) n

MIT EECS 6.837, Cutler and Durand 10 Additional Phong Clamping Term Surfaces facing away from the light should not be lit (if N·L < 0) Scale by dot product to avoid a sharp edge at the light’s grazing angle: specular *= max(N·L,0)

MIT EECS 6.837, Cutler and Durand 11 BRDFs in the Movie Industry For the Matrix movies Agent Smith clothes are CG, with measured BRDF

MIT EECS 6.837, Cutler and Durand 12 How Do We Obtain BRDFs? Gonioreflectometer –4 degrees of freedom Source: Greg Ward

MIT EECS 6.837, Cutler and Durand 13 For the Matrix movies gonioreflectometerMeasured BRDF Test rendering BRDFs in the Movie Industry

MIT EECS 6.837, Cutler and Durand 14 PhotoCGPhotoCG BRDFs in the Movie Industry

MIT EECS 6.837, Cutler and Durand 15 BRDF Models Phenomenological –Phong [75] Blinn [77] –Ward [92] –Lafortune et al. [97] –Ashikhmin et al. [00] Physical –Cook-Torrance [81] –He et al. [91] Roughly increasing computation time

MIT EECS 6.837, Cutler and Durand 16 Fresnel Reflection Increasing specularity near grazing angles. Source: Lafortune et al. 97

MIT EECS 6.837, Cutler and Durand 17 Anisotropic BRDFs Surfaces with strongly oriented microgeometry elements Examples: –brushed metals, –hair, fur, cloth, velvet Source: Westin et.al 92

MIT EECS 6.837, Cutler and Durand 18 Questions?

MIT EECS 6.837, Cutler and Durand 19 Today: Ray Tracing Image by Turner Whitted

MIT EECS 6.837, Cutler and Durand 20 Overview of Today Shadows Reflection Refraction Recursive Ray Tracing

MIT EECS 6.837, Cutler and Durand 21 Ray Casting (a.k.a. Ray Shooting) for every pixel construct a ray for every object intersect ray with object Complexity? O(n * m) n = number of objects, m = number of pixels

MIT EECS 6.837, Cutler and Durand 22 Ray Casting with Phong Shading When you’ve found the closest intersection: color = ambient*hit->getMaterial()->getDiffuseColor() for every light color += hit->getMaterial()->Shade (ray, hit, directionToLight, lightColor) return color Complexity? O(n * m * l) l = number of lights

MIT EECS 6.837, Cutler and Durand 23 Questions? Image computed using the RADIANCE system by Greg Ward

MIT EECS 6.837, Cutler and Durand 24 Overview of Today Shadows Reflection Refraction Recursive Ray Tracing

MIT EECS 6.837, Cutler and Durand 25 color = ambient*hit->getMaterial()->getDiffuseColor() for every light Ray ray2(hitPoint, directionToLight) Hit hit2(distanceToLight, NULL, NULL) For every object object->intersect(ray2, hit2, 0) if (hit2->getT() = distanceToLight) color += hit->getMaterial()->Shade (ray, hit, directionToLight, lightColor) return color How Can We Add Shadows?

MIT EECS 6.837, Cutler and Durand 26 color = ambient*hit->getMaterial()->getDiffuseColor() for every light Ray ray2(hitPoint, directionToLight) Hit hit2(distanceToLight, NULL, NULL) For every object object->intersect(ray2, hit2, 0) if (hit2->getT() = distanceToLight) color += hit->getMaterial()->Shade (ray, hit, directionToLight, lightColor) return color Problem: Self-Shadowing Without epsilonWith epsilon epsilon)

MIT EECS 6.837, Cutler and Durand 27 Shadow Optimization Shadow rays are special: Can we accelerate our code? We only want to know whether there is an intersection, not which one is closest Special routine Object3D::intersectShadowRay() –Stops at first intersection

MIT EECS 6.837, Cutler and Durand 28 Questions? Image Henrik Wann Jensen

MIT EECS 6.837, Cutler and Durand 29 Overview of Today Shadows Reflection Refraction Recursive Ray Tracing

MIT EECS 6.837, Cutler and Durand 30 Mirror Reflection Cast ray symmetric with respect to the normal Multiply by reflection coefficient (color) Don’t forget to add epsilon to the ray Without epsilon With epsilon

MIT EECS 6.837, Cutler and Durand 31 Reflection Reflection angle = view angle R = V – 2 (V · N) N R V  V  R N V NN V NN V

MIT EECS 6.837, Cutler and Durand 32 Amount of Reflection Traditional ray tracing (hack) –Constant reflectionColor More realistic: –Fresnel reflection term (more reflection at grazing angle) –Schlick’s approximation: R(  )=R 0 +(1-R 0 )(1-cos  ) 5 metalDielectric (glass)

MIT EECS 6.837, Cutler and Durand 33 Questions? Image by Henrik Wann Jensen

MIT EECS 6.837, Cutler and Durand 34 Overview of Today Shadows Reflection Refraction Recursive Ray Tracing

MIT EECS 6.837, Cutler and Durand 35 Transparency Cast ray in refracted direction Multiply by transparency coefficient (color)

MIT EECS 6.837, Cutler and Durand 36 Qualitative Refraction From “Color and Light in Nature” by Lynch and Livingston

MIT EECS 6.837, Cutler and Durand 37 Refraction I = N cos Ө i – M sin Ө i M = (N cos Ө i – I) / sin Ө i T = – N cos Ө T + M sin Ө T = – N cos Ө T + (N cos Ө i – I) sin Ө T / sin Ө i = – N cos Ө T + (N cos Ө i – I) η r = [ η r cos Ө i – cos Ө T ] N – η r I = [ η r cos Ө i – √1 – sin 2 Ө T ] N – η r I = [ η r cos Ө i – √1 – η r 2 sin 2 Ө i ] N – η r I = [ η r cos Ө i – √1 – η r 2 (1 – cos 2 Ө i ) ] N – η r I = [ η r (N · I) – √1 – η r 2 (1 – (N · I) 2 ) ] N – η r I I T ӨiӨi ӨTӨT N -N M ηTηT ηiηi Snell-Descartes Law: η i sin Ө i = η T sin Ө T sin Ө T η i = = η r sin Ө i η T Total internal reflection when the square root is imaginary Don’t forget to normalize! N cos Ө i – M sin Ө i

MIT EECS 6.837, Cutler and Durand 38 Make sure you know whether you’re entering or leaving the transmissive material: Note: We won’t ask you to trace rays through intersecting transparent objects Refraction & the Sidedness of Objects T η T = material index η i =1 N T η T = 1 η i = material index N I I

MIT EECS 6.837, Cutler and Durand 39 Total Internal Reflection From “Color and Light in Nature” by Lynch and Livingston

MIT EECS 6.837, Cutler and Durand 40 Cool Refraction Demo Enright, D., Marschner, S. and Fedkiw, R.,

MIT EECS 6.837, Cutler and Durand 41 Cool Refraction Demo Enright, D., Marschner, S. and Fedkiw, R.,

MIT EECS 6.837, Cutler and Durand 42 Refraction and the Lifeguard Problem Running is faster than swimming Beach Person in trouble Lifeguard Water Run Swim

MIT EECS 6.837, Cutler and Durand 43 How does a Rainbow Work? From “Color and Light in Nature” by Lynch and Livingstone

MIT EECS 6.837, Cutler and Durand 44 Wavelength Pittoni, 1725, Allegory to NewtonPink Floyd, The Dark Side of the Moon Refraction is wavelength- dependent –Refraction increases as the wavelength of light decreases –violet and blue experience more bending than orange and red Newton’s experiment Usually ignored in graphics

MIT EECS 6.837, Cutler and Durand 45 Rainbow Refraction depends on wavelength Rainbow is caused by refraction + internal reflection + refraction Maximum for angle around 42 degrees From “Color and Light in Nature” by Lynch and Livingstone

MIT EECS 6.837, Cutler and Durand 46 Questions?

MIT EECS 6.837, Cutler and Durand 47 Overview of Today Shadows Reflection Refraction Recursive Ray Tracing

MIT EECS 6.837, Cutler and Durand 48 Stopping criteria: Recursion depth –Stop after a number of bounces Ray contribution –Stop if reflected / transmitted contribution becomes too small trace ray Intersect all objects color = ambient term For every light cast shadow ray color += local shading term If mirror color += color refl * trace reflected ray If transparent color += color trans * trace transmitted ray Does it ever end? Recap: Ray Tracing

MIT EECS 6.837, Cutler and Durand 49 Recursion For Reflection 1 recursion0 recursion2 recursions

MIT EECS 6.837, Cutler and Durand 50 The Ray Tree R2R2 R1R1 R3R3 L2L2 L1L1 L3L3 N1N1 N2N2 N3N3 T1T1 T3T3 N i surface normal R i reflected ray L i shadow ray T i transmitted (refracted) ray Eye L1L1 T3T3 R3R3 L3L3 L2L2 T1T1 R1R1 R2R2 Complexity?

MIT EECS 6.837, Cutler and Durand 51 Ray Debugging (Assignment 4) Visualize the ray tree for single image pixel incoming reflected ray shadow ray transmitted (refracted) ray

MIT EECS 6.837, Cutler and Durand 52 Does Ray Tracing Simulate Physics? Photons go from the light to the eye, not the other way What we do is backward ray tracing

MIT EECS 6.837, Cutler and Durand 53 Forward Ray Tracing Start from the light source –But low probability to reach the eye What can we do about it? –Always send a ray to the eye…. still not efficient

MIT EECS 6.837, Cutler and Durand 54 Does Ray Tracing Simulate Physics? Ray Tracing is full of dirty tricks For example, shadows of transparent objects: –opaque? –multiply by transparency color? (ignores refraction & does not produce caustics)

MIT EECS 6.837, Cutler and Durand 55 Correct Transparent Shadow Animation by Henrik Wann Jensen Using advanced refraction technique (refraction for illumination is usually not handled that well)

MIT EECS 6.837, Cutler and Durand 56 The Rendering Equation Clean mathematical framework for light- transport simulation We’ll see this later At each point, outgoing light in one direction is the integral of incoming light in all directions multiplied by reflectance property

MIT EECS 6.837, Cutler and Durand 57 A Look Ahead Assignment 2 –Transformations & More Primitives Assignment 3 –OpenGL Pre-Visualization & Phong Shading Assignment 4 –Ray Tracing (Shadows, Reflections, Refractions)

MIT EECS 6.837, Cutler and Durand 58 Next Time Modeling Transformations Illumination (Shading) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display Introduction to the Graphics Pipeline