ray tracing csis 5838: graphics and animation for gaming
TRANSCRIPT
![Page 1: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/1.jpg)
Ray Tracing
CSIS 5838: Graphics and Animation for Gaming
![Page 2: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/2.jpg)
Ray Tracing
• Goals:– Find what surfaces are visible to camera– Find the color/shading of those surfaces
• Simple solution (from physics)– Project rays from light sources in all directions– Determine which rays reach visual plane
• Extremely inefficient!– Most rays never reach visual plane
![Page 3: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/3.jpg)
Ray Tracing and Visibility
Better solution:• Project rays from focal
center in all directions that intersect visual plane
• Determine first face that ray intersects(visibility)
![Page 4: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/4.jpg)
Ray Tracing and Shading
Better solution:• For each visible face,
trace ray to each lightsource
• If intersect another object first, face is shaded
![Page 5: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/5.jpg)
Ray Tracing and Color
• Color perceived depends on– Color of surface– Color of light source
• Minimum RGB levels– Surface color: (RS, GS, BS)
– Lamp color: (RL, GL, BL)
– Color reflected: (min(RS, RL), min(GS, GL), min(BS, BL))
![Page 6: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/6.jpg)
Reflection
• Reflection done by continuing ray trace off of mirrored surfaces– Continue in opposite angle as incident angle to surface normal– Specify maximum number of ray trace steps
![Page 7: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/7.jpg)
Refraction
• Density of transparent objects cause light to bend• Index of refraction (IOR) n = c/v– c = speed of light in vacuum– v = speed of light in medium
• Examples:– Water: n = 1.33– Glass: n 1.5 …
![Page 8: Ray Tracing CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocuments.site/reader036/viewer/2022083009/5697bf911a28abf838c8eb34/html5/thumbnails/8.jpg)
Refraction
• Snell’s Law: n1sin1 = n2sin2– 1: Angle of incidence (normal to surface)
– 2: Angle of refraction of ray within new surface