Lecture 18: Primer on Ray Tracing Techniques

Similar documents
MITOCW MIT6_172_F10_lec18_300k-mp4

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

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

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

COMP371 COMPUTER GRAPHICS

Global Illumination. COMP 575/770 Spring 2013

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

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

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

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

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

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

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

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

Ray Tracing. Kjetil Babington

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

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

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

03 RENDERING PART TWO

Ray Tracing Performance Derby Final Project

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

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

Chapter 11. Caustics and Global Illumination

COMPLETION OF Z-buffer Graphics Pipeline

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

Photorealism: Ray Tracing

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

Lecture 10: Ray tracing

CS 4204 Computer Graphics

Ray tracing. EECS 487 March 19,

Lecture 12: Photon Mapping. Biased Methods

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

Recursion and Data Structures in Computer Graphics. Ray Tracing

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

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

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

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

Ray-Tracing. Misha Kazhdan

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

Raytracing CS148 AS3. Due :59pm PDT

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

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

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

Lecture 7 - Path Tracing

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

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

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

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

Assignment 6: Ray Tracing

Interactive Methods in Scientific Visualization

Lighting and Shading

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee

Assignment 2 Ray Tracing

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

Advanced Graphics. Global Illumination. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

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

THEA RENDER ADAPTIVE BSD ENGINE

CPSC GLOBAL ILLUMINATION

Lighting affects appearance

Volume Illumination, Contouring

Movie: For The Birds. Announcements. Ray Tracing 1. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

REAL-TIME GPU PHOTON MAPPING. 1. Introduction

COMP environment mapping Mar. 12, r = 2n(n v) v

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

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

Computer Graphics Tick 1

CS 465 Program 5: Ray II

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

There are many kinds of surface shaders, from those that affect basic surface color, to ones that apply bitmap textures and displacement.

Photorealistic 3D Rendering for VW in Mobile Devices

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

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Indirect Illumination

Photo Studio Optimizer

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

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Review for Ray-tracing Algorithm and Hardware

521493S Computer Graphics. Exercise 3

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Recent Advances in Monte Carlo Offline Rendering

Intro to Ray-Tracing & Ray-Surface Acceleration

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

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

GLOBAL ILLUMINATION. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION

Sung-Eui Yoon ( 윤성의 )

Interactive Real-Time Raycasting

Luxo Jr. (Pixar, 1986) Last Time. Real Cameras and Ray Tracing. Standard Rasterization. Lights, Cameras, Surfaces. Now Playing:

Computer Graphics Tick 2

Rendering. Mike Bailey. Rendering.pptx. The Rendering Equation

RAY TRACER. Winter 2013 Help Slides

RAYTRACING. Christopher Peters INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION. HPCViz, KTH Royal Institute of Technology, Sweden

The Rendering Equation. Computer Graphics CMU /15-662

Volume Illumination. Visualisation Lecture 11. Taku Komura. Institute for Perception, Action & Behaviour School of Informatics

Ray tracing Tutorial. Lukas Herzberger

EECS 487: Interactive Computer Graphics

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

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

IBL/GI & GLASS. Getting Realistic Results By Yon Resch. The Three Types of GI lighting and Glass

COMPUTER GRAPHICS AND INTERACTION

Transcription:

Lecture 18: Primer on Ray Tracing Techniques 6.172: Performance Engineering of Software Systems Joshua Slocum November 16, 2010

A Little Background Image rendering technique Simulate rays of light - ray casting Capacity for photorealism Embarrassingly parallel Your final project! This photograph is in the public domain, and available here: http://en.wikipedia.org/wiki/file:glasses_800_edit.png.

The Final Project Groups of 2-3 We give you a working ray tracer; you make it go fast Lots of opportunities for optimization Extreme parallelism Algorithmic improvements And others

Two Built-in Scenes./raytracer -s1./raytracer -s2

What You Can't Do Change the parameters defined in config.h We will write over it when testing Compromise the functionality of the raytracer. We may render other scene with your raytracer to make sure it still works properly Change the behavior of the code based on command line arguments

Rendering Model a scene with objects Project the scene onto pixel grid Image Camera Scene

Ray Casting Cast rays from the camera through each pixel Find intersection with the closest object Shade pixel with object's color Image Camera Scene

Ray casting Very little detail Illumination is constant No reflections or refractions

