Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ray Tracing CSIS 5838: Graphics and Animation for Gaming.

Similar presentations


Presentation on theme: "Ray Tracing CSIS 5838: Graphics and Animation for Gaming."— Presentation transcript:

1 Ray Tracing CSIS 5838: Graphics and Animation for Gaming

2 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

3 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)

4 Ray Tracing and Shading Better solution: For each visible face, trace ray to each light source If intersect another object first, face is shaded

5 Ray Tracing and Color Color perceived depends on – Color of surface – Color of light source Minimum RGB levels – Surface color: (R S, G S, B S ) – Lamp color: (R L, G L, B L ) – Color reflected: (min(R S, R L ), min(G S, G L ), min(B S, B L ))

6 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

7 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 …

8 Refraction Snell’s Law: n 1 sin  1 = n 2 sin  2 –  1 : Angle of incidence (normal to surface) –  2 : Angle of refraction of ray within new surface


Download ppt "Ray Tracing CSIS 5838: Graphics and Animation for Gaming."

Similar presentations


Ads by Google