Basically, this method traces many, many light rays through a 3 Dimensional (3D) world. It imitates what a photo would look like if a camera was put at a given location in the world. You can also place lights in the world, and even aim spotlights at certain objects.
Using ray-tracing, you can create a virtual photography studio in your computer, then generate a picture that simulates what a photo of that 'world' would look like.
The basic idea of ray tracing is to trace light rays through a scene to determine the visibility of an object on the screen. The object is then shaded according to surface characteristics and each light's color and location. Ray tracing is based on the principles of light and optics. The pictures get their realism from the reflections and refractions ray-tracing generates. The name of the technique comes from the process of tracing light rays according to the laws of physics.
Since the number of light rays entering a scene may be considered infinite, a shortcut is used, namely, tracing the light rays backwards thru the scene. With this method, a ray is traced from the eye, through a pixel in the view plane (the monitor screen) and intersected with the objects in the 3D world. Of the objects that do intersect the viewing ray, the visible surface would be the one that is closest to the eye and therefore is the one that we shade according to the lighting. If this surface is reflective or transparent, we make new rays, trace them, and shade the newly intersected surface. This process is repeated for each pixel in the view plane.
With ray tracing, while we can describe objects to the computer and generate images that look quite real, remember that these objects do not really need to exist at all, a 'world' can be created in your computer's memory that does not exist in reality.
The actual shading calculations involve 3D geometry, measuring the angle between a surface and a light. Also, the angle to the eye becomes involved in some calculations. Light intensity is also dependent on on how far it is from the surface.
Todays research revolves around speed improvements, animation control, and ease of use. Also, a few 'radiosity' renderers are appearing on the market... these are something a bit different than ray-tracing. Some of the most realistic images I have ever seen were done with a combination of radiosity and ray-tracing.
Some of the earlier uses of ray-tracing were for film production in movies and commercials, and high-dollar engineering companies doing research. Over the past 5 years an explosion has happened in a variety of markets. While some engineering uses don't need the detail of ray-tracing, and get by with 'flat shading', there are many that do, like architectural design. Medical applications are also growing
These chapters are to help you understand some of the workings of the eye, light, color, and stereo vision. You may be surprised to see how extraordinary SIGHT really is as one of our senses.
There is one man that cannot be left out of any discussion of light, and our perception of light, and that man is Sir Isaac Newton, a great genius. He observed some things about light that you may even find hard to accept at first. If you think they're hard to accept, realize that since the time of Aristotle, white light had been regarded as the very essence of purity, and Newtons' experiments showed otherwise. Perhaps because of the fury he caused, Newton waited more than 30 years before publishing his complete works, Opticks, in 1704. Here is a short quote from Newtons' paper 'Opticks':
... the rays, to speak properly, are not coloured. In them there is nothing else than a certain Power and Disposition to stir up a Sensation of this or that Colour. (Newton, 1704/1952, pp. 124-125)This implies that light rays and objects themselves do NOT have any color, nor do the light rays reflected from those surfaces. Instead, COLOR is a psychological phenomenon. Objects APPEAR colored because they REFLECT waves from different regions of the color SPECTRUM. Our eye then takes this 'mix of waves', and through the mystery of the eye and brain, we 'perceive', or 'see' a particular color.
So the old adage, 'Does a falling tree in the woods make a sound if there is no 'ear' in the area to 'hear' it', applies the same to light. The answer of course is in your definition of 'sound' or 'light', and whether your definition includes the perception of the phenomenon, or just the physical activity of 'waves' in nature.
To continue, we need to ask the question, WHAT IS LIGHT?? Scientifically, light rays are classified as ELECTROMAGNETIC WAVES, much the same as the 'radio waves' from your favorite AM/FM station. Electromagnetic waves travel similar to sound waves also, even like the ripples (waves) produced when a stone is dropped into a quiet pond.
Light rays usually travel in patterns, with the first example being the sun. Since the sun is so far away, the waves are traveling virtually parallel to each other, much like rain falling.
As mentioned earlier, Newtons' experiments proved white light is not pure. Basically, he aimed a white light through a prism and created a 'rainbow' of light, covering the full spectrum of colors. Though this effect had been known for centuries, for example, from diamonds and soap bubbles, Newton devised ways to examine the workings of LIGHT, using prisms.
/* Prism picture1 (not yet present) */
The basic effect of a prism. Here the white light entering the prism is 'bent' or 'refracted' differently, depending on the WAVELENGTH of the individual waves. This results in the wavelengths exiting the prism differently, to a flat surface for observation. We see the different wavelengths as different colors.
/* Prism picture2 (not yet present) */
This shows how the separated wavelengths may be re-mixed to produce 'white' light once again.
/* Prism picture3 (not yet present) */
Newton's test is shown here simplified. Most important is that he has added another prism, and an opaque piece with a small hole in it. The convex lens is also important, in that it apparently allowed him to better focus the colors for experimentation. The experiment shows that white light was broken down into it's COMPONENTS by a prism, and that each component (e.g., green) cannot be broken down further. Consequently, Newton correctly labeled these components as PURE and 'white' as a mix of many assorted colors.
The way we see direct light, coming straight from a light source, is a little different in the way we see light REFLECTED from objects around us. Now we need to examine what happens when these electromagnetic waves we call light hit a surface.
/* Light scattering 1 (not yet present) */
Depending on the surface material, rays will be scattered, they will be absorbed, and they may be reflected at the SPECULAR ANGLE. Transparent and refractive materials also pass light from the BACK of a material. A surface appears colored because it absorbs certain wavelengths of light, and reflects others. For example, a piece of paper we would call 'red' REFLECTS red light, and absorbs green and blue. If you had a pure red surface, and viewed it under a green and/or blue light, the surface color would appear completely black. Because.....
It is the scattered light that is called the DIFFUSE reflection, and the light reflected at the specular angle that is the SPECULAR reflection. These are the main components of light reflection and determine the 'dullness' or 'shinyness' of a surface material. Diffuse is the dull, smoother illumination, while specular is the 'glossy hi-lites' you see.
Color influences a great many things in our lives. For example, tests have proven that color can alter the taste of your food and drink, affect your expectations about medication, and even aid the relief of pain. Expressions we all know, may in fact have their basis in truth, like 'green with envy', feeling 'blue', or 'seeing red' with anger.
Everyday language gets by with about a dozen color names, beyond this, people don't really agree what names go with what colors. If you view single color samples a few seconds apart, you will reliably recognize only this dozen or so. But when viewed side-by-side, most people can distinguish between over a thousand colors samples.
When we speak of 'color', we are trying to communicate the three qualities in color, namely, intensity, hue, and saturation.
Hue is the quality that distinguishes red, green, blue, yellow, and so on. This quality is what most people would call 'color' in everyday language, though color is not an acceptable substitute for the word 'hue' when describing colors.
Intensity is easy to understand, it is the brightness. For example, if you are reading near a lamp, and find it too dim, you may turn on another light. This has changed the INTENSITY of the light, but not the HUE.
Saturation is different than hue, though closely related to it. Saturation is the difference between a color we might call 'pale' or 'pastel', and a color we might call 'vivid'. Wash your jeans in bleach, and they come out LESS saturated than when they went in. Saturation is achieved by subtracting white from a specific hue. White can be added until the hue reaches white, at which point we say the color is 'desaturated'. So, a dark red and a pale pink may have the same hue, but different saturation levels, with pink almost fully desaturated.
Having two eyes provides us with a way of perceiving depth, or distance. This judgement is required many times a day, for example, when driving a car, or reaching for a pencil. Humans are very accurate in their perceptions, if you placed two pencils side-by- side about a meter away, the keen judgement of your brain can detect when a pencil is placed only 1 millimeter closer. Some occupations demand the most of this part of the senses, like race car drivers, airline pilots, and a football quarterback (besides a good arm!)..
Stereo vision works because we have two eyes, with each eye receiving a slightly different image, and then the brain combines both images to complete the procoess. The difference between the two images is minimal since your eyes are only about 3 inches apart, but it is quite enough to do the job. If a person is blind in one eye, they lose most of their capability for depth perception.
Lighting: ( diffuse, specular, and global ) When a renderer calculates a scene, at least 1 light component must be present. As in the real world, if there is no light, nothing can be seen! There are several different lighting components that contribute to the total intensity calculation for an object in the scene. These are: Ambient Lighting. Diffuse Lighting. Specular Lighting. Reflective. Translucent. Radiant. Ambient lighting : In the real world, a lot of light bounces around you and illuminates more than just what the light directly shines on. For example, look under a table. What do you see ? Well it doesn't really matter, the point is you can at least see under the table and see the floor, and maybe you leaned down far enough to see the bottom of the table. Most probably, you don't have a light under the table, but you can still see things under it. How did the light get there for your eye to see ? The light started at the sun and came in a window, or it started at a lamp in your room. Then it bounced around your environment, off a few items, and scattered all around your room to create a general level of light. This light is called the 'ambient light'. Now, really, the ambient intensity is not the same all over the room, but it is probably pretty even. We usually use a small amount of ambient lighting in a scene to be sure all surfaces will get some light and will be visible (remember, if there is NO light on a surface, that surface will not even be visible). In most programs, we assume the ambient lighting to be the same everywhere in the scene, not dependent on the 'light bouncing around a room' effect. When you specify ambient lighting, you specify the red, green, blue, and intensity. All objects in the scene will be lit with this ambient lighting. Ambient lighting is usually a small to medium contribution in a scene. Besides Ambient lighting, there are two other direct contributors to the lighting of a surface, diffuse and specular lighting. Diffuse : Diffuse lighting is usually the major contributor to the light you see reflecting off of an object. Diffuse illumination on a surface does not change if you change your viewpoint. Specular : Specular illumination is usually a small contributor to the amount of light you see reflected off an object, but it is very important to have it present to try and generate images with a high degree of realism. To make an object look shiny, make the specular contribution high, and maybe the diffuse contribution low. Set the COEFFICIENTS for this. Notice that as you move your eye around, specular light reflections move also. Other References: These references are all landmark papers in the field, and contain lot's of valuable information. Be ready to search for them (unless you live near something like a state university library), and be ready to think while you do your reading. For a summary of these and other references, try this book: Foley, J. D., and A. Van Dam. Fundamentals of Interactive Computer Graphics. ---------------------------------------------- Addison-Wesley, Reading, Massachusetts. (T385.F63) A very good introduction - summary. Good technical descriptions. NOTE: There is a newer Foley, Van Dam book. Hall, R. A., and Greenberg, D. P. A testbed for realistic image synthesis. IEEE Computer Graphics and Applications 3, 10, Nov. 1983, Pages 10-20. --------------------------------------- An informative article, touching many bases. In many ways a summary of his (Hall's) Master's Thesis listed elsewhere in this reference. Describes Hall's improvement on the Whitted lighting model. Bui Tuong Phong. Illumination for Computer-Generated Images. PhD dissertation, University of Utah, Salt Lake City, 1971. ---------------- One of the first lighting models to do more than calculate surface to light angle, it could simulate the global, diffuse, and specular lighting components. Turner Whitted. An Improved Illumination Model for Shaded Display. Communications of the ACM, Vol. 23, No. 6, June 1980, Pages 343-349. ------------------------- Improves on Phong's lighting model. James F. Blinn. Models of Light Reflection for Computer Synthesized Pictures. Computer Graphics (Proc. Siggraph '77), Vol 11, No. 2, Summer 1977. ----------------- Comparison of a couple lighting models. I. E. Sutherland, R. F. Sproull, and R. A. Schumaker. A Characterization of Ten Hidden-Surfaces Algorithms. Comput. Surv. 6, 1, March 1974, Pages 1-55. ------------ Great summary of different image generation shortcut's, their features and problems. Roy A. Hall. A Methodology for Realistic Image Synthesis. Master's Thesis, Cornell University, 1983. --------------- An excellent reference, with emphasis on color calculation. Improves upon the Whitted lighting algorithm. Hank Weghorst, Gary Hooper, and Donald P. Greenberg. Improved Computational Methods for Ray Tracing. ACM Transactions on Graphics, Vol 3, No. 1, January 1984, Pages 52-69. ---------------------------- Good reference describing heirarchical 3-D databases, and their use in ray tracing. Peter Beckmann and Andre Spizzichio. The Scattering of Electromagnetic waves from Rough Surfaces. ----------------------------------------------------------- MacMillan, New York, 1963, Pages 1-33, 70-98. This reference is where much of the basic idea of tracing rays to to simulate light rays came from (light rays are electromagnetic waves). This is the earliest reference in the list. Franklin C. Crow Summed-Area Tables for Texture Mapping. -------------------------------------- Computer Graphics Published by the ACM. V.18 #3, July 84. A paper describing improvements that can be made to the texture mapping process. And don't forget, MANY assorted math, calculus, and physics books.....
Return to Doc Raster's home page.
All contents Copyright © 1996 by Brian Reed, except where noted. All Rights Reserved.