Project 3 Path Tracing

Similar documents
Project 4 Ashikhmin-Shirley BRDF

Project 1 Simple Ray Tracer

Distribution Ray-Tracing. Programação 3D Simulação e Jogos

Distributed Ray Tracing

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

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

Global Illumination. COMP 575/770 Spring 2013

CS 465 Program 5: Ray II

Raytracing CS148 AS3. Due :59pm PDT

Assignment 3: Path tracing

CS 4620 Program 4: Ray II

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

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

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

Anti-aliasing and Monte Carlo Path Tracing

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

TDA361/DIT220 Computer Graphics, January 15 th 2016

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

EECS 487: Interactive Computer Graphics

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

COMP371 COMPUTER GRAPHICS

Assignment 6: Ray Tracing

Sung-Eui Yoon ( 윤성의 )

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

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

Distribution Ray Tracing

Choosing the Right Algorithm & Guiding

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

CS5620 Intro to Computer Graphics

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

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

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

Ray Tracer. Spring 2017 Help Session

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Reading. Distribution Ray Tracing. BRDF, revisited. Pixel anti-aliasing. ω in. Required: Shirley, section Further reading:

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

Photorealism: Ray Tracing

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

The Rendering Equation. Computer Graphics CMU /15-662

Local vs. Global Illumination & Radiosity

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

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

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

DH2323 DGI13. Lab 2 Raytracing

Spatial Data Structures. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

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

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

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

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

Lecture 7 - Path Tracing

Homework 3: Shading, Raytracing, and Image Processing

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

In this part of the course, I will discuss various approaches for generating VPLs where they are most needed for a given camera view.

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

MITOCW MIT6_172_F10_lec18_300k-mp4

Shading, lighting, & BRDF Theory. Cliff Lindsay, PHD

Shadows. COMP 575/770 Spring 2013

Ray Tracer Due date: April 27, 2011

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

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

Intro to Ray-Tracing & Ray-Surface Acceleration

COMP371 COMPUTER GRAPHICS

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

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

Ray Tracing. Kjetil Babington

RAY TRACER. Winter 2013 Help Slides

Lecture 12: Photon Mapping. Biased Methods

EDAN30 Photorealistic Computer Graphics. Seminar 1, Whitted Ray Tracing (And then some!) Magnus Andersson, PhD student

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

Topics and things to know about them:

Wednesday, 26 January 2005, 14:OO - 17:OO h.

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

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

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

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

Introduction to 3D Concepts

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

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

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

Advanced Shading I: Shadow Rasterization Techniques

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

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

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

Corona Sky Corona Sun Corona Light Create Camera About

Here I ll present a brief summary of the important aspects and then dive into improvements we made on Black Ops II.

Lecture 18: Primer on Ray Tracing Techniques

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

REAL-TIME GPU PHOTON MAPPING. 1. Introduction

03 RENDERING PART TWO

CS-184: Computer Graphics. Administrative

Other Rendering Techniques CSE 872 Fall Intro You have seen Scanline converter (+z-buffer) Painter s algorithm Radiosity CSE 872 Fall

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

CSE 167: Introduction to Computer Graphics Lecture #7: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Ray-Tracing. Misha Kazhdan

Transcription:

Project 3 Path Tracing CSE 168: Rendering Algorithms, Spring 2017 Description Add antialiasing and path tracing of diffuse surfaces and Fresnel metals to your renderer. Project 3 is due by 5:00 pm, Wednesday May 10, 2017. Antialiasing For the antialiasing, the Camera should have three additional functions: SetSuperSample(int xsamples,int ysamples); // Supersample each pixel in a x*y grid SetJitter(bool enable); // Enable/disable jittering of each supersample SetShirley(bool enable); // Enable/disable Shirley mapping All three of these functions should work in any combination, i.e., for each pixel, you will do a loop like this: for(each supersample) { Compute subpixel position (0 1 range in x & y) If(EnableJitter) Apply jitter to subpixel position If(EnableShirley) Apply Shirley mapping to subpixel position Turn subpixel position into pixel position & trace path } FinalColor = average of all path colors Path Tracing To implement path tracing, I d suggest by starting with implementing a Material base class if you haven t already. You will need derived materials for LambertMaterial and FresnelMetalMaterial. I suggest adding a virtual function to the Material class: virtual void GenerateSample(const Intersection &isect,const glm::vec3 &indir,glm::vec3 &outdir,color &outcolor); The generate sample function takes an incoming Intersection class (to provide the surface position & normal) and an incoming beam direction (indir) and produce a randomly distributed output direction (outdir) as well as an output color (outcolor). For the Fresnel metal, for example, the generated sample

