Global Illumination. Connelly Barnes CS 4810: Graphics

Similar documents
Indirect Illumination

Indirect Illumination

Ray-Tracing. Misha Kazhdan

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2

Ray Casting. Connelly Barnes CS 4810: Graphics

Illumination. Courtesy of Adam Finkelstein, Princeton University

Modeling Transformations

COMP371 COMPUTER GRAPHICS

Lighting and Reflectance COS 426

Lecture 10: Ray tracing

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Ray Tracing. Kjetil Babington

Illumination. Thomas Funkhouser Princeton University C0S 426, Fall 2000

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

Raytracing & Epsilon. Today. Last Time? Forward Ray Tracing. Does Ray Tracing Simulate Physics? Local Illumination

Recursive Ray Tracing. Ron Goldman Department of Computer Science Rice University

Modeling Transformations

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

Global Illumination. COMP 575/770 Spring 2013

Lighting and Shading

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Ray tracing. EECS 487 March 19,

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

Photorealism: Ray Tracing

Raytracing. COSC 4328/5327 Scott A. King

3D Rendering and Ray Casting

Photon Mapping. Due: 3/24/05, 11:59 PM

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required: Watt, sections , (handout) Further reading:

COMP30019 Graphics and Interaction Ray Tracing

Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Ray Tracing. Local Illumination. Object Space: Global Illumination. Image Space: Backward Ray Tracing. First idea: Forward Ray Tracing

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

Monte-Carlo Ray Tracing. Antialiasing & integration. Global illumination. Why integration? Domains of integration. What else can we integrate?

Illumination Algorithms

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

CS 465 Program 5: Ray II

Lecture 18 of 41. Scene Graphs: Rendering Lab 3b: Shader

קורס גרפיקה ממוחשבת 2010/2009 סמסטר א' Rendering 1 חלק מהשקפים מעובדים משקפים של פרדו דוראנד, טומס פנקהאוסר ודניאל כהן-אור

Lecture 18: Primer on Ray Tracing Techniques

Lecture 19: All Together with Refraction

Ray Tracing. CS116B Chris Pollett Apr 20, 2004.

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required:

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading

SAMPLING AND NOISE. Increasing the number of samples per pixel gives an anti-aliased image which better represents the actual scene.

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

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

Lecture 11: Ray tracing (cont.)

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Animating Transformations

CS-184: Computer Graphics. Administrative

03 RENDERING PART TWO

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Surface Rendering Methods

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

The Rendering Equation & Monte Carlo Ray Tracing

The Rendering Equation. Computer Graphics CMU /15-662

Recall: Basic Ray Tracer

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

CS 4620 Program 4: Ray II

Recap: Refraction. Amount of bending depends on: - angle of incidence - refractive index of medium. (n 2 > n 1 ) n 2

Modeling Transformations

Voxel-Based Global-Illumination

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

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

To Do. Advanced Computer Graphics. Course Outline. Course Outline. Illumination Models. Diffuse Interreflection

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Supplement to Lecture 16

Geometric optics. The University of Texas at Austin CS384G Computer Graphics Don Fussell

Intro to Ray-Tracing & Ray-Surface Acceleration

Accelerating Ray-Scene Intersection Calculations

Ray Casting. Outline in Code. Outline. Finding Ray Direction. Heckbert s Business Card Ray Tracer. Foundations of Computer Graphics (Fall 2012)

Assignment 3: Path tracing

Today. Part 1: Ray casting Part 2: Lighting Part 3: Recursive Ray tracing Part 4: Acceleration Techniques

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

REFLECTION & REFRACTION

Sung-Eui Yoon ( 윤성의 )

Input Nodes. Surface Input. Surface Input Nodal Motion Nodal Displacement Instance Generator Light Flocking

Physics 102: Lecture 17 Reflection and Refraction of Light

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

Ray tracing Tutorial. Lukas Herzberger

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Reflection & refraction

The Rendering Equation and Path Tracing

Lighting affects appearance

CS 428: Fall Introduction to. Raytracing. Andrew Nealen, Rutgers, /18/2009 1

CS 4204 Computer Graphics

Shadows. COMP 575/770 Spring 2013

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

speed of light in vacuum = speed of light in the material

CS 6620 Shading. Steve Parker Peter Shirley

