Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

Similar documents
Intro to Ray-Tracing & Ray-Surface Acceleration

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

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

Ray Tracing. CS334 Fall Daniel G. Aliaga Department of Computer Science Purdue University

CS 4620 Midterm, March 21, 2017

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson

Viewing and Ray Tracing. CS 4620 Lecture 4

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Ray Tracing: Whence and Whither?

Viewing and Ray Tracing

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

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

Distribution Ray Tracing

Ray Tracing I: Basics

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

Shadows. COMP 575/770 Spring 2013

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Distributed Ray Tracing

Ray tracing idea. Ray Tracing. Ray tracing algorithm. Plane projection in drawing. CS 465 Lecture 3

Photorealism: Ray Tracing

Shadows in the graphics pipeline

Movie: Geri s Game. Announcements. Ray Casting 2. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

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

Ray Tracing. Brian Curless CSEP 557 Fall 2016

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

Ray Tracing. CS 4620 Lecture 5

Last Time. Reading for Today: Graphics Pipeline. Clipping. Rasterization

Sung-Eui Yoon ( 윤성의 )

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

DH2323 DGI13. Lab 2 Raytracing

Computer Graphics. - Ray Tracing I - Marcus Magnor Philipp Slusallek. Computer Graphics WS05/06 Ray Tracing I

3D Viewing. CS 4620 Lecture 8

Topics and things to know about them:

A Little Background. Motivation. Motivation

INFOGR Computer Graphics

CS Computer Graphics: Introduction to Ray Tracing

CS Computer Graphics: Introduction to Ray Tracing

Computer Graphics Ray Casting. Matthias Teschner

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

Ray Tracing. Last Time? Reading for Today. Reading for Today

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

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

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

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

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

Ray Tracing COMP575/COMP770

CPSC GLOBAL ILLUMINATION

CS-184: Computer Graphics. Administrative

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

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

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

CMSC427 Final Practice v2 Fall 2017

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Advanced Shading I: Shadow Rasterization Techniques

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

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

Accelerating Ray-Tracing

Lecture 18: Primer on Ray Tracing Techniques

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

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Assignment 6: Ray Tracing

CS348B Lecture 2 Pat Hanrahan, Spring Greeks: Do light rays proceed from the eye to the light, or from the light to the eye?

CS 130 Exam I. Fall 2015

The Traditional Graphics Pipeline

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

Project 1 Simple Ray Tracer

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

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

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

Pin Hole Cameras & Warp Functions

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

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

INFOGR Computer Graphics. Jacco Bikker - April-July Lecture 3: Ray Tracing (Introduction) Welcome!

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

The Traditional Graphics Pipeline

Ray Tracing. Outline. Ray Tracing: History

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

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

Ray tracing. EECS 487 March 19,

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

Ray-Triangle and Ray-Quadrilateral Intersections in Homogeneous Coordinates

Last Time? Ray Casting. Administrivia: Lab & Office Hours. Notes on Assignments. Ray Casting. Overview of Today

Introduction to Ray-tracing Objectives

Particle systems, collision detection, and ray tracing. Computer Graphics CSE 167 Lecture 17

Distribution Ray Tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

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

