13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Chapter 1 The Study of Body Function Image PowerPoint
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Points, Vectors, Lines, Spheres and Matrices
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
1GR2-00 GR2 Advanced Computer Graphics AGR Ken Brodlie Lecture 1 - Overview.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Final Review of Rendering What We Did Not Cover Learning More...
GR2 Advanced Computer Graphics AGR
GR2 Advanced Computer Graphics AGR
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 6 Physically Based Reflection Model.
15.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 15 – Visible Surfaces and Shadows.
GR2 Advanced Computer Graphics AGR
SI23 Introduction to Computer Graphics
SI23 Introduction to Computer Graphics
GR2 Advanced Computer Graphics AGR
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
7.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 7 Polygon Shading Techniques.
1.1 SI31_2001 SI31 Advanced Computer Graphics AGR Ken Brodlie Lecture 1 - Overview.
5.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 5 A Simple Reflection Model.
9.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
SI31 Advanced Computer Graphics AGR
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
Solve Multi-step Equations
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
ABC Technology Project
Plane wave reflection and transmission
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
Green Eggs and Ham.
VOORBLAD.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
1 05/10/2014 Computer Graphics Lecture 10 Global Illumination 1: Ray Tracing and Radiosity Taku Komura.
#1UNIT C Describes a material which allows light to pass through easily.
© 2012 National Heart Foundation of Australia. Slide 2.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
25 seconds left…...
Januar MDMDFSSMDMDFSSS
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
PSSA Preparation.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Lecture 14 Illumination II – Global Models
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
Light Issues in Computer Graphics Presented by Saleema Amershi.
Course Website: Computer Graphics 18: Ray-tracing.
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
RAY TRACING.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
Introduction to 3D Graphics Lecture 2: Mathematics of the Simple Camera Anthony Steed University College London.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
RENDERING : Global Illumination
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
CS552: Computer Graphics Lecture 36: Ray Tracing.
GR2 Advanced Computer Graphics AGR
Presentation transcript:

13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing

13.2 si31_2001 Ray Tracing n Ray tracing is an alternative rendering approach to the polygon projection, shading and z-buffer way of working n It is capable of high quality images through taking account of global illumination

13.3 si31_2001 Ray Tracing Example

13.4 si31_2001 Firing Rays pixel positions on view plane camera The view plane is marked with a grid corresponding to pixel positions on screen. A ray is traced from the camera through each pixel in turn. light

13.5 si31_2001 Finding Intersections pixel positions on view plane camera We calculate the intersection of the ray with all objects in the scene. The nearest inter- section will be the visible surface for that ray light

13.6 si31_2001 Intensity Calculation pixel positions on view plane camera The intensity at this nearest intersection is found from the usual Phong reflection model. Stopping at this point gives us a very simple rendering method. Often called: ray casting light

13.7 si31_2001 Phong Reflection Model light source N L R V eye surface I( ) = K a ( )I a ( ) + ( K d ( )( L. N ) + K s ( R. V ) n ) I*( ) / dist Note: R.V calculation replaced by H.N for speed - H = (L+V)/2 dist = distance attenuation factor Here V is direction of incoming ray, N is normal, L is direction to light source, and R is direction of perfect spec. reflection.

13.8 si31_2001 Intensity Calculation pixel positions on view plane camera Thus Phong reflection model gives us intensity at point based on a local model: I = I local where I local = I ambient + I diffuse + I specular Intensity calculated separately for red, green, blue light

13.9 si31_2001 Shadows pixel positions on view plane camera To determine if the point is in shadow, we can fire a ray at the light source(s) - in direction L. If the ray intersects another object, then point is in shadow from that light. In this case, we just use ambient component: I local = I ambient Otherwise the point is fully lit. light shadow ray Note this has to be done for every light source in scene.

13.10 si31_2001 Reflected Ray pixel positions on view plane camera Ray tracing models reflections by looking for light coming in along a secondary ray, making a perfect specular reflection. R 1 = V - 2 (V.N) N R1R1 light

