Ray Tracing

39
1 Ray Tracing

description

Ray Tracing. Photo-Realism. Created by David Derman – CISC 440. Created by Jan Oberlaender – CISC 640. Created by Jan Oberlaender – CISC 640. Created by Donald Hyatt http://www.tjhsst.edu/~dhyatt/superap/povray.html. RAY Tracing. Ray Tracing : - PowerPoint PPT Presentation

Transcript of Ray Tracing

Page 1: Ray Tracing

1

Ray Tracing

Page 2: Ray Tracing

2

Photo-Realism

Created by David Derman – CISC 440

Page 3: Ray Tracing

3

Created by Jan Oberlaender – CISC 640

Page 4: Ray Tracing

4

Created by Jan Oberlaender – CISC 640

Page 5: Ray Tracing

5Created by Donald Hyatt http://www.tjhsst.edu/~dhyatt/superap/povray.html

Page 6: Ray Tracing

6

RAY Tracing

Ray Tracing :

Ray tracing is a method for calculating the path of waves or particles through a system.

RAY

Page 7: Ray Tracing

7

Sun Ray

Page 8: Ray Tracing

8

Types of Rays

Ray tracing in Physics:

Which is used for analyzing optical and other systems.

Page 9: Ray Tracing

9

Types of Rays

Ray tracing Graphics :which is used for

3D image generation

Page 10: Ray Tracing

10

Page 11: Ray Tracing

11

Ray tracing Graphics

Page 12: Ray Tracing

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.

Page 13: Ray Tracing

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.

Page 14: Ray Tracing

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

Page 15: Ray Tracing

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.

Page 16: Ray Tracing

16

Ray Tracing

Sometimes a ray misses all objects

Page 17: Ray Tracing

17

Ray Tracing (contd.)

Sometimes a ray hits an object

Page 18: Ray Tracing

18

Ray Tracing (contd.)

Sometimes Ray intersect point`s and Reflect Back To Light Source.

Page 19: Ray Tracing

19

Ray Tracing (contd.)

Shadow rays intersect another objectFirst intersection point in shadow of the

second object

Page 20: Ray Tracing

20

Ray Tracing (contd.)

Reflected ray generated at point of intersection

Tested with all the objects in the scene

Page 21: Ray Tracing

21

Ray Tracing (contd.)

Local illumination model applied at the point of intersection

Page 22: Ray Tracing

22

Ray Tracing (contd.)

Transparent objectGenerate a transmitted ray and test against

all objects in the scene

Page 23: Ray Tracing

23

Effects Of Ray on Object

When Ray Hit the Surface of an Object it produce different effect`s.

Reflection.Refraction/Transmission.Shadow

Page 24: Ray Tracing

24

Reflection

Page 25: Ray Tracing

25

Reflection

Created by David Derman – CISC 440

Page 26: Ray Tracing

26

Reflection

Created by David Derman – CISC 440

Page 27: Ray Tracing

27

Reflection

Created by David Derman – CISC 440

Page 28: Ray Tracing

28

Reflection

Created by David Derman – CISC 440

Page 29: Ray Tracing

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”

Page 30: Ray Tracing

30

Refraction

Page 31: Ray Tracing

31

Refraction

Page 32: Ray Tracing

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.

Page 33: Ray Tracing

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.

Page 34: Ray Tracing

34

Shadow Effects

Page 35: Ray Tracing

35

Angle Dependent Reflection

Page 36: Ray Tracing

36

Angle Of incident

<180

<90

Page 37: Ray Tracing

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

Page 38: Ray Tracing

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.

Page 39: Ray Tracing

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} .