direction would simply be a reflection across the surface normal, and the color would compute the Fresnel equations for the given angles. For the diffuse Lambert material, the GenerateSample() function would generate a cosine-weighted hemispherical direction, distributed around the surface normal. The output color would just be the (constant) color of the material. To compute the shaded color from a path, we shoot the first ray of the path into the scene from the camera. When we hit a surface, we compute the color reflected back along the path as the sum of the direct illumination and the indirect illumination on that surface. If no surface is hit, then we just use the sky color. To estimate the direct illumination, you can loop through all lights and sum up the direct illumination as in project 2 by tracing one shadow ray to each light. Optionally, you can generate a single shadow ray to one randomly selected light, selected according to a distribution weighted by the potential intensity of the light. The resulting illumination is then scaled by 1/prob, where prob is the probability of selecting the light that was chosen. To compute the indirect light, we generate a single reflected sample by calling the GenerateSample() function on the material the ray hit. We then trace a new ray in that direction to extend the path, which may recursively repeat the process up to some desired path length. The shaded color returned from that ray is scaled by the outcolor from the material and added to the direct illumination, and finally returned as the total color. To terminate the paths, you can either choose a fixed path length (maybe around 5), or you can use the Russian Roulette algorithm as presented in the slides. Grading This project is worth 15 points: - Path tracing diffuse surfaces 5 - Path tracing Fresnel metals 5 - Antialiasing 5 - Total 15

Sample Image Project 3 should generate the following image (this used 10x10 paths per pixel, with up to 10 bounces): Project 3 Function Project 3 should be able to be run with the following sample code (or something very similar): void project3() { // Create scene Scene scn; scn.setskycolor(color(0.8f,0.9f,1.0f)); // Create ground LambertMaterial groundmtl; groundmtl.setcolor(color(0.25f,0.25f,0.25f)); MeshObject ground; ground.makebox(2.0f,0.11f,2.0f,&groundmtl); scn.addobject(ground); // Load dragon mesh

MeshObject dragon; dragon.loadply("dragon.ply"); // Create box tree BoxTreeObject tree; tree.construct(dragon); // Materials LambertMaterial white; white.setcolor(color(0.7f,0.7f,0.7f)); LambertMaterial red; red.setcolor(color(0.7f,0.1f,0.1f)); MetalMaterial metal; metal.setcolor(color(0.95f,0.64f,0.54f)); const int numdragons=4; Material *mtl[numdragons]={&white,&metal,&red,&white}; // Create dragon instances glm::mat4 mtx; for(int i=0;i<numdragons;i++) { InstanceObject *inst=new InstanceObject(tree); mtx[3]=glm::vec4(0.0f,0.0f,0.3f*(float(i)/float(numdragons-1)-0.5f),1.0f); inst->setmatrix(mtx); inst->setmaterial(mtl[i]); scn.addobject(*inst); } // Create lights DirectLight sunlgt; sunlgt.setbasecolor(color(1.0f, 1.0f, 0.9f)); sunlgt.setintensity(1.0f); sunlgt.setdirection(glm::vec3(2.0f, -3.0f, -2.0f)); scn.addlight(sunlgt); // Create camera Camera cam; cam.setresolution(640,480); cam.setaspect(1.33f); cam.lookat(glm::vec3(-0.5f,0.25f,-0.2f),glm::vec3(0.0f,0.15f,0.0f)); cam.setfov(40.0f); cam.setsupersample(10,10); cam.setjitter(true); cam.setshirley(true); } // Render image cam.render(scn); cam.savebitmap("project3.bmp");

Notes Instanced Materials Notice the addition of the InstanceObject::SetMaterial() function. This is intended to allow instances to override the material of the objects they instance. To implement this, add a Material* to InstanceObject that defaults to null. In the Intersect() function, after an intersection is detected, it should set the hit.mtl pointer to the instance material if it is non-null. If it is null, it should leave the hit.mtl alone as it will be set to the individual triangle material. Noise To speed up testing, you can render with a lower sampling rate, such as 2x2. In this case, the rendering will have a lot of noise but should only take a few seconds rather than a couple minutes at 10x10. This is how the image would look with only 2x2 samples:

Extra Credit For 1 extra credit point total, you must do all of the following: - Finite camera aperture (depth of field) - Motion blur (initial and final matrix settable in InstanceObject) [sample picture coming soon]