Agenda. Ray(tracing(algorithm( Code(structure( Ray(intersec;ons Sphere Triangle Hints Transforma;ons Debugging How(to(start

Transformations in Ray Tracing. MIT EECS 6.837, Durand and Cutler

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

Ray Tracing I. History

CS451Real-time Rendering Pipeline

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

Ray Tracing Part 2. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar

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

Ray tracing Tutorial. Lukas Herzberger

Anti-aliasing and Monte Carlo Path Tracing

The Traditional Graphics Pipeline

Global Illumination. COMP 575/770 Spring 2013

CS 130 Final. Fall 2015

Transcription:

Ray Tracing CPSC 453 Fall 2018 Sonny Chan

Ray Tracing A method for synthesizing images of virtual 3D scenes.

Image Capture Devices Which one shall we use?

Goal: Simulate a Camera Obscura!

Spheres & Checkerboard Turner Whitted, 1979

Whitted Ray Tracing An improved illumination model for shaded display - T. Whitted, SIGGRAPH 1979 512 512 image Rendered on VAX 11/780 74 minutes compute time How fast would your computer render this today? [image courtesy of P. Hanrahan, Stanford University]

The Ray Tracing Algorithm For every pixel or position on your image, do 1. ray generation: where am I looking? 2. ray intersection: do I see something? 3. shading: what colour is it?

Ray Generation

virtual image plane

[from photojojo.com]

Let s see how we might generate those rays

Ray Generation r(t) =e + t(s e)

Ray Intersection What do we see?

Ray Intersection For every object we have in our scene, we need a way to determine whether or not we can see it Usually amounts to solving an equation of one variable We will examine three key intersection tests today: - spheres - planes - triangles

spheres

Ray-Sphere Intersection o A ray: r(t) =o + td d A sphere: Intersection: p c = R (p c) (p c) R 2 =0 (r(t) c) (r(t) c) R 2 =0 (o + td c) (o + td c) R 2 =0 R c Solve for t

planes

Ray-Plane Intersection o A ray: r(t) =o + td d A plane: (p q) ˆn =0 ˆn q Intersection: (r(t) q) ˆn =0 (o + td q) ˆn =0 Solve for t

triangles

How might we test intersection of a ray and a triangle?

Barycentric Coordinates p 2 v (.6,.4, 0) w (.3,.2,.5) p 1 u p 0 f(u, v) =(1 u v)p 0 + up 1 + vp 2

p 2 Another Interpretation A 0 Ratio of (signed) areas of triangles: A = 1 2 (p 1 p 0 ) (p 2 p 0 ) A 1 (.3,.2,.5) A 2 p 1 u = A 1 A v = A 2 A p 0 f(u, v) =(1 u v)p 0 + up 1 + vp 2

A Direct Approach for Intersection A ray: r(t) =o + td A triangle: f(u, v) =(1 u v)p 0 + up 1 + vp 2 Ray-triangle intersect: Rearrange terms: o + td =(1 u v)p 0 + up 1 + vp 2 0 1 @ d p 1 p 0 p 2 p 0 A 0 1 t @ ua = o p 0 v Solve for t, u, and v

Cramer s Rule Given a set of linear equations in matrix form Write the determinant of the matrix 0 1 @a b ca 0 1 x @ ya = d z det(a, b, c) = a 1 b 1 c 1 a 2 b 2 c 2 a 3 b 3 c 3 Then the solutions are x = det(d, b, c) det(a, b, c) y = det(a, d, c) det(a, b, c) z = det(a, b, d) det(a, b, c)

A Direct Approach for Intersection Our equation: 0 1 @ d p 1 p 0 p 2 p 0 A 0 1 t @ ua = o p 0 v Applying Cramer s rule: 0 1 t @ ua = v 1 det( d, e 1, e 2 ) 0 1 det(s, e 1, e 2 ) @ det( d, s, e 2 ) A det( d, e 1, s) where e 1 = p 1 p 0, e 2 = p 2 p 0, s = o p 0 Check that t > 0 and u, v, u+v are within [0,1] interval!

Ray-Object Intersection Tests Now we know how to draw spheres, planes, and triangles in perspective with a ray tracer! What else can we do?

[from photojojo.com]

I think we need some shading What we ve got now and what we really want!

Shadows & More

What happens if we have more than one light?

How do we get these nice, soft shadows?

Depth of Field Can we ray trace it?

object image

The Ray Tracing Algorithm For every pixel position on your image: 1. Generate a parametric viewing ray. 2. Test for intersection against each object in your scene. - What happens if it intersections more than one object? 3. Determine the colour to be carried back on the ray - Trace shadow ray(s) to obtain shadow effect

Things to Remember Ray tracing is a relatively simple way for us to synthesize images of a 3D scene in perspective - simulates the optics of a pinhole camera We need to devise a ray-object intersection for each kind of object geometry in the scene Some effects like shadows are relatively easy to compute Soft shadows and depth of field are possible if you re willing to wait!