Assignment 3: Path tracing

Similar documents
Lecture 7: Monte Carlo Rendering. MC Advantages

Monte Carlo Ray Tracing. Computer Graphics CMU /15-662

Path Tracing part 2. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

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

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

Part I The Basic Algorithm. Principles of Photon Mapping. A two-pass global illumination method Pass I Computing the photon map

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Lecture 12: Photon Mapping. Biased Methods

Choosing the Right Algorithm & Guiding

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

Realistic Image Synthesis

Stochastic Path Tracing and Image-based lighting

The Rendering Equation. Computer Graphics CMU /15-662

The Rendering Equation Philip Dutré. Course 4. State of the Art in Monte Carlo Global Illumination Sunday, Full Day, 8:30 am - 5:30 pm

Korrigeringar: An introduction to Global Illumination. Global Illumination. Examples of light transport notation light

Motivation. Monte Carlo Path Tracing. Monte Carlo Path Tracing. Monte Carlo Path Tracing. Monte Carlo Path Tracing

Motivation. Advanced Computer Graphics (Fall 2009) CS 283, Lecture 11: Monte Carlo Integration Ravi Ramamoorthi

Monte Carlo Ray-tracing and Rendering

Lecture 7 - Path Tracing

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

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

Advanced Graphics. Path Tracing and Photon Mapping Part 2. Path Tracing and Photon Mapping

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

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

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

The Rendering Equation and Path Tracing

Motivation: Monte Carlo Path Tracing. Sampling and Reconstruction of Visual Appearance. Monte Carlo Path Tracing. Monte Carlo Path Tracing

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

Monte Carlo Integration of The Rendering Equation. Computer Graphics CMU /15-662, Spring 2017

2/1/10. Outline. The Radiance Equation. Light: Flux Equilibrium. Light: Radiant Power. Light: Equation. Radiance. Jan Kautz

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

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

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

Global Illumination and the Rendering Equation

SOME THEORY BEHIND REAL-TIME RENDERING

The Rendering Equation & Monte Carlo Ray Tracing

Global Illumination. COMP 575/770 Spring 2013

Motivation: Monte Carlo Rendering. Sampling and Reconstruction of Visual Appearance. Caustics. Illumination Models. Overview of lecture.

13 Distribution Ray Tracing

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

Project 3 Path Tracing

Overview. Radiometry and Photometry. Foundations of Computer Graphics (Spring 2012)

Realistic Image Synthesis

Biased Monte Carlo Ray Tracing

Schedule. MIT Monte-Carlo Ray Tracing. Radiosity. Review of last week? Limitations of radiosity. Radiosity

Ray-Tracing. Misha Kazhdan

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

Photon Maps. The photon map stores the lighting information on points or photons in 3D space ( on /near 2D surfaces)

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

Precomputed Radiance Transfer: Theory and Practice

Radiance. Radiance properties. Radiance properties. Computer Graphics (Fall 2008)

GAMES Webinar: Rendering Tutorial 2. Monte Carlo Methods. Shuang Zhao

Photon Mapping. Michael Doggett Department of Computer Science Lund university

CS 465 Program 5: Ray II

Photorealism: Ray Tracing

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

INFOMAGR Advanced Graphics. Jacco Bikker - February April Welcome!

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

Local vs. Global Illumination & Radiosity

Ray Tracer Due date: April 27, 2011

COMPUTER GRAPHICS COURSE. LuxRender. Light Transport Foundations

Ray Tracing. Kjetil Babington

Introduction to Radiosity

Lighting and Shading

CS 563 Advanced Topics in Computer Graphics Irradiance Caching and Particle Tracing. by Stephen Kazmierczak

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

MONTE-CARLO PATH TRACING

Monte Carlo Path Tracing. The Rendering Equation

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

TDA361/DIT220 Computer Graphics, January 15 th 2016

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

11/2/2010. In the last lecture. Monte-Carlo Ray Tracing : Path Tracing. Today. Shadow ray towards the light at each vertex. Path Tracing : algorithm

Implementation of Dispersion Rendering Capabilities in the Advanced Rendering Toolkit

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

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

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

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

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

Lecture 10: Ray tracing

Illumination Algorithms

COMP371 COMPUTER GRAPHICS

BRDF Computer Graphics (Spring 2008)

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

CS 4620 Program 4: Ray II

CS5620 Intro to Computer Graphics

Final Project: Real-Time Global Illumination with Radiance Regression Functions

To Shading and Beyond. CS 6965 Fall 2011

Parallel Monte Carlo Sampling Scheme for Sphere and Hemisphere

Global Illumination The Game of Light Transport. Jian Huang

Anti-aliasing and Monte Carlo Path Tracing. Brian Curless CSE 457 Autumn 2017

Lecture 18: Primer on Ray Tracing Techniques

Lights, Surfaces, and Cameras. Light sources emit photons Surfaces reflect & absorb photons Cameras measure photons

Virtual Spherical Lights for Many-Light Rendering of Glossy Scenes

Paths, diffuse interreflections, caching and radiometry. D.A. Forsyth

Rendering Equation & Monte Carlo Path Tracing I

Raytracing. COSC 4328/5327 Scott A. King

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

Glossy Reflection. Objectives Modeling

Transcription:

