Ray Tracing Jian Huang, CS 594, Fall, 2002 This set of slides are used at Ohio State by Prof. Roger Crawfis.

Slides:



Advertisements
Similar presentations
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Advertisements

Lecture 14 Illumination II – Global Models
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
Advanced Ray Tracing CMSC 435/634. Basic Ray Tracing For each pixel – Compute ray direction – Find closest surface – For each light Compute direct illumination.
Light Issues in Computer Graphics Presented by Saleema Amershi.
Illumination Model & Surface-rendering Method 박 경 와.
Christian Lauterbach COMP 770, 2/11/2009
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
RAY TRACING.
1 Advanced Ray Tracing Mani Thomas CISC 440/640 Computer Graphics.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
CSC418 Computer Graphics n Raytracing n Shadows n Global Illumination.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
Reflections Specular reflection is the perfect reflection of light from a surface. The law a reflection states that the direction of the incoming ray and.
-Global Illumination Techniques
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Distribution Ray Tracing.
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
1 Dr. Scott Schaefer Ray Tracing. 2/42 Ray Tracing Provides rendering method with  Refraction/Transparent surfaces  Reflective surfaces  Shadows.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
1 Ray-Tracing ©Anthony Steed Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!

Ray Tracer Spring 2008 Help Session. Outline Project Web Resources What do you have to do for this project? Ray Class Isect Class Requirements Tricks.
CSE 681 DISTRIBUTED RAY TRACING some implementation notes.
Ray-tracing.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
CSCE 441: Computer Graphics Ray Tracing
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
RENDERING : Global Illumination
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Distributed Ray Tracing. Can you get this with ray tracing?
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
1cs426-winter-2008 Notes. 2 Atop operation  Image 1 “atop” image 2  Assume independence of sub-pixel structure So for each final pixel, a fraction alpha.
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Distributed Ray Tracing. Can you get this with ray tracing?
CS552: Computer Graphics Lecture 33: Illumination and Shading.
CS552: Computer Graphics Lecture 36: Ray Tracing.
Global Illumination (3) Cone Tracing / Distributed Ray Tracing.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Basic Ray Tracing CMSC 435/634.

Reconstruction For Rendering distribution Effect
Distributed Ray Tracing
© University of Wisconsin, CS559 Fall 2004
(c) 2002 University of Wisconsin
Distributed Ray Tracing
Distributed Ray Tracing
CS5500 Computer Graphics May 29, 2006
CSCE 441: Computer Graphics Ray Tracing
Distributed Ray Tracing
Simple Texture Mapping
Distributed Ray Tracing
Presentation transcript:

Ray Tracing Jian Huang, CS 594, Fall, 2002 This set of slides are used at Ohio State by Prof. Roger Crawfis.

Ray Tracing Y X Z eye screen incident ray world coordinates scene model nearest intersected surface refracted ray reflected ray shadow “feeler” ray

Ray-Tracing Pseudocode For each ray r from eye to pixel, color the pixel the value returned by ray_cast(r): ray_cast(r) { s  nearest_intersected_surface(r); p  point_of_intersection(r, s); u  reflect(r, s, p); v  refract(r, s, p); c  phong(p, s, r) + s.k reflect  ray_cast(u) + s.k refract  ray_cast(v); return(c); }

Pseudocode Explained s  nearest_intersected_surface(r); –Use geometric searching to find the nearest surface s intersected by the ray r p  point_of_intersection(r, s); –Compute p, the point of intersection of ray r with surface s u  reflect(r, s, p); v  refract(r, s, p); –Compute the reflected ray u and the refracted ray v using Snell’s Laws

Reflected and Refracted Rays Reflected and refracted rays are computed using Snell’s Law surface reflected ray incident ray surface normal refracted ray

Pseudocode Explained phong(p, s, r) –Evaluate the Phong reflection model for the ray r at point p on surface s, taking shadowing into account (see next slide) s.k reflect  ray_cast(u) –Multiply the contribution from the reflected ray u by the specular-reflection coefficient k reflect for surface s s.k refract  ray_cast(v) –Multiply the contribution from the refracted ray v by the specular-refraction coefficient k refract for surface s

