Download presentation
1
CSCE 441: Computer Graphics Ray Tracing
Jinxiang Chai
2
Ray Tracing Is a global illumination technique
Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows Image taken from
3
Any difference for rendering three pixels?
Ray Tracing Is a global illumination technique Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows Any difference for rendering three pixels? Image taken from
4
Local Illumination vs. Ray Tracing
- Reflective surface - Realistic shadows
5
Ray Tracing Results Click here
6
Overview Ray Tracing Algorithm Shadows, Reflection, Refraction
Surface Intersection Infinite planes, spheres, polygons Optimizations Readings: HB 21-1
7
Essential Information for Ray Tracing
Eye point Screen position/orientation Objects Material properties Reflection/Refraction coefficients Index of refraction Light sources
8
Direct and Indirect Light
Every surface in an environment is illuminated by a combination of direct light and reflected light. The direct light is light energy which comes directly from a light source or light sources, attenuated only by some participating media (smoke, fog, dust). The reflected light is light energy which, after being emitted from a light source or light sources, is reflected off of one or more surfaces of the environment. When light energy is reflected from a surface it is attenuated by the reflectivity of the surface, as some of the light energy may be absorbed by the surface, and some may pass through the surface. The reflectivity of a surface is often defined as its color.
9
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources)
10
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting from light sources)
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 (where the angle of reflection equals the angle of incidence) - 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 (where the angle of reflection equals the angle of incidence) - 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 (where the angle of reflection equals the angle of incidence) - transparent ray (light passing through an object)
15
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 Pixels
16
Reflected Rays A ray is cast from the surface of an object based on its material properties. The contribution results in the specular reflection.
17
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.
18
Recursive Ray Tracing 3 L1 L2 4 1 2
19
Recursive Ray Tracing 3 L1 L2 4 1 2
20
Recursive Ray Tracing 3 L1 L2 4 1 2
21
Recursive Ray Tracing 3 L1 L2 4 1 2
22
Recursive Ray Tracing 3 L1 L2 4 1 2
23
Recursive Ray Tracing 3 L1 L2 4 1 2
24
Recursive Ray Tracing 3 L1 L2 4 1 2
25
Recursive Ray Tracing 3 L1 L2 4 1 2
26
Recursive Ray Tracing 3 L1 L2 4 1 2
27
What are real light paths?
Recursive Ray Tracing 3 L1 L2 4 1 2 What are real light paths?
28
Recursive Ray Tracing and Light path
3 L1 L2 4 1 2 Ray tracing paths just reverses real light paths!
29
Recursive Ray Tracing and Light path
3 L1 L2 4 1 2 Ray tracing paths just reverses real light paths!
30
Recursive Ray Tracing and Light path
3 L1 L2 4 1 2 Ray tracing paths just reverses real light paths!
31
Recursive Ray Tracing and Light path
3 L1 L2 4 1 2 Ray tracing paths just reverses real light paths!
32
Recursive Ray Tracing and Light path
3 L1 L2 4 1 2 Ray tracing paths just reverses real light paths!
33
Recursive Ray Tracing and Light path
3 L1 L2 4 1 2 Ray tracing paths just reverses real light paths!
34
Ray Tree Eye Shadow of Obj 4 Object 1 L2 Reflection Transmission L1 L1
35
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)
36
Recursive Ray Tracing
37
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.
38
Three Issues Ray-object intersection - hidden surface removal
Reflection direction - mirror direction Refraction direction - Snell’s law
39
Ray-object Intersection
screen eye Similar to ray casting!
40
Ray-object Intersection
screen eye Similar to ray casting! But how to determine the intersection point between a ray and an object such as sphere or triangle?
41
Ray Casting Implementation - Parameterize each ray as
- Each object Ok returns tk>0 such that first intersection with ok occurs at r(tk) - Q: given the set {tk}, what is the first intersection point?
42
Ray-Sphere Intersection
43
Ray-Triangle Intersection
First, intersecting the ray with plane Then, check if point is in triangle
44
Ray-Plane Intersection
45
Ray-Triangle Intersection
Check if point is inside triangle algebraically For each side of triangle evaluate if the intersection point P is above or below the plane P on the equation: (P-P0)∙N1=0 P above the plane: (P-P0)∙N1>0 P below the plane: (P-P0)∙N1<0
46
Ray-Triangle Intersection
Check if point is inside triangle algebraically For each side of triangle // P is outside triangle
47
Reflection Mirror-like/Shiny objects Surface
48
Refraction Bending of light caused by different speeds of light in different medium Each (semi-)transparent object has an index of refraction ni Use Snell’s law to find refracted vector Image taken from
49
Snell’s Law Surface
50
How to compute Transmission Ray?
Surface n2 Given V and N, as well as n1 and n2, how to compute R?
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
Snell’s Law Surface
62
Recursive Ray Tracing Recur for reflective/transparent objects
63
Recursive Ray Tracing Recur for reflective/transparent objects
64
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
65
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
66
Ray Tracing Results: Special Effects
Copyright Newline Cinema
67
Ray Tracing Results: Video Games
These images are from a prototype computer game running in realtime on the ray tracer. It consists of more than 40 million polygons and all optical effects are fully simulated at rendering time. All trees are fully models and no LOD is being used.
68
Ray Tracing Results: Massive Models
Ray tracing has been the first and (to our knowledge) only technology to interactively render the entire Boeing 777 data set. It consists of 350 million polygons and takes up to 30 GB of data on disk. Every detail is models including tiny screws, cables, pipes, values, and many more. With ray tracing this model can be rendered interactively even on a dual-processor PC with 2-3 fps at video resolution. The right image contains plants with a total of roughly 1.5 billion polygons. All leafs use alpha-mapped textures leading to an extremely high depth complexity. Still the scene can be rendered with interactive performance on a decent PC cluster. Even smooth lighting from the sky dome can be integrated. An good approximation is then shown during interaction but the image converges to a high quality solution with a few seconds.
69
Pros and Cons of Ray Tracing
Advantages of ray tracing All the advantages of the local illumination model Also handles shadows, reflection, and refraction Disadvantages of ray tracing Computational expense No diffuse inter-reflection between surfaces (i.e., color bleeding) Not physically accurate Other techniques exist to handle these shortcomings, at even greater expense!
70
Ray Tracing References
Peter Shirley, “Realistic Ray Tracing”, ISBN Andrew Glassner, “An Introduction to Ray Tracing”, ISBN Steve Pettifer ( Anselmo Lastra ( Paul Rademacher ( Mark Harris ( Kenny Hoff ( POV-Ray (
71
Environment Mapping An alternative way for modeling global reflections
How to create this effect?
72
Environment Mapping An efficient technique for approximating the appearance of a reflective surface by means of a precomputed texture image.
73
Environment Mapping Cheap attempt at modeling reflections
Makes surfaces look metallic The poor person’s ray tracing method (only consider reflection ray) Use six textures to model faces of a cube Assume cube faces infinitely far away The normal (or reflected eye vector) is used to find which of the textures to use and what texture coordinate
74
Environment Mapping
75
Environment Mapping
76
Environment Mapping
77
Environment Mapping
78
environment texture image
Environment Mapping Reflected ray: r=2(n·v)n-v viewer n Incident ray reflected ray v r reflective surface environment texture image Texture is transferred in the direction of the reflected ray r from the environment map onto the object What is in the map?
79
How to represent the map
viewer
80
How to represent the map
viewer
81
How to represent the map
viewer
82
How to represent the map
viewer Store colors of every possible direction in texture maps
83
How to represent the map
c viewer c c c c v Store colors of every possible direction in texture maps
84
How to represent the map
c viewer c c c c v Store colors of every possible direction in texture maps Look up texture maps based on reflected vector
85
Cubic Mapping The map resides on the surfaces of a cube around the object Typically, align the faces of the cube with the coordinate axes To generate the map: For each face of the cube, render the world from the center of the object with the cube face as the image plane Rendering can be arbitrarily complex (it’s off-line) To use the map: Index the R ray into the correct cube face Compute texture coordinates
86
Cubic Map Example
87
How to represent the map
viewer Store colors of every possible direction in texture maps
88
Sphere Mapping Map lives on a sphere To generate the map:
Render a spherical panorama from the designed center point To use the map: Use the orientation of the R ray to index directly into the sphere
89
Example
90
Environmental Mapping: Limitations
Assume distant environment Only work for convex objects (i.e., no self-interreflections)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.