Recursive casting: ray tracing Improved shading technique Recursively cast rays to simulate optical effects: Cast rays at light sources to detect shadows Trace rays to see reflection Trace rays to see refraction Must limit recursion depth Shadow ray Reflected ray Refracted ray

Improved lighting Calculate illumination of diffuse surfaces based on distance from light sources Simulate effects of direct illumination on diffuse materials Cast a shadow ray from intersection point to each light source Amount of illumination based on relative position of light and intersection If a shadow ray intersects an object before reaching the light source, no illumination from that source (e.x. point B)

Soft shadows Shadows from area lights are soft on the edges Solution: cast multiple shadow rays per light source

Optical Effects Reflect rays off of specular (shiny) objects Refract rays through refractive (transparent) objects using Snell's Law

Global illumination Notice the black ceiling and shadows! Diffuse objects don't really absorb all light; they scatter some of it.

Scattering Could use random sampling (Monte Carlo method) Recursively sample multiple reflected rays in random directions Tracing backwards results in exponential search No guarantee that any particular branch will ever reach a light source

More Photon Mapping Like with caustics, but in all directions When photons hit a diffuse surface, some energy is absorbed, and some is reflected Photons bounce until completely absorbed - expensive Remember each bounce in photon map

Hybridized Method Photons will not be evenly distributed unless many are simulated too costly Uneven distribution results in blotchiness Smooth using Monte Carlo Method

The Irradiance Cache Finding indirect illumination is still expensive In some situations, interpolation is likely to be very accurate While rendering, cache results of sampling and interpolate when possible A cached irradiance calculation can be used to interpolate results for nearby points with similar normal vectors. The icache is thus built while rendering occurs.

The Irradiance Cache Green dots are points where samples were cached. Note that caching is most frequent where normal vectors are changing.

Caustics Refractive objects often create patterns of bright and dark by focusing light. Cast rays from light towards refractive objects to simulate the paths of photons Trace rays until they hit a diffuse surface; store hits in a photon map

Rendering With a Photon Map When rendering, the luminance from caustics is based on how many photons are nearby on the photon map

Putting it All Together

Code Overview - Classes SceneObject Inherited by Square, Cube, Sphere, DisplacedSurface Each object has its own ray intersection method Raytracer Contains main Methods for construction of scene space Methods for rendering scene

Code Overview - Classes LightSource Base class SquarePhotonLight Used in both scenes Contains seperate methods for each type of illumination ICache Contains methods for constructing the ICache one sample at a time Use find() to get illuminance at a certain point

Execution (high level) Raytracer::main() { Parse command line args Construct scene to be rendered for each light source: light.tracephotons() //construct global/caustic photon maps Render } Raytracer::render() { for each pixel cast ray: Find nearest intersection computeshading(ray) //cast recursive rays and sum up total illumination }

Execution (high level) SquareLightSource::tracePhotons() { //global illumination while (i< global_num) cast ray in random direction //bounce each ray until it is absorbed while ray power is non-negligible If ray.intersection.mat->isdiffuse() Store intersection in photon map Decrease ray power chance of diffuse reflection in random direction i++ Chance of refraction/reflection/absorption of ray as appropriate for non-diffuse mats }

Execution (high level) SquareLightSource::tracePhotons() { //caustic illumination while (i< caustic_num) cast ray in random direction //bounce each ray until it is absorbed or hits a diffuse mat while(1) If ray.intersection.mat->isdiffuse() Store intersection in photon map I++ break Chance of refraction/reflection/absorption of ray as appropriate for non-diffuse mats }

Resources More in depth explanations of the math and concepts behind ray tracing can be found at: http://www.cs.unc.edu/~rademach/xroads-rt/rtarticle.html (a good introduction to some of the basic concept and math) http://www.codermind.com/articles/raytracer-in-c++-introduction- What-is-ray-tracing.html (also a good introduction, and covers some more advanced concepts, too) http://www.cs.mtu.edu/~shene/publications/2005/photon.pdf (A good explanation of photon mapping, with some nice pictures, too) *Note: there are many different variations of the algorithms used for ray tracing. The implementations found in the final project may differ from those you find in these or other resources.

MIT OpenCourseWare http://ocw.mit.edu 6.172 Performance Engineering of Software Systems Fall 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.