13.11 si31_2001 Reflected Ray- Intersection and Recursion We calculate the intersection of this reflected ray, with all objects in the scene. The intensity at the nearest intersection point is calculated, and added as a contribution attenuated by distance. This is done recursively. pixel positions on view plane camera light

13.12 si31_2001 Reflected Ray - Intensity Calculation pixel positions on view plane camera light The intensity calculation is now: I = I local + k r * I reflected Here I reflected is calculated recursively k r is a reflection coefficient (similar to k s )

13.13 si31_2001 Ray Termination pixel positions on view plane camera Rays terminate: - on hitting diffuse surface - on going to infinity - after several reflections - why?

13.14 si31_2001 Transmitted Ray If the object is semi- transparent, we also need to take into account refraction pixel positions on view plane camera light Thus we follow also transmitted rays, eg T 1. T1T1

13.15 si31_2001 Refraction N V T i r r i Change in direction is determined by the refractive indices of the materials, i and r Snells Law: sin r = ( i / r ) * sin i T = ( i / r ) V - ( cos r - ( i / r ) cos i ) N

13.16 si31_2001 Refraction Contribution n The contribution due to transmitted light is taken as: k t * I t ( ) – where k t is the transmission coefficient I t ( ) is the intensity of transmitted light, again calculated separately for red, green, blue

13.17 si31_2001 Intensity Calculation pixel positions on view plane camera The intensity calculation is now: I = I local + k r * I reflected + k t * I transmitted I reflected and I transmitted are calculated recursively

13.18 si31_2001 Binary Ray Tracing Tree S1 S2S3 S4 pixel positions on view plane camera S1 S2 S3 S4 R1R1 T1T1 T1T1 R1R1 The intensity is calculated by traversing the tree and accumulating intensities light

13.19 si31_2001 Calculating Ray Intersections n A major part of ray tracing calculation is the intersection of ray with objects n Two important cases are: – sphere – polygon

13.20 si31_2001 Ray - Sphere Intersection Let camera position be (x 1, y 1, z 1 ) Let pixel position be (x 2, y 2, z 2 ) Any point on ray is: x(t) = x 1 + t * (x 2 - x 1 )= x 1 + t * i y(t) = y 1 + t * (y 2 - y 1 )= y 1 + t * j z(t) = z 1 + t * (z 2 - z 1 )= z 1 + t * k As t increases from zero, x(t), y(t), z(t) traces out the line from (x 1, y 1, z 1 ) through (x 2, y 2, z 2 ). Equation of sphere, centre (l, m, n) and radius r: (x - l) 2 + (y - m) 2 + (z - n) 2 = r 2

13.21 si31_2001 Ray - Sphere Intersection Putting the parametric equations for x(t), y(t), z(t) in the sphere equation gives a quadratic in t: at 2 + bt + c = 0 Exercise: write down a, b, c in terms of i, j, k, l, m, n, x 1, y 1, z 1 Solving for t gives the intersection points: b 2 - 4ac < 0 no intersections b 2 - 4ac = 0ray is tangent b 2 - 4ac > 0two intersections, we want smallest positive

13.22 si31_2001 Ray - Polygon Intersection Equation of ray: x(t) = x 1 + t * i y(t) = y 1 + t * j z(t) = z 1 + t * k Equation of plane: ax + by + cz + d = 0 Intersection: t = - (ax 1 + by 1 + cz 1 + d) / (ai + bj + ck) Need to check intersection within the extent of the polygon.

13.23 si31_2001 Ray Tracing - Limitations n This basic form of ray tracing is often referred to as Whitted ray tracing after Turner Whitted who did much of the early work... n Ray tracing in its basic form is computationally intensive n Much research has gone into increasing the efficiency and this will be discussed in next lecture.

13.24 si31_2001 Ray Tracing Example

13.25 si31_2001 Depth 0

13.26 si31_2001 Depth 1

13.27 si31_2001 Depth 2

13.28 si31_2001 Depth 3

13.29 si31_2001 Depth 4

13.30 si31_2001 Depth 7

13.31 si31_2001 Acknowledgements n As ever, thanks to Alan Watt for the excellent images