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

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

EECS 487: Interactive Computer Graphics

Sung-Eui Yoon ( 윤성의 )

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Fog and Cloud Effects. Karl Smeltzer Alice Cao John Comstock

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

Ray casting. Ray casting/ray tracing

Lecture 11. More Ray Casting/Tracing

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

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

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

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

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

Supplement to Lecture 16

COMP371 COMPUTER GRAPHICS

Ray Tracing. Kjetil Babington

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

Distribution Ray Tracing

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

Ray tracing. EECS 487 March 19,

CPSC GLOBAL ILLUMINATION

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

Distributed Ray Tracing

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

Shadows. COMP 575/770 Spring 2013

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

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

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

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

Lecture 10: Ray tracing

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

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

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

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. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

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

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

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

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

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

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

Quadric Surfaces. Philippe B. Laval. Spring 2012 KSU. Philippe B. Laval (KSU) Quadric Surfaces Spring /

Quadric Surfaces. Philippe B. Laval. Today KSU. Philippe B. Laval (KSU) Quadric Surfaces Today 1 / 24

CS-184: Computer Graphics. Administrative

3D Rendering and Ray Casting

Ray Tracing I. Internet Raytracing Competition

Computer Graphics Ray Casting. Matthias Teschner

Intro to Ray-Tracing & Ray-Surface Acceleration

Ray Tracing. Johns Hopkins Department of Computer Science Course : Rendering Techniques, Professor: Jonathan Cohen

Photorealism: Ray Tracing

Advanced Ray Tracing

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

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

Computer Graphics and Image Processing Ray Tracing I

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

Ray Tracing. Outline. Ray Tracing: History

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

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

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

Raytracing CS148 AS3. Due :59pm PDT

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

3D Rendering and Ray Casting

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

distribution ray-tracing

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

COMPLETION OF Z-buffer Graphics Pipeline

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

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

Anti-aliasing and Monte Carlo Path Tracing

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

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

Illumination Algorithms

Distributed Ray Tracing

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Werner Purgathofer

A Little Background. Motivation. Motivation

these real phenomena because in Computer Graphics we know that we are creating reality.

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Physically Realistic Ray Tracing

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

distribution ray tracing

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

REFLECTION & REFRACTION

CS 563 Advanced Topics in Computer Graphics Camera Models. by Kevin Kardian

Assignment 6: Ray Tracing

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

Lecture 11: Ray tracing (cont.)

Reading. 8. Distribution Ray Tracing. Required: Watt, sections 10.6,14.8. Further reading:

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

Review for Ray-tracing Algorithm and Hardware

Visible Surface Detection Methods

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

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

Ray Tracer Due date: April 27, 2011

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

Photorealism. Photorealism: Ray Tracing. Ray Tracing

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

Transcription:

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

Ray Casting and Ray Tracing Ray Casting Arthur Appel, started around 1968 Ray Tracing Turner Whitted, started around 1980

Ray Tracing Turner Whitted, Communications of the ACM, 23(6), 343-349, June 1980 ABSTRACT To accurately render a two-dimensional image of a three-dimensional scene, global illumination information that affects the intensity of each pixel of the image must be known at the time the intensity is calculated. In a simplified form, this information is stored in a tree of rays extending from the viewer to the first surface encountered and from there to other surfaces and to the light sources. A visible surface algorithm creates this tree for each pixel of the display and passes it to the shader. The shader then traverses the tree to determine the intensity of the light received by the viewer. Consideration of all of these factors allows the shader to accurately simulate true reflection, shadows, and refraction, as well as the effects simulated by conventional shaders. Anti-aliasing is included as an integral part of the visibility calculations. Surfaces displayed include curved as well as polygonal surfaces.

Ray Tracing Turner Whitted, Communications of the ACM, 23(6), 343-349, June 1980

Ray Casting To cast a ray for each pixel into the scene and color the ray based on which object it hits This can be interpreted as the inverse of the feed-forward graphics pipeline which effectively pushes geometry onto the screen

Ray Tracing In addition to ray-casting, rays can reflect off objects, reflect, refract, identify objects in shadow, and numerous other effects

Ray Tracing In addition to ray-casting, rays can reflect off objects, reflect, refract, identify objects in shadow, and numerous other effects ray trace example using CUDA/GPU programming

Ray Tracing Fluid Animation: https://www.youtube.com/watch?v=3rlbnqaygzs Kepler from NVIDIA https://www.youtube.com/watch?v=h5mrrelxy-w

Ray Tracers POVRay http://www.povray.org RayShade http://wwwgraphics.stanford.edu/~cek/rayshade/rayshade.ht ml

Basic Ray Tracing Algorithm Setup image plane Center-of-projection Field-of-view Define objects Functional descriptions E.g., sphere, box, f(x,y,z)=0 Polygonal descriptions Foreach pixel

Basic Ray Tracing Algorithm Foreach pixel define ray from eye through pixel and into scene get intersection with scene trace reflected ray trace refracted ray trace to-light ray combine resulting colors