Global Illumination. CSCI 420 Computer Graphics Lecture 18. BRDFs Raytracing and Radiosity Subsurface Scattering Photon Mapping [Ch

LIGHT. Speed of light Law of Reflection Refraction Snell s Law Mirrors Lenses

The Rendering Equation. Computer Graphics CMU /15-662, Fall 2016

Transcription:

Global Illumination Connelly Barnes CS 4810: Graphics Acknowledgment: slides by Jason Lawrence, Misha Kazhdan, Allison Klein, Tom Funkhouser, Adam Finkelstein and David Dobkin

Overview Direct Illumination oemission at light sources odirect light at surface points Global illumination oshadows otransmissions ointer-object reflections

Shadows Shadow term tells if light sources are blocked ocast ray towards each light source L i. If the ray is blocked, do not consider the contribution of the light.

Shadows Shadow term tells if light sources are blocked ocast ray towards each light source L i os i = 0 if ray is blocked, S i = 1 otherwise L 1 L 0 Shadow Term

Shadows Shadow term tells if light sources are blocked ocast ray towards each light source L i os i = 0 if ray is blocked, S i = 1 otherwise L 1 S 0 =1: L 0 contributes L 0 Shadow Term

Shadows Shadow term tells if light sources are blocked ocast ray towards each light source L i os i = 0 if ray is blocked, S i = 1 otherwise L 1 S 0 =1: L 0 contributes S 1 =0: L 1 does not contribute L 0 Shadow Term

Ray Casting Trace primary rays from camera odirect illumination from unblocked lights only

Recursive Ray Tracing Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays

Mirror Reflections Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for mirror reflection ray

Mirror Reflections Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for mirror reflection ray

Mirror Reflections Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for mirror reflection ray

Mirror Reflections Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for mirror reflection ray

Mirror Reflections Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for mirror reflection ray

Mirror Reflections Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays

Transparent Refraction Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for refraction ray

Transparent Refraction Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for refraction ray

Transparent Refraction Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for refraction ray

Transparent Refraction Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for refraction ray

Transparent Refraction Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays L 1 L 0 Radiance for refraction ray

Transparent Refraction Also trace secondary rays from hit surfaces o Consider contributions from: 1. Reflected Rays 2. Refracted Rays

Transparency and Shadow Problem: o If a surface is transparent, then rays to the light source may pass through the object Over-shadowing

Transparency and Shadow Problem: o If a surface is transparent, then rays to the light source may pass through the object o Need to modify the shadow term so that instead of representing a binary (0/1) value, it gives the fraction of light passing through.

Transparency and Shadow Problem: o If a surface is transparent, then rays to the light source may pass through the object o Need to modify the shadow term so that instead of representing a binary (0/1) value, it gives the fraction of light passing through. o Accumulate transparency values as the ray travels to the light source.

Transparency and Shadow Accumulate transparency values as the ray travels to the light source. L 1 S 0 =1: L 0 contributes fully L 0

Transparency and Shadow Accumulate transparency values as the ray travels to the light source. L 1 S 0 =1: L 0 contributes fully S 1 =? L 0

Transparency and Shadow Accumulate transparency values as the ray travels to the light source. L 1 S 0 =1: L 0 contributes fully S 1 =1*K T *? K T L 0

Transparency and Shadow Accumulate transparency values as the ray travels to the light source. L 1 S 0 =1: L 0 contributes fully S 1 =1*K T *K T *? K T L 0

Transparency and Shadow Accumulate transparency values as the ray travels to the light source. L 1 K T S 0 =1: L 0 contributes fully S 1 =1*K T *K T : L 1 contributes partially L 0

Transparency and Shadow Accumulate transparency values as the ray travels to the light source.

Transparent Refraction When a ray of light passes through a transparent object it can bend.

Transparent Refraction When a ray of light passes through a transparent object, the ray of light can bend, (θ i θ r ). N θ i L T θ r

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : N η i θ i L η r T θ r The index of refraction of air is η=1.

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : N η i θ i L η r T θ r

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : L 1 L 0

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : L 1 L 0

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : L 1 L 0

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : L 1 L 0

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r : L 1 L 0

Snell s Law The way that light bends is determined by the indices of refraction of the internal and external materials η i and η r :

Snell s Law and Shadows Problem: o If a surface is transparent, then rays to the light source may not travel in a straight line

Snell s Law and Shadows Problem: o If a surface is transparent, then rays to the light source may not travel in a straight line o This is difficult to address with ray-tracing

General Issue How do we determine when to stop recursing?

General Issue How do we determine when to stop recursing? o Depth of iteration» Bounds the number of times a ray will bounce around the scene o Cut-off value» Ignores contribution from bounces that contribute very little

Putting it all Together Image RayCast(Camera camera, Scene scene, int width, int height) { Image image = new Image(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j); Intersection hit = FindIntersection(ray, scene); image[i][j] = GetColor(scene, ray, hit); } } return image; } Without Illumination

Putting it all Together Image RayCast(Camera camera, Scene scene, int width, int height) { Image image = new Image(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j); Intersection hit = FindIntersection(ray, scene); image[i][j] = GetColor(scene, ray, hit); } } return image; } With Illumination

Putting it all Together Pixel GetColor(scene, ray, depth, cutoff){ Pixel p(0,0,0) Ray reflect, refract Intersection hit=findintersection(ray, scene); if ( hit ){ p += GetSurfaceColor(hit.position); reflect.direction = Reflect( ray.direction, hit.normal) reflect.position = hit.position + reflect.direction*ε if( depth >0 && hit.kspec>cutoff) p += GetColor(scene, reflect, depth-1, cutoff/hit.kspec)*hit.kspec } refract.direction = Refract( ray.direction, hit.normal, hit.ir) refract.position = hit.position + refract.direction*ε if( depth >0 && hit.ktran>cutoff) p += GetColor(scene, refract, depth-1, cutoff/hit.ktran) *hit.ktran } return p

