Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(EOD).Software topics.pdf
Скачиваний:
18
Добавлен:
23.08.2013
Размер:
1.55 Mб
Скачать

page 144

12.8 RAY TRACING

This method no longer uses polygons, but relies directly on the geometrical model.

The lines of light which make up the pixels of the picture, are back traced, and followed through reflection, refraction, and ambient light.

This method generates a horrendous number of calculations.

The figure on the next page shows how ray tracing is done for the first bounce, many other bounces may be performed for more realism.

Advantages,

-Realistic texture and appearances are easy to use

-This is the only display method suited to rendering curved surfaces

-The images give photograph quality

Disadvantages,

-Incredibly Slow due to large number of calculations

-Requires a very powerful computer

Support technology is being produced at a tremendous rate.

Currently used for producing pictures and videos for sales marketing, etc. Many commercials on TV are produced with this method. Used in movies, like Terminator2, the Abyss, etc.

12.8.1 Basic Ray Tracing Theory

• The theory of ray tracing has two basic concerns. Firstly, the light path is of interest, secondly the light transmitted is also of interest. These both involve interactions with real objects, thus light-object interaction must also be covered in this section. Note that in most models discussed the geometric relations are not given. Almost all of these relations are given, derived from other sources, or easily obtained with dot products.

12.8.1.1 - A Model for Diffuse Reflection of Ambient Light

• Ambient light is assumed to be evenly distributed over the entire volume of space. This naturally occurring light will provide a basic level of illumination for all objects.

page 145

Ir, Ig, Ib

Iar, Iag, Iab

Ir = Kdr Iar

Ig = Kdg Iag

Ib = Kdb Iab

Diffuse Ambient Lighting of A Surface

12.8.1.2 - A Model for Diffuse Reflection of Point Light:

• Point lighting is somewhat more sophisticated than Ambient lighting. In this case the direct light will illuminate the surface. The effect is approximated using the angle to the light source, and some constants (based on material properties) to estimate the ‘brightness’. Please note that this calculation is not done if the collision point lies in a shadow.

 

 

N

 

 

 

 

Ipr, Ipg, Ipb

 

 

 

 

 

 

 

 

 

 

 

 

 

 

L

 

 

 

 

 

φ

 

φ

 

d

 

 

(cos ϕ )K

 

 

2

1

I

= I

pr

dr

/ d

Ir, Ig, Ib

 

 

 

r

 

 

 

 

 

 

Ig = Ipg (cos ϕ )Kdg / d

 

 

 

 

Ib = Ipb (cos ϕ )Kdb / d

 

 

 

 

ϕ

= φ

1 φ 2

 

 

Diffuse Lighting of a Surface with a Point Light Source

 

 

12.8.1.3 - Collision of a Ray with a Sphere:

• The method for finding the intersection between a ray and a sphere has been covered in “An Introduction to Ray Tracing” by Glassner [1989]. Therefore, the method will only be reviewed briefly. The method is quite simple because the relationship may be explained explicitly. To state the description in the book:

page 146

i)Find distance squared between ray origin and centre,

ii)Calculate ray distance which is closest to centre,

iii)Test if ray is outside and points away from sphere,

iv)Find square of half chord intersection distance,

v)Test if square is negative,

vi)Calculate intersection distance,

vii)Find intersection point,

viii)Calculate normal at point.

This algorithm gives at worst 16 additions, 13 multiples, 1 root, and 3 compares.

12.8.1.4 - Collision of a Ray With a Plane:

• A method for ray plane intersection was used to find collisions with the checkerboard. This method was devised from scratch. The proof will not be given, but it involves a parametric representation of the line, which is substituted into the plane equation. The parameter value was then found, and the collision point calculated. The algorithm for Line - Plane intersection is given below:

Pr

N

I

Pp

Pc

A Ray Colliding with a Plane

i)The dot product between I and N is found,

ii)If the dot product is greater than, or equal to, zero then the line does not intersect the plane,

iii)The line-plane intersection parameter is calculated (the dot product may be used here),

iv)The intersection point is calculated.

This algorithm is also based on an explicit relationship, therefore it is quite fast. In the best case there are 3 multiplies, 2 adds and 1 compare. In the worst case there are 12 multiplies, 1 divide, 10 adds/subtracts.

12.8.1.5 - Mapping a Pattern

Соседние файлы в предмете Электротехника