I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 1/42 Raytracing Basics Part 2 of 2.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

SI31 Advanced Computer Graphics AGR
13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
Rendering and Techniques
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Lecture 14 Illumination II – Global Models
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
David Luebke1/19/99 CS 551/651: Advanced Computer Graphics David Luebke
Light Issues in Computer Graphics Presented by Saleema Amershi.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Illumination Model & Surface-rendering Method 박 경 와.
Course Website: Computer Graphics 18: Ray-tracing.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Alla Sheffer Advanced Rendering Week.
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
RAY TRACING.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Admission to CS 184 Enrollment priorities are 1. CS/EECS majors, 2. CS/EECS minors (this category includes applied math majors) 3. anyone else with a declared.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
MSU CSE 803 Fall 2008 Stockman1 CV: 3D sensing and calibration Coordinate system changes; perspective transformation; Stereo and structured light.
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Advanced Rendering University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 1/42 Lecture 28 of 42 Raytracing 2 of.
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.
12/05/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling Very brief intro to global illumination.
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.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
-Global Illumination Techniques
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
1 Dr. Scott Schaefer Ray Tracing. 2/42 Ray Tracing Provides rendering method with  Refraction/Transparent surfaces  Reflective surfaces  Shadows.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 1/42 Raytracing Basics.
1 Ray-Tracing ©Anthony Steed Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!
Introduction to Radiosity Geometry Group Discussion Session Jiajian (John) Chen 9/10/2007.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
1 of 50 CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 27, 2015 Ray Tracing Rendering and Techniques Images: (Left)
Ray-tracing.
CS 376 Introduction to Computer Graphics 04 / 02 / 2007 Instructor: Michael Eckmann.
Ray Tracing 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.
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.
Computing & Information Sciences Kansas State University Lecture 38 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 38 of 42 Wednesday, 30.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 18 / 2007 Instructor: Michael Eckmann.
© University of Wisconsin, CS559 Spring 2004
© University of Wisconsin, CS559 Fall 2004
Path Tracing (some material from University of Wisconsin)
Lecture 11: Recursive Ray Tracer
Lighting.
Illumination and Shading
CSCE 441: Computer Graphics Ray Tracing
GR2 Advanced Computer Graphics AGR
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to Ray Tracing
Presentation transcript:

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 1/42 Raytracing Basics Part 2 of 2

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 25/42 Normal Vectors at Intersection For illumination we need to find a way, given a point on the object in object-space, to determine the normal vector to the object at that point so that we can calculate angles between the normal and other vectors If a surface bounds a solid whose interior is given by then we can find the normal vector at a point(x, y, z) via the gradient at that point: Recall that the gradient is a vector with three components: Normal vector to implicit surfaces Points (1/4)

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 26/42 Normal Vectors at Intersection Sphere normal vector example Points (2/4) For the sphere, the equation is The partial derivatives are So the gradient is Normalize n before using in dot products! In some degenerate cases, the gradient may be zero, and this method fails…use nearby gradient as a cheap hack

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 27/42 Normal Vectors at Intersection Transforming back to world-space Points (3/4) We have an object-space normal vector We want a world-space normal vector To transform the object to world coordinates, we just multiplied its vertices by M, the object’s CTM Can we treat the normal vector the same way? Answer: NO Example: say M scales in x by.5 and y by 2 See the normal scaling applets in Applets  Lighting and Shading n object Mn object Wrong! Normal must be perpendicular

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 28/42 Normal Vectors at Intersection Points (4/4) Why doesn’t multiplying the normal work? For translation and rotation, which are rigid body transformations, it actually does work Scale, however, distorts the normal in exactly the opposite sense of the scale applied to the surface, not surprising given that the normal is perpendicular -scaling y by 2 causes normal to scale by.5: -We’ll see this algebraically in the next slides

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 29/42 Transforming Normals (1/4) Take the polygonal case, for example Let’s compute the relationship between the object-space normal n obj to a polygon H and the world-space normal n world to a transformed version of H, say MH If v is a vector in world space that lies in the polygon (e.g., one of the edge vectors), then the normal is perpendicular to the vector v: But v world is just a transformed version of some vector in object space, v obj. So we could write But we’d be wrong, because v is a tangent vector it’s transformed by the derivative… …which includes a 3D->4D->3D mapping… Object-space to world-space

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 30/42 Transforming Normals (2/4) So we want a vector n world such that We will show in a moment that this equation can be rewritten as We also already have Therefore Left-multiplying by (M t ) -1, Object-space to world-space(cont.)

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S So how did we rewrite this: As this: Recall that if we think of vector as nx1 matrices, then switching notation, Rewriting the formula above, we have Writing M = M tt, we get Recalling that (AB) t = B t A t, we can write this: Switching back to dot product notation: Andries van Dam, John Alex October 28, 2003 Raytracing 31/42 Transforming Normals (2/4) Object-space to world-space(cont.)

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 32/42 Transforming Normals (4/4) So we ended up with Fortunately, “invert” and “transpose” can be swapped, to get our final form: Why do we do this? It’s easier! A hand-waving interpretation of (M 3 -1 ) t -M 3 is a composition of rotations and scales, R and S (why no translates?). Therefore -so we’re applying the transformed (inverted, transposed) versions of each individual matrix in their original order -for a rotation matrix, this transformed version is equal to the original rotation, i.e., normal rotates with object -(R -1 ) t =R; the inverse reverses the rotation, and the transpose reverses it back -for a scale matrix, the inverse reverses the scale, while the transpose does nothing: -(S(x,y,z) -1 ) t = S(x,y,z) -1 =S(1/x,1/y,1/z) Applying inverse-transpose of M to normals

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 33/42 Summary P = eyePt For each sample of image Compute d for each object Intersect ray P+td with object Select object with smallest non-negative t-value(this is the visible object) For this object, find the object-space intersection point Compute the normal at that point Transform the normal to world space Use the world-space normal for lighting computations Simple, non-recursive raytracer

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 34/42 What about pixels? We’ve used “samples” rather than “pixels” In the simplest case, can choose our sample points at the centers of each pixel For better results, can supersample: take multiple samples per pixel -e.g., at the corners and at the center Even better techniques do adaptive sampling: increase sample density in areas of rapid change (in geometry or lighting) Can also do stochastic sampling: samples are taken probabilistically For fast results, can subsample: fewer samples than pixels take as many samples as time permits How to convert samples to pixels? This is a resampling problem, hence we filter to get weighted average of samples Pixels aren’t samples

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 35/42 Recursive Raytracing By recursively casting new rays into the scene, we can look for more information Start from the point of intersection We’d like to send rays in all directions Send rays in directions we predict will contribute the most: -toward lights (shadow) -bounce off objects (specular reflection) -through the object (transparency) For more info on recursive ray tracing, see section of the textbook. Simulating global lighting effects (Whitted, 1979)

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 36/42 Shadows Each light in scene makes contribution to the color and intensity of a surface element… Iff it reaches the object! -could be occluded by other objects in the scene -could be occluded by another part of the same object Construct a ray from the surface to each light Check to see if ray intersects other objects before it gets to the light -if ray does NOT intersect that same object or another object on its way to the light, then the full contribution of the light can be counted -if ray does intersect an object on its way to the light, then no contribution of that light should be counted -what about transparent objects?

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 37/42 Transparent Surfaces (1/2) For a partially transparent polygon Nonrefractive transparency I λ2 I λ1 polygon 1 polygon 2

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S We model the way light bends at interfaces with Snell’s Law Andries van Dam, John Alex October 28, 2003 Raytracing 38/42 Transparent Surfaces (2/2) Refractive transparency medium 1 medium 2

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 39/42 Recursive Raytracing (1/2) Trace ‘secondary’ rays at intersections: -light: trace ray to each light source. If light source blocked by opaque object, it does not contribute to lighting, and object in shadow of blocked light at that point -specular reflection: trace ray in mirror direction by reflecting about N -refraction/transparency: trace ray in refraction direction by Snell’s law -recursively spawn new light, reflection, refraction rays at each intersection until contribution negligible -Your new lighting equation… -note: intensity from recursed rays calc’d with same eqn -light sources contribute specular and diffuse lighting -Limitations -recursive interobject reflection is strictly specular: along ray reflected about N -diffuse interobject reflection handled by radiosity Informative videos: silent movie on raytracing, A Long Ray’s Journey into Light Recap

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 40/42 Recursive Raytracing (2/2) Light-ray Trees indirect illumination

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 41/42 Raytracing Pipeline Raytracer produces visible samples from model -samples convolved with filter to form pixel image Additional pre-processing -pre-process database to speed up per-sample calculations (done once, sometimes must be redone if objects transformed (resize, translate)) Pipeline smallest t generate secondary rays

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam, John Alex October 28, 2003 Raytracing 42/42 POV-Ray: Pretty Pictures Full-featured raytracer available online: Obligatory pretty pictures (see for more!): Free Advanced Raytracer