Ray Tracing
-
Upload
jack-sweeney -
Category
Documents
-
view
8 -
download
0
description
Transcript of Ray Tracing
1
Ray Tracing
2
Photo-Realism
Created by David Derman – CISC 440
3
Created by Jan Oberlaender – CISC 640
4
Created by Jan Oberlaender – CISC 640
5Created by Donald Hyatt http://www.tjhsst.edu/~dhyatt/superap/povray.html
6
RAY Tracing
Ray Tracing :
Ray tracing is a method for calculating the path of waves or particles through a system.
RAY
7
Sun Ray
8
Types of Rays
Ray tracing in Physics:
Which is used for analyzing optical and other systems.
9
Types of Rays
Ray tracing Graphics :which is used for
3D image generation
10
11
Ray tracing Graphics
12
How it Works
Ray Tracing :technique use for
generating an 3-D image by Tracing the path of Light through Pixels in an Image Plane and simulating the effects of its encounters with virtual objects.
13
Introduction
Ray Tracing based rendering method for generating realistic images on the computer.
In ray tracing, a ray of light is traced in a forward and backwards direction.
14
Overview
Forward Ray tracing Rays from light source
bounce of objects before reaching the camera
Computational wastage
Backward Ray tracing Track only those rays
that finally made it to the camera
Courtesy: Angel
15
Ray Tracing
We start from the eye or camera and trace the ray through a pixel in the image plane into the scene and determine what it intersects.
The pixel is then set to the color values returned by the ray.
If the ray misses all objects, then that pixel is shaded the background color.
16
Ray Tracing
Sometimes a ray misses all objects
17
Ray Tracing (contd.)
Sometimes a ray hits an object
18
Ray Tracing (contd.)
Sometimes Ray intersect point`s and Reflect Back To Light Source.
19
Ray Tracing (contd.)
Shadow rays intersect another objectFirst intersection point in shadow of the
second object
20
Ray Tracing (contd.)
Reflected ray generated at point of intersection
Tested with all the objects in the scene
21
Ray Tracing (contd.)
Local illumination model applied at the point of intersection
22
Ray Tracing (contd.)
Transparent objectGenerate a transmitted ray and test against
all objects in the scene
23
Effects Of Ray on Object
When Ray Hit the Surface of an Object it produce different effect`s.
Reflection.Refraction/Transmission.Shadow
24
Reflection
25
Reflection
Created by David Derman – CISC 440
26
Reflection
Created by David Derman – CISC 440
27
Reflection
Created by David Derman – CISC 440
28
Reflection
Created by David Derman – CISC 440
29
Refraction
Bending of light rays as it crosses interface between media having different refractive indices
Snell’s Law
c1,c2 – Refractive
index
2211 sinsin cc
Courtesy F.S. Hill, “Computer Graphics using OpenGL”
30
Refraction
31
Refraction
32
Adding shadows
Shadow Feelers :
A shadow feeler is a ray sent from a point u on the surface of an object towards a light source to determine whether the light is visible from the point u or whether it is occluded by intervening objects.
33
Shadow Feeler
If the shadow feeler hits an object before reaching the light, then the light is presumed to be occluded by the object so that the point is in a shadow.
34
Shadow Effects
35
Angle Dependent Reflection
36
Angle Of incident
<180
<90
37
Ray object intersection
Equation of a ray “S” is the starting point and “c” is the direction of the
ray, t is angle Given a surface in implicit form F(x,y,z)
plane: sphere: cylinder:
All points on the surface satisfy F(x,y,z)=0
ttr cS
1,, 222 zyxzyxF
101,, 22 zyxzyxF
ddczbyaxzyxF xn,,
38
Ray Tracing Algorithm Begin tracing.
Construct a ray through each pixel in the scene. Pixel color = result of tracing the ray
Tracing the ray Find intersection of ray with closest object in the
scene. Compute intersection point and normal at the
intersection point. Shade the point.
Shade the point For each light…
Determine if point is in shadow relative to light source. Using illumination model, determine color at the intersection
point.
39
Ray Tracing Algorithminteger i, j;
ray r; { defines starting point and direction of ray }
point eyePt, hitPt;shape pointer hitObjP;real array I [XMIN .. XMAX, YMIN .. YMAX];
for i:=YMIN to YMAX do
for j:=XMIN to XMAX do
begin
ComputeRay (i,j,r);FirstIntersection1 (r,hitPt,hitN,hitObjP);
if hitObjP π nil
then I[i,j] := Shade (eyePt,nil,hitPt,hitN,hitObjP,1)
else I[i,j] := background
end;procedure ComputeRay (integer i, j; ref ray r)
{Computes the ray r (in world coordinates) from the eye defined by the (i,j)th pixel} procedure FirstIntersection1 (ray r; ref point hitPt, hitN; ref shape pointer hitObjP)
{Returns a pointer hitObjP to the closest object intersected by the ray r, the point hitPt
on that object where the ray intersects it, and the surface normal hitN at that point.Use bounding boxes for projected objects in view plane to speed up computation} .