Docsity

Computer Graphics 18 - Computer Graphics - Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Computer Graphics 18 - Computer Graphics - Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Ray-tracing

Ray-Tracing Examples

Images from the POVRAY Hall of Fame:

hof.povray.org

Ray-Tracing Examples (cont…)

Images from the POVRAY Hall of Fame:

hof.povray.org

Ray-Tracing Examples (cont…)

Images from the POVRAY Hall of Fame:

hof.povray.org

Ray-Tracing Setup

Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004) Docsity.com

Basic Ray-Tracing

  • Ray tracing proceeds as follows:
    • Fire a single ray from each pixel position into the scene along the projection path
    • Determine which surfaces the ray intersects and order these by distance from the pixel
    • The nearest surface to the pixel is the visible surface for that pixel
    • Reflect a ray off the visible surface along the specular reflection angle
    • For transparent surfaces also send a ray through the surface in the refraction direction
    • Repeat the process for these secondary rays

Ray-Tracing & Illumination Models

  • At each surface intersection he illumination

model is invoked to determine the surface

intensity contribution

Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004) Docsity.com

The Shadow Ray

  • The path from the intersection to the light

source is known as the shadow ray

  • If any object intersects the shadow ray

between the surface and the light source then

the surface is in shadow with respect to that

source

Ray-Tracing Tree

  • As the rays ricochet around the scene each intersected surface is added to a binary ray- tracing tree - The left branches in the tree are used to represent reflection paths - The right branches in the tree are used to represent transmission paths
  • The tree’s nodes store the intensity at that surface
  • The tree is used to keep track of all contributions to a given pixel

Ray-Tracing Tree Example

S 3 S 4

S 1 S^2

Projection Reference Point Docsity.com

Ray-Tracing Tree (cont…)

  • After the ray-tracing tree has been completed for a pixel the intensity contributions are accumulated
  • We start at the terminal nodes (bottom) of the tree
  • The surface intensity at each node is attenuated by the distance from the parent surface and added to the intensity of the parent surface
  • The sum of the attenuated intensities at the root node is assigned to the pixel

Ray Tracing Demo

There’s a very nice Java demo which allows us step through the ray-tracing process available at: http://www.siggraph.org/education/materials/HyperGraph/raytrace/rt_java/raytrace.htmlDocsity.com

R = u −( 2 u ⋅ N ) N

T u i N r

i r r

i  

= − − θ η

η θ η

η cos cos

( i )

r

i r^ θ η

η θ 2

2 cos (^1)  1 −cos 

P = P 0 + su

pix prp

pix prp P P

P P

u −