Assignment 3: Path tracing EDAN30 April 2, 2011 In this assignment you will be asked to extend your ray tracer to support path tracing. In order to pass the assignment you need to complete all tasks. Make sure you can explain your solutions in detail. Verify your result by comparing your images to those in the seminar. 1 Scene setup For this assignment you should use the Cornell scene. Download cornellscene.zip from the course web page. Unzip the files and add them to your project. Use buildcornellscene to build the scene and setupcornellcamera to position the camera. This scene is a variation of the classic Cornell box. It is good for debugging global illumination algorithms due to its visual properties and simple geometry. Task 1: Start by implementing a whitted ray tracer performing jittered supersampling. Make sure your tracer handles direct illumination. You should know this from previous assignments. If a ray does not hit anything, the color returned should be black, i.e., the background color should be black. Task 2: Extend you direct illumination model to attenuate each point light with increasing distance. To this end, calculate the distance, d, between a light and a receiving point and multiply its contribution by 1 d 2. 1

2 Path tracing Path tracing is one of the simplest and most intuitive algorithms for global illumination. This part of the assignment requires you to implement the algorithm, step by step. 2.1 Indirect illumination In real life there is no single light source illuminating the environment. In reality, light bounces off surfaces making each surface a new light source in turn. In order to better approximate the rendering equation, we need to consider this indirect illumination. Indirect illumination can be written as: L indirect (x Θ) = L in (x Ψ)f r (x, Ψ Θ)cos(N x, Ψ) dω Ψ (1) Ω where L in is the incident radiance at x in direction Ψ. This can be approximated using a finite sum of discrete samples: L indirect (x Θ) 1 n n i=1 L in (x Ψ i )f r (x, Ψ i Θ)cos(N x, Ψ i ) p(ψ i ) (2) where Ψ i are samples with probability distribution function (pdf) p(ψ). The incoming radiance in direction Ψ i is the same as the outgoing radiance from the hit point when tracing a ray in that direction. Using the ray casting function, r(x, Ψ), this can be written as: L in (x Ψ) = L(r(x, Ψ) Ψ) (3) Intuitively, to approximate equation (1) we sample the entire hemisphere using rays and treat the illumination at each hit point as a light source. This is a recursive integral, requiring the illumination at each sample point to be recursively evaluated. We could do this by sampling illumination from the environment using more rays at each recursive hit. This is not tractable as we need hundreds of rays 2

at each recursion for good results, each new ray contributing less to the image. In path tracing we stick to a single ray and randomize its path. Given enough rays through each pixel, the result will converge to the correct solution. Task 3: Implement multiple bounces of indirect lighting by tracing recursively in a random direction on the hemisphere. Use russian roulette to terminate the recursion. In order to get good results you need a large number of rays per pixel. Increase your supersampling to at least 100 rays per pixel. In this first implementation you should use uniform samples, i.e., p(ψ) = k, where k is constant. Start by calculating the value of k using the identity: 2π π/2 p(ψ) dω Ψ = 1 p(θ, φ)sin(θ) dθdφ = 1 (4) Ω φ=0 θ=0 The sample directions, Ψ i, should be uniformly sampled using rejection sampling. Proceed by sampling the surroundings using equation (2) recursively. If a ray does not hit anything, the color of the background (black) is used as illumination. 2.2 Cosine weighted sampling In the previous task, the BRDF was multiplied with the geometric term cos(θ). This causes some rays with lower geometric term to contribute less to the resulting image, which reduces the efficiency of the rays. In order to remedy this, we send rays in a cosine weighted direction, allowing each ray to contribute equally. Task 4: Implement cosine weighted importance sampling for better efficiency. Start by setting p(θ, φ) = k cos(θ) and use equation (4) to calculate the constant k. The geometric term can then be eliminated from equation (2) when sampling. In order for this to work, the sample directions, Ψ i, need to be sampled 3

using that pdf. Start by calculating the cumulative distribution function: Separate into: F (θ, φ) = φ θ 0 0 p(θ, φ)sin(θ) dθdφ = φ 2π (1 cos2 (θ)) (5) F θ = 1 cos 2 (θ) F φ = φ 2π Set each separated part to a uniform random number u θ, u φ [0, 1] and solve for θ and φ: θ = cos 1 1 u θ φ = 2πu φ In order to create a direction vector, Ψ i, pointing in the direction of θ and φ, we need a basis around the sample point x with the normal, N x, as z- coordinate axis. Once such a basis is established, the direction in that basis is given by: x = cos(φ)sin(θ) y = sin(φ)sin(θ) z = cos(θ) 2.3 Reflection and refraction Reflection and refraction can be implemented using russian roulette. This is preferred over continuing two rays from the surface; one reflection ray and one refraction ray. It is much more effective to trace a single ray with full contribution to the image, than tracing two less contributing rays. The reflectivity and transparency of the material are used as probabilities for their respective events. If none of these events occur, direct and indirect illumination is performed instead. Task 5: Add a 50% reflective material to ball1 and a 50% refractive material with n = 1.5 to ball2. Implement reflection and refraction using russian roulette. 4

2.4 Area lights Path tracing cannot capture caustics caused by direct illumination from the point light (why?). Task 6: Remove the point light from the scene and add a area light. This can be accomplished by adding a sphere with a emissive material. Use the same location as the point light and set the sphere radius to 20. Set the emissive color of the sphere to (r, g, b) = (10, 10, 10). Observe the caustics from the glass sphere. Task 7: Reduce the sphere radius to 1 and set the color to (r, g, b) = (4000, 4000, 4000). Explain what happens. 2.5 Image based lighting If we have an open scene, many rays end up sampling the background. If a color is assigned to the background, it can be used as light source. Task 8: Remove the area light, the roof and the sides from the scene. Set the background color to (r, g, b) = (1, 1, 1). To get more interesting illumination, a light probe can be used instead of a constant background color. Task 9: Make the ground 50% reflective. Load a light probe using the provided class. Sample it in the direction of the ray to get the background color. Different light probes can be downloaded from the course web page. 5