Ray Tracing How does RayTracing work n Modeling
































- Slides: 32
Ray Tracing
How does Ray-Tracing work? n Modeling n Build a 3 D model of the world n n Geometric primitives Light sources Material properties Simulate the bouncing of light rays n n n Trace ray from eye through image pixel to see what it hits From there, bounce ray in reflection direction, towards light source, etc. Thus, model physics of emission, reflection, transmission, etc. (backwards)
Modeling the World camera { location look_at angle 58 } <0, 5, -5> <0, 0, 0> light_source { <-20, 30, -25> color red 0. 6 green 0. 6 blue 0. 6 } blob { threshold 0. 5 sphere { <-2, 0, 0>, cylinder { <0, 0, -2>, cylinder { <0, -2, 0>, pigment { color red 1 finish { ambient 0. 2 rotate <0, 20, 0> } 1, 2 } <2, 0, 0>, 0. 5, 1 <0, 0, 2>, 0. 5, 1 <0, 2, 0>, 0. 5, 1 green 0 blue 0 } diffuse 0. 8 phong } } } 1 }
With Ray Tracing Ray thru pixel
No Ray Tracing Flat blob
Chapter 1 - 6 Interactive Computer Graphics Bounce toward lights
Shadows
Chapter 1 - 8 Shaded blob Interactive Computer Graphics
Chapter 1 - 9 Interactive Computer Graphics Blob with Highlights
Chapter 1 - 10 Interactive Computer Graphics Blob with ground plane
Chapter 1 - 11 Interactive Computer Graphics Blob with transparency
Chapter 1 - 12 Interactive Computer Graphics Blob with refraction
Types of illumination n Ambient – "light soup" that affects every point equally Diffuse – shading that depends on the angle of the surface to the light source Specular – 'highlights. ' Falls off sharply away from the reflection direction
What are these made of?
Material types n Dielectrics (non-conductors): n n In body reflection, light penetrates the surface and is affected by material pigment Highlights are the color of the light source Examples: paint, plastic, wood, … Conductors (metals) n n n No light penetrates the surface Highlight and "body" reflection are affected equally by the material Same color for diffuse and specular reflection
Chapter 1 - Finishes Interactive Computer Graphics
Chapter 1 - Textures Interactive Computer Graphics
Chapter 1 - Interactive Computer Graphics Surface (Ripples)
Chapter 1 - Interactive Computer Graphics POV-Ray Primitives
Chapter 1 - Sunsethf Interactive Computer Graphics
How to ray-trace… n n n Transparency? Refraction? Reflection? Fog? Anti-aliasing?
Drawbacks of ray tracing? n Time: many rays are needed per pixel… n n n Up to 25 rays through each pixel Each ray may bounce and split many times Each ray tested for intersection with many objects Need to be able to compute intersection with shape and ray, bounce angles, etc. Shape limitations Hard lighting n No soft shadows, inter-object diffusion, etc
Beyond Ray Tracing n Problems with ray tracing: n n n hard shadows no color bleeding Slow How else could you generate realistic-looking images – without the hard shadows and aliasing? Color bleed?
Chapter 1 - Interactive Computer Graphics Radiosity in POV-Ray
Radiosity n n n Treat each patch as reflector and emitter of light Each patch affects every other patch depending on distance, orientation, occlusion etc. Let light "bounce around" for a few iterations to compute the amount of light reaching a patch
Image: Wikipedia
Form factors n n We need to know the percentage of the light leaving one patch that reaches another (form factor). How to compute?
Hemicube algorithm n Form factor computation: n n n Put a hemicube around patch reference point Render an image in each of five directions Count pixels…
Radiosity summary n n Radiosity gives wonderful soft shading But even slower than ray tracing… Can't do reflection, refraction, specular highlights with radiosity Can combine ray tracing and radiosity for best of both worlds (and twice the time)
Rendering pipeline n Where does lighting happen? Shading? Reflections? Resizing and moving objects? Textures? Bump mapping? Displacement mapping? Hidden surface removal?
History of Interactive Graphics http: //www. geeks 3 d. com/20080810/graphics-rendering-pipelines/
Nvidia: Moore's Law is Dead, Multi-core Not Future n According to NVidia, the future is not a few cores optimized for serial performance speed, it's many smaller processors optimized for power consumption.