GR2 Advanced Computer Graphics AGR

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.
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
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
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 16 Radiosity - continued.
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.
13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
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
Fisica Generale - Alan Giambattista, Betty McCarty Richardson Copyright © 2008 – The McGraw-Hill Companies s.r.l. 1 Chapter 23: Reflection and Refraction.
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.
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.
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.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
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.
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.
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:

GR2 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing

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

Ray Tracing Example

Firing Rays The view plane is marked with a grid corresponding pixel positions on view plane camera light 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.

Finding Intersections pixel positions on view plane camera light 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

Intensity Calculation pixel positions on view plane camera light 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

Phong Reflection Model light source N R eye L  V  surface I() = Ka()Ia() + ( Kd()( L . N ) + Ks( R . V )n ) I*() / dist 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. Note: R.V calculation replaced by H.N for speed - H = (L+V)/2

Intensity Calculation pixel positions on view plane camera light 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

Shadows To determine if the point is in shadow, we can fire a ray at pixel positions on view plane camera light 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. shadow ray

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

Reflected Ray- Intersection and Recursion pixel positions on view plane camera light 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.

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 )

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

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

Refraction r i r i Snell’s Law: sin  r = ( i /  r ) * sin  i Change in direction is determined by the refractive indices of the materials, i and r T r N i V Snell’s Law: sin  r = ( i /  r ) * sin  i T = ( i /  r ) V - ( cos  r - ( i /  r ) cos  i ) N

Refraction Contribution The contribution due to transmitted light is taken as: kt * It(  ) where kt is the transmission coefficient It(  ) is the intensity of transmitted light, again calculated separately for red, green, blue

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

Binary Ray Tracing Tree S4 pixel positions on view plane camera light S1 T1 R1 S2 S3 R1 S2 S3 T1 S1 S4 The intensity is calculated by traversing the tree and accumulating intensities

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

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

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

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

Ray Tracing - Limitations Ray tracing in its basic form is computationally intensive Much research has gone into increasing the efficiency and this will be discussed in next lecture.

Ray Tracing Example

Depth 0

Depth 1

Depth 2

Depth 3

Depth 4

Depth 7

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