Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.

Similar presentations


Presentation on theme: "CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai."— Presentation transcript:

1 CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai

2 Ray Tracing Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows

3 Ray Tracing Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows Image taken from http://radsite.lbl.gov/radiance/book/img/plate10.jpg

4 Ray Tracing Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows Image taken from http://www.tjhsst.edu/~dhyatt/superap/samplex.jpg

5 Ray Tracing Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows Image taken from http://www.tjhsst.edu/~dhyatt/superap/samplex.jpg Any difference for rendering three pixels?

6 Overview Ray Tracing Algorithm Shadows, Reflection, Refraction Surface Intersection Infinite planes, spheres, polygons Optimizations

7 Essential Information for Ray Tracing Eye point Screen position/orientation Objects Material properties Reflection/Refraction coefficients Index of refraction Light sources

8 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources)

9 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources)

10 The Reflection Equation

11 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object)

12 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object)

13 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object)

14 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object)

15 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object) What are the radiances?

16 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object)

17 Ray Tracing Assumption The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources) - reflection ray (light reflected by an object) - transparent ray (light passing through an object) Reverse light path!

18 Illumination / Shadow Rays A ray is cast from an object’s surface towards a light. If the light is not occluded, then the light contributes to the object’s surface color. If the light is occluded, then the light does not contribute to the object’s surface color. If ray hits a semi-transparent object, scale the contribution of that light and continue to look for intersections Occluder

19 Reflected Rays A ray is cast from the surface of an object based on its material properties. The contribution results in the specular reflection.

20 Transparency/transmission/refracted Rays Some objects are transparent or translucent. The transmitted light also contributes to the surface color, called specular transmission. The ray can be refracted based on the object’s composition.

21 Recursive Ray Tracing 1 2 3 4 L1 L2

22 Recursive Ray Tracing 1 2 3 4 L1 L2

23 Recursive Ray Tracing 1 2 3 4 L1 L2

24 Recursive Ray Tracing 1 2 3 4 L1 L2

25 Recursive Ray Tracing 1 2 3 4 L1 L2

26 Recursive Ray Tracing 1 2 3 4 L1 L2

27 Recursive Ray Tracing 1 2 3 4 L1 L2

28 Recursive Ray Tracing 1 2 3 4 L1 L2

29 Recursive Ray Tracing 1 2 3 4 L1 L2 What are real light paths?

30 Recursive Ray Tracing and Light path 1 2 3 4 L1 L2 Ray tracing paths just reverses real light paths!

31 Recursive Ray Tracing and Light path 1 2 3 4 L1 L2 Ray tracing paths just reverses real light paths!

32 Recursive Ray Tracing and Light path 1 2 3 4 L1 L2 Ray tracing paths just reverses real light paths!

33 Recursive Ray Tracing and Light path 1 2 3 4 L1 L2 Ray tracing paths just reverses real light paths!

34 Recursive Ray Tracing and Light path 1 2 3 4 L1 L2 Ray tracing paths just reverses real light paths!

35 Recursive Ray Tracing and Light path 1 2 3 4 L1 L2 Ray tracing paths just reverses real light paths!

36 Ray Tree Object 1L2 Shadow of Obj 4 Object 3 Reflection L2 L1 Object 2 Transmission Reflection L2 L1 Eye

37 Recursive Ray Tracing For each pixel Intersect ray from eye through pixel with all objects in scene Find closest (positive) intersection to eye Compute lighting at intersection point Recur for reflected and refracted rays (if necessary)

38 Recursive Ray Tracing

39 Termination Criterion 1. The ray intersects no surfaces 2. The ray intersects a light source that is not a reflecting surface 3. The tree has been generated to its maximum allowable depth.

40 Three Issues Ray-object intersection - hidden surface removal Reflection direction - mirror direction Refraction direction - Snell’s law

41 Ray-object Intersection eye screen Similar to ray casting!

42 Ray-object Intersection eye screen Similar to ray casting! But how to determine the intersection point between a pixel and triangle?

43 Ray Casting Implementation - Parameterize each ray as - Each object O k returns t k >0 such that first intersection with o k occurs at r(t k ) - Q: given the set {t k }, what is the first intersection point?

44 Ray-Triangle Intersection A triangle consists of 3 points (a,b,c), if not co-linear, they create a plane. Use barycentric coordinates. p(α,β,γ) = αa + βb + γc α + β + γ = 1 p is inside the triangle only if: 0 < α < 1 0 < β < 1 0 < γ < 1 If 1 coordinate zero, then on edge, 2 then at a vertex

45 Ray-Triangle Intersection Barycentric coordinates computed using the areas A a, A b, and A c of the subtriangles above, and total area A. α = A a / A β = A b / A γ = A c / A AcAc AbAb AaAa a b c (α,β,γ)

46 Reflection Mirror-like/Shiny objects Surface

47 Refraction Bending of light caused by different speeds of light in different medium Each (semi-)transparent object has an index of refraction c i Use Snell’s law to find refracted vector Image taken from http://hyperphysics.phy-astr.gsu.edu/hbase/geoopt/refr2.html

48 Snell’s Law Surface

49 How to compute Transmission Ray? Surface c1c1 c2c2

50 Snell’s Law Surface

51 Snell’s Law Surface

52 Snell’s Law Surface

53 Snell’s Law Surface

54 Snell’s Law Surface

55 Snell’s Law Surface

56 Snell’s Law Surface

57 Snell’s Law Surface

58 Snell’s Law Surface

59 Snell’s Law Surface

60 Snell’s Law Surface

61 Recursive Ray Tracing Recur for reflective/transparent objects

62 Recursive Ray Tracing Recur for reflective/transparent objects

63 Optimizations Lots of rays to cast! Ray-Surface intersections are expensive Associate with each object Bounding box in 3-space If ray doesn’t intersect box, then ray doesn’t intersect object

64 Parallel Processing Ray tracing is a trivially parallel algorithm! Cast rays in parallel Cast reflection, refraction, shadow rays in parallel Calculate ray/surface intersections independently in parallel

65 Ray Tracing Results: Special Effects Copyright Newline Cinema

66 Ray Tracing Results: Video Games

67 Ray Tracing Results: Massive Models

68 Global Illumination Using Ray Tracing: Global Illumination Simulating global lighting through tracing rays Indirect diffuse and caustic illumination Very fast Benefits Add the subtle but highly important clue for realism Allows flexible light planning and control

69 Limitations of Ray Tracing Only considers totally specular interactions - rays either reflect perfectly or refract perfectly Ray traced scenes don't show "color bleed".

70 Ray Tracing References Peter Shirley, “Realistic Ray Tracing”, ISBN 1-56881- 110-1 Andrew Glassner, “An Introduction to Ray Tracing”, ISBN 0-12-286160-4 Steve Pettifer (http://www.cs.man.ac.uk/people/srp)http://www.cs.man.ac.uk/people/srp Anselmo Lastra (http://www.cs.unc.edu/~lastra)http://www.cs.unc.edu/~lastra Paul Rademacher (http://www.cs.unc.edu/~rademach)http://www.cs.unc.edu/~rademach Mark Harris (http://www.cs.unc.edu/~harrism)http://www.cs.unc.edu/~harrism Kenny Hoff (http://www.cs.unc.edu/~hoff)http://www.cs.unc.edu/~hoff POV-Ray (http://www.povray.org)http://www.povray.org


Download ppt "CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai."

Similar presentations


Ads by Google