The Phong Reflection Model Set to 0 if shadow “feeler” ray to light source intersects any scene geometry bisector of eye and light vectors eye light source surface normal

About Those Calls to ray_cast()... The function ray_cast() calls itself recursively There is a potential for infinite recursion –Consider a “hall of mirrors” Solution: limit the depth of recursion –A typical limit is five calls deep –Note that the deeper the recursion, the less the ray’s contribution to the image, so limiting the depth of recursion does not affect the final image much

Pros and Cons of Ray Tracing Advantages of ray tracing –All the advantages of the Phong model –Also handles shadows, reflection, and refraction Disadvantages of ray tracing –Computational expense –No diffuse inter-reflection between surfaces –Not physically accurate Other techniques exist to handle these shortcomings, at even greater expense!

An Aside on Antialiasing Our simple ray tracer produces images with noticeable “jaggies” Jaggies and other unwanted artifacts can be eliminated by antialiasing: –Cast multiple rays through each image pixel –Color the pixel the average ray contribution –An easy solution, but it increases the number of rays, and hence computation time, by an order of magnitude or more

Reflections We normally deal with a perfectly diffuse surface. With ray-tracing, we can easily handle perfect reflections. Phong allows for glossy reflections of the light source.

Reflections If we are reflecting the scene or other objects, rather than the light source, then ray-tracing will only handle perfect mirrors. Jason Bryan, cis782, Ohio State, 2000

Reflections Glossy reflections blur the reflection. Jason Bryan, cis782, Ohio State, 2000

Reflections Mathematically, what does this mean? What is the reflected color?

Glossy Reflections We need to integrate the color over the reflected cone. Weighted by the reflection coefficient in that direction.

Translucency Likewise, for blurred refractions, we need to integrate around the refracted angle.

Translucency

Calculating the integrals How do we calculate these integrals? –Two-dimensional of the angles and ray-depth of the cone. –Unknown function -> the rendered scene. Use Monte-Carlo integration

Shadows Ray tracing casts shadow feelers to a point light source. Many light sources are illuminated over a finite area. The shadows between these are substantially different. Area light sources cast soft shadows –Penumbra –Umbra

Soft Shadows

Umbra Penumbra

Soft Shadows Umbra – No part of the light source is visible. Penumbra – Part of the light source is occluded and part is visible (to a varying degree). Which part? How much? What is the Light Intensity reaching the surface?

Camera Models Up to now, we have used a pinhole camera model. These has everything in focus throughout the scene. The eye and most cameras have a larger lens or aperature.

Depth-of-Field

Depth of Field

Depth-of-Field Details

Motion Blur Integrate (or sample) over the frame time.

Rendering the Scene So, we ask again, what is the color returned for each pixel? What is the reflected color?

Rendering a Scene For each frame –Generate samples in time and average (t): For each Pixel (nxn) –Sample the Camera lens (lxl) Sample the area light source for illumination (sxs) Recursively sample the reflected direction cone (rxr). Recursively sample the refracted direction cone (axa). Total complexity O (p*p*t*l*l*s*s*r*r*a*a)!!!!! Where p is the number of rays cast in the recursion – n 2 primary rays, 3n 2 secondary, … If we super-sample on a fine sub-pixel grid, it gets even worse!!!

Rendering a Scene If we only sample the 2D integrals with a mxm grid, and time with 10 samples, we have a complexity of O (m 9 p 2 ).

Supersampling 1 sample per pixel

Supersampling 16 samples per pixel

Supersampling 256 samples per pixel

Rendering the Scene So, we ask a third time, what is the color returned for each pixel? What is the reflected color?

Rendering the Scene If we were to write this as an integral, each pixel would take the form: Someone try this in Matlab!!!

Rendering the scene So, what does this tell us? Rather than compute a bunch of 2D integrals everywhere, use Monte-Carlo integration to compute this one integral.

Distributed Ray-Tracing Details of how Monte-Carlo integration is used in DRT.