Ray tracing Ray tracing (intersection computations) Sphere, plane, polygon, box, quadric Reflections Refractions Shadows (more on the board )

Ray Object Intersections A ray is defined as R 0 = [x 0, y 0, z 0 ] R d = [x d, y d, z d ] - origin of ray - direction of ray Then, a set of points on the ray are defined as R(t) = R 0 + R d * t where t > 0 If R d is normalized, then t equals the distance of the ray from origin in World Coordinates, Slides: Vivek Puri

Ray Sphere Intersection Sphere is defined by its center (S c = [x c, y c, z c ]) and radius S r Thus, the equation of sphere is (x-x c ) 2 + (y-y c ) 2 + (z-z c ) 2 = S r 2 Substitute equation of ray and solve quadratic eqn for t, If discriminant < 0 No intersection If discriminant 0 Intersection. Smaller t gives the nearest intersection point Slides: Vivek Puri

Ray Plane Intersection Plane is defined by Ax+By+Cz+D=0 Substitute the equation for ray and solve for t, t = -(AX 0 + BY 0 + CZ 0 + D) / (AX d + BY d + CZ d ) = -(P n R 0 + D) / (P n R d ) where P n is the plane normal of unit length If P n R d = 0 Ray is parallel to the plane If P n R d > 0 Normal of plane points away from the ray If t < 0 Ray intersects plane behind origin If t > 0 Substitute t in equation for intersection point Slides: Vivek Puri

Ray Polygon Intersection Check whether the ray intersects the polygon plane Calculate the point of intersection Check whether the point is within the polygon. How? Cross products Shoot a ray from the point and count edges crossed, if odd then inside or one of several other approaches Slides: Vivek Puri

Ray Box Intersection Transform box vertices (V i ) to align with the coordinate axes Solve for intersection with x min and x max planes; similarly solve for Y and Z. Check for common interval or intersection If, max (t min ) min (t max ) Then, t 0 = max (t min ) t 1 = min (t max ) Slides: Vivek Puri

Ray Quadric Intersection Class of quadrics (surfaces that can be defined by a quadratic equation) include cylinders, cones, ellipsoids, paraboloids, etc The general quadric surface equation is Ax 2 + By 2 + Cz 2 + Dxy+ Exz + Fyz + Gx + Hy + Iz + J = 0 Substitute the equation of ray, we get the form, A q t 2 + B q t + C q = 0 Solve for t using quadratic formula Slides: Vivek Puri

Ray tracing Ray tracing (intersection computations) Reflections Refractions Shadows (more on the board )

Reflections Similar to what we saw for shading/illumination n Recall θ i = θ r l r = l i 2n(n l i )

Refraction (or Transmission) Need refraction indices: k 1 =outside object (e.g., air) k 2 =inside object (e.g., glass) Snell s Law: k 1 sin θ i = k 2 sin (θ t ) After some rearrangement: l t = ncos θ t + bsin θ t where b = n (n l i ) n

(Hard) Shadows If ray l is unoccluded from surface point to light source, then surface point is illuminated (i.e., not in shadow) Use same recursive raytrace function but cast ray from surface point to light l light

Soft Shadows Lights are actually areas, so use area light sources Using areas enables both umbra and penumbra to appear

Soft Shadows Lights are actually areas, so use use area light sources Distributed Ray Tracing Replace light with a collection of point light sources (e.g., up to 50 rays jittered samples) Example Scene 1 light ray Uniformly sampled light rays 10 light rays 20 light rays 50 light rays

Distributed Ray Tracing Soft shadows (previous slide) Glossy Reflections Fuzzy Transluceny 1 ray 10 rays 20 rays 50 rays Defocus 1 ray 10 rays 20 rays (examples using per-pixel and ray tracing logic)

Depth of Field The area in front of your camera where everything looks sharp and in focus. objects falling within that area will be acceptably-sharp and in focus; objects falling outside the area will be soft and out of focus.

Depth of Field Focal plane sensor aperture

Depth of Field Focal plane sensor aperture

Computer Graphics Camera Models Pinhole ideal camera All rays go through single point Everything in focus -- unrealistic

More Realistic Model Lenses with spherical surfaces Depth of field control

Depth of Field V D D focal plane image plane V P aperture P C A R V P = AP/(P-A) for P>A V D = AD/(D-A) for D>A C = V D -V P (A/V P ) R = 0.5 A ( D-P / P ) =circle of confusion

Depth of Field Example Results

Depth of Field: Out of Focus Blur How to approximate without actually creating an entire physically based rendering system? Basic idea: You want something at distance P to be have its rays converge So think backwards: how can you distort multiple rays per pixel so that they converge at distance P but not otherwise?

Example Real-Time Ray Tracer Large Scale Voxel Renderer using Ray Tracing Efficient Sparse Voxel Octrees, Samuli and Karras, ACM I3D, 2010 Paper = http://www.tml.tkk.fi/~samuli/publications/laine2010i3d_paper.pdf Video = http://www.tml.tkk.fi/~samuli/publications/laine2010i3d_video.avi