AOH :: RENDER.TXT
Ray tracings and fractals: a primer
|
July 14, 1991
Ray Tracings and Fractals: A Primer.
The world of 3D graphics is not only exciting and beautiful, but it
provides us with useful models for many kinds of objects and
phenomena that occur everyday in the real world. For years
scientists and graphics designers have used computer generated
models to help them further their understanding and appreciation of
naturally these phenomena. Ray Tracings and Fractals have been
used in film, astronomy, mathematics, architectural design, art,
and in many other fields as well. Let's begin with an explanation
of a ray tracing and move on later to the fractals.
To be blunt, a ray tracing, or ray traced image, is an image that
has been created or "rendered" using an algorithm that emulates the
laws of optics and light. A ray tracing is really a rendering
algorithm that allows you to create an image from a description of
a scene that is specified by the artist, scientist, or enthusiast.
The ray tracing algorithm is not really very new to the computer
world, in fact it is one of the oldest rendering algorithm's around
- it's advantages being it's ability to render very realistic
looking images, although it is slow and has some trouble with
handling "diffuse" surfaces and lighting characteristics (more on
this later.) You may or may not have heard of other rendering
algorithms, Z-Buffers and Radiosity being two of the others, each
having their own advantages and disadvantages.
Now let's take a close look at the idea behind ray tracings. First
of all, you must always create some description of a scene that you
want to render using the ray tracing algorithm - for our purposes,
the ray tracing algorithm is really a program we use on our
computers - like DKB Trace or Vivid for example. A scene must be
comprised of some basic elements, the first of which is a point of
view or "camera", the camera has a location and a direction that it
is pointing towards and in some cases (Vivid for instance) it can
have a field of view, focal point, aperture, etc. Now remember,
all this takes place in a 3D coordinate system where you have X,Y,Z
coordinates. The other basic element that must reside in a scene
is a light source, light sources can be varied (spot, directional,
omni, etc), even ambient light can be set for the scene. The last
requirement for a scene would be some kind of object, whether it be
a simple sphere or a complex set of objects that describe another
object. Objects include but are not limited to, spheres, polygons,
cones, rings, parabaloids, toruses, hyperboloids, polygonial
patches, etc.
Once you have defined an object then you would need to give the
object some kind of color or texture - color and texture can vary
widely and depending on the complexity of the program, "algorithm",
that you are using, many kinds of surfaces can be created to
emulate surfaces that exist in real life, such as wood, granite,
marble, etc. Objects can even be "surface mapped", that is where
another image or description of an image is placed or wrapped onto
an existing surface of an object. Surface mapping and texturing
objects is a whole art unto itself! There are many, many more
examples I could cite here, but let's go on know to the more
elemental idea behind ray tracing, the actual trace itself.
Well all this is fine you say! So I can create an image, but how
does the ray tracer really work? Well, if you imagine yourself in
a room and you are standing facing a white wall, and in front of
the wall is a desk and a chair and a lamp, and there is a window
behind where the light shines into the room. You look around
carefully and the first thing you notice is your shadow being cast
on the floor, you also notice subtle shadows around the room, the
desk, the chair and the lamp all cast shadows be they long or
short. You also begin to notice that the light is not really
equally distributed throughout the room, some objects seem to
receive more light and others less; you also notice that some of
the objects seem to interact differently with the light, in other
words, some objects are dull and don't reflect much light and some
object are shiny and reflect a lot of light, and some objects
refract the light, like the window that is behind you!
Basically, a ray tracing works in much the same way, all rays are
shot from the light source in theory, although in reality, for the
purpose of saving time, the rays are actually traced back *to* the
light source. In other words, when you begin to render a
description of scene, the ray tracer treats each pixel as a
separate entity, each light source transmits rays of light, but
that doesn't mean that you will see where all these rays eventually
wind up! Not all the rays make it back to the screen (the point of
view, or the camera) and so most ray tracers "bound" a scene so as
to cut back on unnecessary work. One of the more interesting
aspects of a ray tracer is that you can sometimes see objects that
are not actually within the cameras field of view, these objects
may be reflected in other objects that *are* in the scene and this
can make for some very interesting effects.
Thus, all light rays are to a degree, either reflected, refracted
or transmitted. Surfaces that reflect the light are very shiny, or
specular like a mirror which reflects %100 of the light, or a
polished stone for example. Surfaces that refract light would be
glass or water or clear plastic. Surfaces that "transmit" light
are called diffuse surfaces, like a dull wooden desktop, and
surfaces that reflect are know as specular. Specular and diffuse
reflection are both handled by the ray tracer, although ray tracers
do have some problem emulating diffuse inter-reflection, like the
uneven quality of light in the room - but this is often overcome by
using global ambient light, the only problem with global ambient
light is that it tends to make objects look flat and takes away
from some of the 3D realism we love so much with the ray tracer -
the radiosity algorithm is an example of a rendering algorithm that
does a much better job at handling diffuse inter-reflection.
So when considering ray tracings on a personal computer, one must
realize the current limitations of the system that is being used -
ray tracings are computationally high in overhead, thus, it never
hurts to have a fast machine, and a math co-processor will usually
speed up your traces anywhere from 3-6 fold! Nevertheless, even
within the confines of 256 colors, ray tracings can be staggering,
breathtaking, beautiful and sometimes downright eerie - try viewing
them in true color, on a 24 or 32 bit system and you will just be
amazed. Ray traced images are not difficult to create, it just
takes a rudimentary knowledge of 3D coordinates, some patience, and
a little creativity. Experiment, tinker around, don't be afraid to
try anything, after all, its' all in good fun!
The second part of this primer is coming soon: Fractals and Fractal
Geometry.
Create!
Regards,
÷Data÷
I can be reached at:
Tychaen's Rift - Your Gateway to the Imagination.
(415) 524-2780 HST Dual Standard 14.4K v.32 v.32bis v.42 b.42bis.
P.S. This document was created one afternoon while I was <grin> not
so busily at work! I take no responsibility for any technical or
other misinformation provided here, if I blunder occasionally,
well, so be it. But if you do have any comments or questions
regarding this primer please feel free to post them in the Ray
Tracing and Fractals message area here on the BBS.
For a basic reference work and introduction, I recommend Andrew S.
Glassner's "3D Computer Graphics: A User's Guide for Artists and
Designers - 2nd Edition," Design Press, copyright 1989.
Make REAL money with your website!
The entire AOH site is optimized to look best in Firefox® 2.0 on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2008 AOH
We do not send spam. If you have received spam bearing an artofhacking.com email address, please forward it with full headers to abuse@artofhacking.com.
