Graphics18-Raytracing
-
Upload
zaibakhan8 -
Category
Documents
-
view
217 -
download
0
Transcript of Graphics18-Raytracing
-
8/12/2019 Graphics18-Raytracing
1/22
Course Website:http://www.comp.dit.ie/bmacnamee
Computer Graphics 18:Ray-tracing
http://www.comp.dit.ie/bmacnameehttp://www.comp.dit.ie/bmacnamee -
8/12/2019 Graphics18-Raytracing
2/22
2
of
50Contents
Today we will have a look at ray-tracingwhich can be used to generate extremely
realistic images
-
8/12/2019 Graphics18-Raytracing
3/22
3
of
50Ray-Tracing Examples
Imagesfromt
hePOV
RAYHallofFame:hof.povray.org
http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/ -
8/12/2019 Graphics18-Raytracing
4/22
4
of
50Ray-Tracing Examples (cont)
Imagesfromt
hePOV
RAYHallofFame:hof.povray.org
http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/ -
8/12/2019 Graphics18-Raytracing
5/22
5
of
50Ray-Tracing Examples (cont)
Imagesfromt
hePOV
RAYHallofFame:hof.povray.org
http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/ -
8/12/2019 Graphics18-Raytracing
6/22
6
of
50Ray-Tracing Examples (cont)
Imagesfromt
hePOV
RAYHallofFame:hof.povray.org
http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/ -
8/12/2019 Graphics18-Raytracing
7/22
7
of
50Ray-Tracing Examples (cont)
Imagesfromt
hePOV
RAYHallofFame:hof.povray.org
http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/http://hof.povray.org/ -
8/12/2019 Graphics18-Raytracing
8/22
8
of
50Ray-Tracing Setup
Ima
gestakenfromHearn&B
aker,ComputerGraphics
withOpenGL(2004)
-
8/12/2019 Graphics18-Raytracing
9/22
9
of
50Basic 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 visiblesurface for that pixel
Reflect a ray off the visible surface along thespecular reflection angle
For transparent surfaces also send a raythrough the surface in the refraction direction
Repeat the process for these secondary rays
-
8/12/2019 Graphics18-Raytracing
10/22
10
of
50Terminating Ray-Tracing
We terminate a ray-tracing path when anyone of the following conditions is satisfied:
The ray intersects no surfaces
The ray intersects a light source that is not areflecting surface
A maximum allowable number of reflections
have taken place
-
8/12/2019 Graphics18-Raytracing
11/22
11
of
50Ray-Tracing & Illumination Models
At each surface intersection he illuminationmodel is invoked to determine the surface
intensity contribution
ImagestakenfromHearn&B
aker,ComputerGraphicswithOpenGL(2004)
-
8/12/2019 Graphics18-Raytracing
12/22
12
of
50The Shadow Ray
The path from the intersection to the lightsource is known as the shadow ray
If any object intersects the shadow ray
between the surface and the light sourcethen the surface is in shadow with respect to
that source
-
8/12/2019 Graphics18-Raytracing
13/22
13
of
50Ray-Tracing & Transparent Surfaces
For transparent surfaces we need to calculatea ray to represent the light refracted through
the material
The direction of the refracted ray is determinedby the refractive
index of the
material
ImagestakenfromHearn&B
aker,ComputerGraphicswithOpenGL(2004)
-
8/12/2019 Graphics18-Raytracing
14/22
14
of
50Ray-Tracing Tree
As the rays ricochet around the scene eachintersected surface is added to a binary ray-tracing tree
The left branches in the tree are used torepresent reflection paths
The right branches in the tree are used torepresent transmission paths
The trees nodes store the intensity at thatsurface
The tree is used to keep track of allcontributions to a given pixel
-
8/12/2019 Graphics18-Raytracing
15/22
15
of
50Ray-Tracing Tree Example
S3 S4
S1 S2
Projection
Reference Point
-
8/12/2019 Graphics18-Raytracing
16/22
16
of
50Ray-Tracing Tree Example (cont)
ImagestakenfromHearn&B
aker,ComputerGraphicswithOpenGL(2004)
-
8/12/2019 Graphics18-Raytracing
17/22
17
of
50Ray-Tracing Tree (cont)
After the ray-tracing tree has beencompleted for a pixel the intensitycontributions are accumulated
We start at the terminal nodes (bottom) ofthe tree
The surface intensity at each node isattenuated by the distance from the parent
surface and added to the intensity of theparent surface
The sum of the attenuated intensities at the
root node is assigned to the pixel
-
8/12/2019 Graphics18-Raytracing
18/22
18
of
50Ray Tracing Demo
Theres 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.html
http://www.siggraph.org/education/materials/HyperGraph/raytrace/rt_java/raytrace.htmlhttp://www.siggraph.org/education/materials/HyperGraph/raytrace/rt_java/raytrace.html -
8/12/2019 Graphics18-Raytracing
19/22
19
of
50Summary
-
8/12/2019 Graphics18-Raytracing
20/22
20
of
50
NNuuR 2
NuT ir
ir
r
i
coscos
ir
ir
2
2
cos11cos
-
8/12/2019 Graphics18-Raytracing
21/22
21
of
50
suPP 0
prppix
prppix
PP
PPu
-
8/12/2019 Graphics18-Raytracing
22/22
22
of
50
ImagestakenfromHearn&Baker,ComputerGraphicswithOpenGL(2004)