Embed
Email

RAY TRACING

Document Sample

Shared by: panniuniu
Categories
Tags
Stats
views:
0
posted:
12/2/2011
language:
English
pages:
22
The Theory Of

RAY TRACING

Outline

In this presentation we will address:

Why ray tracing? The reasons that ray

tracing was developed.

How does it work? The method behind

the operation of ray tracing.

What are the pros and cons? Reasons

for and against the use of ray tracing.

Alternatives? Other methods of image

generation.

Brief History of Ray Tracing

1637 – Descartes uses ray tracing techniques to

describe the formation of rainbows (Descartes, 1637).

Subsequent work by Newton on optics used

similar techniques to define refraction and the

colours found in a rainbow.

1968 – Arthur Appel develops ray casting for

lighting 3D models.

1979 – Turner Whitted extends the concept of

ray casting and deveolps ray tracing.

What is Ray Tracing?

“Ray tracing provides a…powerful approach to rendering scenes”

Computer Graphics using Open GL

Hill & Kelley, 2007



Ray tracing is a global

illumination model

capable of rendering

photo-realistic images.

The rays originate from

the viewers perspective

meaning that only that

which is visible is Scene developed using ray tracing

Image from: Wikipedia

rendered.

Why ray tracing?

Global Illumination

Whereas other algorithms deal only with direct

lighting, ray tracing can also handle in-direct

lighting between objects.

This is where light may reflect off or pass through

one object to partially light another.

Light source





Direct lighting

Indirect lighting





A B

Why ray tracing?

What ray tracing can do for you

Ray tracing simulates natural lighting.

When a ray collides with an object there are 2

types of ray that may be created:

 Reflection



 Refraction



These can be very difficult to simulate with other

algorithms.

How does ray tracing work?

To view a scene

Within a scene, light will travel from the source,

interact with objects and finally be seen by the

viewer or viewpoint.

That could mean a person, a camera or a screen.

Light source









Light path

A

Viewer

How does ray tracing work?

Tracing the light

In the real world, the light path travels from the

source to the viewer.

However in computer graphics tracing all light

paths could result in a lot of wasted effort!

Light source









Light path

A

Viewer

How does ray tracing work?

The Basics

Ray tracing works the other way, following a series

of rays from the viewer to the objects in a scene.

The points at which the rays strike the objects are

then displayed to the viewer.



Light source



Initial ray

Light path



A

Viewer

How does ray tracing work?

Lighting Simulation

To simulate lighting effects, the rays interact with

the objects in a scene spawn new rays which go

on to seek more objects.

Spawned rays can simulate reflection and

refraction.

Light source









A

Viewer

Semi-transparent object Initial ray

Reflected ray

Refracted ray

Light path

How does ray tracing work?

Ray termination

Because ray tracing is a recursive process, a

termination clause is required.

This can be:

 The „energy‟ of a ray



 The ray exits the scene



 The ray hits a completely non-specular



(diffuse) surface

 Preset ray trace depth is reached

How does ray tracing work?

Hidden surface removal

Ray tracing has the advantage of not wasting time

and computational effort rendering surfaces that

are hidden from view.

Rays only strike the surfaces that the viewer is

able to see so only those surfaces are displayed.

B

Back surface of objects A and B and all of object C

are occluded due to viewer position.







A C Initial ray

Viewer Reflected ray

How does ray tracing work?

Shadow calculation

By examining the position of the light source in

relation to the point at which the ray intersects with

a given object, we can easily calculate the

shadows cast on that object.



Light source

B

Object A will be partially shaded

by object B.





Initial ray

A Reflected ray

Light path

Viewer

Pros and cons

Advantages

Simulation of lighting effects such as reflection and

refraction are generated as part of the algorithm.



The algorithm itself is relatively simple:

while (!termination_condition)

if (ray_intersection)

calculate_local_intensity_value

calculate_reflected_ray

calculate_refracted_ray

alter_termination_parameter

Pros and cons

Advantages

Ray tracing can be performed using parallel

computation.

Because each ray can be treated individually, they

can be processed in parallel.

This can improve the speed of the algorithm.

Pros and cons

Disadvantages

The main disadvantage of ray tracing is the

performance of the algorithm.

Typically it uses a very large number of rays, all of

which have to be calculated and all of which

spawn further rays when they intersect with an

object, it can very quickly become a very large

computational problem.

Pros and cons

Disadvantages

Because of that, ray tracing cannot be used

in real time, only where still images need to

be rendered.



Ray tracing cannot handle diffuse surfaces.

When a ray encounters a diffuse surface, it

is dispersed so there will be no reflection of

colour from that surface.

Alternatives

Ray casting

The forerunner to ray tracing, ray casting was

developed for lighting 3D models.

It works in a similar way but rays stop on their first

encounter with an object – that point is then

displayed to the viewer.

This means that it does not handle reflection and

refraction as ray tracing does but it is much quicker

and less computationally complex.

Alternatives

Radiosity

Named for the process of energy transfer

between surfaces.

In this case the energy is the light in the

scene.

Although radiosity is very good at handling

diffuse surfaces (unlike ray tracing), it does

not, in its standard form, handle specular

reflections or refractions.

Other considerations

Anti-aliasing

Ray tracing can handle anti-aliasing (the process

of smoothing edges on screen) by „firing‟ more

rays through each pixel.

Instead of using one ray per pixel from the viewers

perspective, multiple rays will provide a collection

of values from which an average can be taken.

The downside of this is that there are more rays to

be dealt with, therefore an even greater

computational load.

Other considerations

A View to the Future

The main aim for the future of ray tracing is to

reduce the time it takes to computer and thereby

allow it to be used in more real-time applications.



This would allow the generation of very high

quality images “on the fly” in environments such as

games and real-time simulations.

References

1. Descartes, R. (1637). Discourse On The Method, Meteorology appendix.

2. Hill & Kelley, (2007). Computer Graphics using Open GL. 3rd Edition.

Prentice and Hall.

3. Dr Yonghaui Liu, Aberystwyth University, Computer Science Dept (2009).

Lecture notes on Global Illumination.

4. Notes on Newton and ray tracing - http://www.philiplaven.com/p8e.html

(last accessed 16/11/2009)

5. Image from Wikipedia article on ray tracing (last accessed 15/11/2009).



For more information on ray tracing developments, see the Ray Tracing

News edited by Eric Haines (last accessed 15/11/2009).



Related docs
Other docs by panniuniu
Valuation of contingent claims and the
Views: 0  |  Downloads: 0
excel sample
Views: 0  |  Downloads: 0
Bare
Views: 0  |  Downloads: 0
Ch14
Views: 0  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!