Putting it all Together Pixel GetColor(scene, ray, depth, cutoff){ Pixel p(0,0,0) Ray reflect, refract Intersection hit=findintersection(ray, scene); if ( hit ){ p += GetSurfaceColor(hit.position); reflect.direction = Reflect( ray.direction, hit.normal) reflect.position = hit.position + refract.direction*ε if( depth >0 && hit.kspec>cutoff) p += GetColor(scene, reflect, depth-1, cutoff/hit.kspec)*hit.kspec } refract.direction = Refract( ray.direction, hit.normal, hit.ir) refract.position = hit.position + refract.direction*ε if( depth >0 && hit.ktran>cutoff) p += GetColor(scene, refract, depth-1, cutoff/hit.ktran)*hit.ktran } return p

Putting it all Together Pixel GetColor(scene, ray, depth, cutoff){ Pixel p(0,0,0) Ray reflect, refract Intersection hit=findintersection(ray, scene); if ( hit ){ p += GetSurfaceColor(hit.position); reflect.direction = Reflect( ray.direction, hit.normal) reflect.position = hit.position + reflect.direction *ε if( depth >0 && hit.kspec>cutoff) p += GetColor(scene, reflect, depth-1, cutoff/hit.kspec)*hit.kspec } refract.direction = Refract( ray.direction, hit.normal, hit.ir) refract.position = hit.position + refract.direction*ε if( depth >0 && hit.ktran>cutoff) p += GetColor(scene, refract, depth-1, cutoff/hit.ktran)*hit.ktran } return p

Putting it all Together Pixel GetColor(scene, ray, depth, cutoff){ Pixel p(0,0,0) Ray reflect, refract Intersection hit=findintersection(ray, scene); if ( hit ){ p += GetSurfaceColor(hit.position); reflect.direction = Reflect( ray.direction, hit.normal) reflect.position = hit.position + reflect.direction *ε if( depth >0 && hit.kspec>cutoff) p += GetColor(scene, reflect, depth-1, cutoff/hit.kspec)*hit.kspec } refract.direction = Refract( ray.direction, hit.normal, hit.ir) refract.position = hit.position + refract.direction*ε if( depth >0 && hit.ktran>cutoff) p += GetColor(scene, refract, depth-1, cutoff/hit.ktran)*hit.ktran } return p

Putting it all Together Pixel GetColor(scene, ray, depth, cutoff){ Pixel p(0,0,0) Ray reflect, refract Intersection hit=findintersection(ray, scene); if ( hit ){ p += GetSurfaceColor(hit.position); Why do we need the ε terms? reflect.direction = Reflect( ray.direction, hit.normal) reflect.position = hit.position + reflect.direction *ε if( depth >0 && hit.kspec>cutoff) p += GetColor(scene, reflect, depth-1, cutoff/hit.kspec) } refract.direction = Refract( ray.direction, hit.normal, hit.ir) refract.position = hit.position + refract.direction*ε if( depth >0 && hit.ktran>cutoff) p += GetColor(scene, refract, depth-1, cutoff/hit.ktran) } return p

Putting it all Together Pixel GetColor(scene, ray, depth, cutoff){ Pixel p(0,0,0) Ray reflect, refract Intersection hit=findintersection(ray, scene); if ( hit ){ p += GetSurfaceColor(hit.position); Why do we need the ε terms? reflect.direction = Reflect( ray.direction, hit.normal) reflect.position = hit.position + reflect.direction *ε if( depth >0 && hit.kspec>cutoff) p += GetColor(scene, reflect, depth-1, cutoff/hit.kspec) } } return p refract.direction = Refract( ray.direction, hit.normal, hit.ir) refract.position = hit.position + refract.direction*ε if( depth >0 && hit.ktran>cutoff) p += GetColor(scene, refract, depth-1, cutoff/hit.ktran) To ensure that the new ray does not hit its starting location!

Illumination Examples Ray casting (direct illumination) Courtesy Henrik Wann Jensen

Illumination Examples Soft Shadows Courtesy Henrik Wann Jensen

Illumination Examples Caustics Courtesy Henrik Wann Jensen

Illumination Examples Full Global Illumination Courtesy Henrik Wann Jensen

Recursive Ray Tracing GetColor is a recursive function Image RayTrace(Camera camera, Scene scene, int width, int height int depth, float cutoff){ Image image = new Image(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j); image[i][j] = GetColor(scene, ray, depth, cutoff); } } return image; }

Summary Ray casting (direct Illumination) ousually use simple analytic approximations for light source emission and surface reflectance Recursive ray tracing (global illumination) oincorporate shadows, mirror reflections, and pure refractions All of this is an approximation so that it is practical to compute