1gr2-00 gr2 advanced computer graphics agr lecture 14 improving the efficiency of ray tracing light...
TRANSCRIPT
![Page 1: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/1.jpg)
1GR2-00
GR2Advanced Computer
GraphicsAGR
GR2Advanced Computer
GraphicsAGR
Lecture 14Improving the Efficiency of
Ray TracingLight Source Effects
![Page 2: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/2.jpg)
2GR2-00
Advantages and Disadvantages of Ray
Tracing
Advantages and Disadvantages of Ray
Tracing
Ray tracing is attractive because– shadows, reflections, refractions
are easily incorporated Ray tracing is expensive because
– the cost of computing ray-object intersections is very high
This part of the lecture looks at efficiency issues in ray tracing
![Page 3: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/3.jpg)
3GR2-00
Ray Tracing - A ReminderRay Tracing - A Reminder
pixel positionson view plane
camera
The intensity calculationis now:I = I local + k r * I reflected
+ k t * I transmitted
I reflected and I transmitted
are calculated recursively
![Page 4: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/4.jpg)
4GR2-00
Adaptive Tree Depth Control
Adaptive Tree Depth Control
Basic algorithm follows rays until they leave the scene (or hit diffuse surface) - in theory the tree depth can then be considerable
In practice, it is not usually necessary to trace rays to any great depth
As tree formed, a running product is kept of transmission and reflection coefficients– this product attenuates all intensities lower in
tree– once product less than threshold, branch is
stopped
![Page 5: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/5.jpg)
5GR2-00
Bounding VolumesBounding Volumes
Enclose groups of objects in a simple bounding volume– sphere or box
Test for intersection against bounding volume– if none, then ray does not intersect
objects within– if intersection occurs, test against each
object in turn Idea can be extended to hierarchies
of bounding volumes (usually boxes)
![Page 6: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/6.jpg)
6GR2-00
Spatial SubdivisionSpatial Subdivision
Idea: divide space into subregions, noting objects in each subregion– termed ‘spatial subdivision’ or ‘spatial
coherence’ Calculation changes from:
– for each object or bounding box, find ray intersection
to– as ray proceeds through space, are there any
objects in the current subregion?– if yes, calculate intersections; if not, move on– find next subregion entered by the ray
![Page 7: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/7.jpg)
7GR2-00
How do we Subdivide Space
How do we Subdivide Space
One idea is octree partitioning We illustrate in 2D - known as
quadtreeFirst divide space intofour regions
Count number of objectsin each region
If a region contains an object, subdivide again
Continue to a specified levelof subdivision
![Page 8: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/8.jpg)
8GR2-00
OctreeOctree
A tree structure emerges, with the nodes at the leaves ofthe tree containing (hopefully) a small number of objects,or empty.
This is quadtree - in 3Dwe subdivide cube into8 each time, getting anoctree
![Page 9: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/9.jpg)
9GR2-00
Ray Tracing through Octree
Ray Tracing through Octree
We trace ray from subregion to subregion, only doingintersection tests for the small number of objects in thesubregion.
Find region correspondingto start point. Test ray forintersections with any objects.
If none, find next region - bycalculating intersection withregion boundaries. Advancea short way into next region -say to (x,y,z)
Find region which includes(x,y,z) and continue.
![Page 10: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/10.jpg)
10GR2-00
Finding Region Containing (x,y,z)
Finding Region Containing (x,y,z)
We use octree itself to locate region. Starting at top, asimple test determines in which of eight (4 for quadtree) regions the point (x,y,z) lies. Proceed down tree untilleaf node reached.
![Page 11: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/11.jpg)
11GR2-00
Binary Space PartitioningBinary Space Partitioning
An alternative to octrees is just to split into two at each step– separating plane typically chosen to
divide space into regions of equal complexity
Known as Binary Space Partitioning, or BSP, trees
![Page 12: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/12.jpg)
12GR2-00
Octrees versus BSP treesOctrees versus BSP trees
Octrees:– good for scenes where density of objects
varies widely– possible to have small objects in large
regions– stepping from region to region slow because
trees tend to be unbalanced BSP trees:
– depth of tree smaller because tree balanced– memory costs lower– void areas smaller
![Page 13: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/13.jpg)
13GR2-00
Ray Tracing SoftwareRay Tracing Software
Persistence Of Vision Ray Tracer (POV-RAY) is public domain ray tracing software
Download from:– http://www.povray.org
![Page 14: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/14.jpg)
14GR2-00
More Teapots! The POVRAY version
More Teapots! The POVRAY version
![Page 15: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/15.jpg)
15GR2-00
POVLAB modellerPOVLAB modeller
![Page 16: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/16.jpg)
16GR2-00
Lecture 14Part 2
Light Source Effects
![Page 17: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/17.jpg)
17GR2-00
Light Source Sequence of Images
Light Source Sequence of Images
The following sequence of images were created by Alan Watt of University of Sheffield
They illustrate effects of different light sources in a scene
![Page 18: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/18.jpg)
18GR2-00
Ambient Light OnlyAmbient Light Only
![Page 19: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/19.jpg)
19GR2-00
Camera Light SourceCamera Light Source
Light source atcamera only.
Note no shadows.
![Page 20: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/20.jpg)
20GR2-00
Distant Light SourceDistant Light Source
Light rays parallelto each other
Note shadows
![Page 21: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/21.jpg)
21GR2-00
Point Light SourcePoint Light Source
Point light sourceclose to object,in same directionas distant sourcein previous picture.
Note shadows aredifferent.
![Page 22: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/22.jpg)
22GR2-00
SpotlightSpotlight
Spotlight in sameposition as previouspoint light.
Cone angle is 30 deg.
Note cone ofinfluence of thelight, and thehard shadow.
![Page 23: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/23.jpg)
23GR2-00
Spotlight - Soft ShadowsSpotlight - Soft Shadows
Softer shadowobtained by havinga gradual drop-offof intensity at edge ofcone (here over last5 deg)
![Page 24: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/24.jpg)
24GR2-00
Effect of Distance - No Attenuation
Effect of Distance - No Attenuation
Here there is noattenuation of lightover distance
![Page 25: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/25.jpg)
25GR2-00
Effect of Distance - Attenuation
Effect of Distance - Attenuation
Intensity is attenuatedby 1/distance
![Page 26: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/26.jpg)
26GR2-00
Effect of Distance - Attenuation
Effect of Distance - Attenuation
Here the attenuation factoris 1/(distance)2
![Page 27: 1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 14 Improving the Efficiency of Ray Tracing Light Source Effects](https://reader031.vdocuments.site/reader031/viewer/2022013100/5515f520550346d46f8b55c9/html5/thumbnails/27.jpg)
27GR2-00
FogFog
Intensity of fogincreases linearlywith depth.
How is thisachieved?