Home | Computer Graphics | Adventures in Ray Tracing |     Share This Page

All content Copyright © 2005, P. Lutus. All rights reserved.

Click me for 3D
Click above image for 3D ()

Changes to the Interior of Objects
We will now take the image description shown in the prior page and make changes having to do with the interiors of objects, for example such things as the optical refraction property of glass. Here is the new listing:

Click Me
Click this image repeatedly to see the changes
described in this page and the previous one
Click Me
Click this image to see the difference
between converging and diverging lenses
plane {
   <0, 1, 0>, 0
   finish {
      reflection {
         rgb <0.3, 0.3, 0.3>
      }
   }
   pigment {
      checker 
      color rgb <1, 1, 1>
      color rgb <0.65098, 0.65098, 0.65098>
   }
}
light_source {
   <-3, 5, -5>, rgb <1, 1, 1>
   spotlight
   radius 20
   falloff 30
   point_at <0, 0, 1>
   area_light <1, 0, 0>, <0, 1, 0>, 4, 4
   jitter
}
sphere {
   <0, 0, 0>, 1
   interior {
      ior 1.5
      caustics 0.3
   }
   finish {
      specular 0.6
      roughness 0.05
      reflection {
         rgb <0.3, 0.3, 0.3>
      }
   }
   translate y*1
   pigment {
      color rgbt <0.415686, 1, 0.501961, 0.8>
   }
}
camera {
   perspective
   location <3, 3, -3>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1.3333, 0, 0>
   up <0, 1, 0>
   look_at <0, 1, 0>
   rotate <0, 0, 0>
              }
In this listing are changes meant to make the sphere look like a transparent glass ball. In particular, notice these entries:

sphere {
   <0, 0, 0>, 1
   interior {
      ior 1.5
      caustics 0.3
   }
   finish {
      specular 0.6
      roughness 0.05
      reflection {
         rgb <0.3, 0.3, 0.3>
      }
   }
        
Notice the block named "interior". It's not difficult to discern its purpose from its name. Within this block are "ior 1.5", meaning "index of refraction = 1.5", typical for glass. A material's index of refraction basically describes how slowly light passes through it, compared to a vacuum, which has an IOR of 1. The reader should not assume this means light travels at a different speed in glass than empty space — what it does mean is that the light takes a more circuitous route through glass, so the transit time becomes longer, leading to an informal statement that the light's speed is lower in that medium (emphasizing that light has a definite, constant speed in all media).

Because light takes longer to pass through glass than air, some parts of the light's wavefront are delayed to a greater degree, say, through the middle, thickest part of a convex lens. That part of the wavefront is delayed compared to the light at the periphery of the lens, and this in turn produces a curved wavefront as the light exits the glass. This curved wavefront either converges or diverges, depending on what shape the wavefront has been given by the glass.

Click the second image on this page to see the difference between converging and diverging lenses, click here to acquire the scene description for the converging lens, and click here to acquire the description for the diverging lens. These scenes take a very long time to render, because they exploit a special, advanced feature of POV-Ray called "global photons".

The other new feature in this example is listed above as "caustics 0.3". This feature is a relatively computationally-inexpensive way to get the appearance of refraction without performing a rigorous calculation that might take much longer. My example using lenses and photons achieves a similar result and it can be more useful if the purpose is the examine the behavior of light to a greater depth of understanding, but "caustics" is a reasonable approximation of the behavior of light in glass, water and other media — and it requires much less computer time.

In the main listing above, note the changes to the light source. Included are the modifiers "spotlight" and "area_light", each having accompanying modifiers. The "spotlight" property says that this light shines a beam with a specified width, in a particular direction. The "area_light" property specifies that this light's source is extended in space, which is primarily a way to get soft shadows, a more realistic effect than a point light source provides. This is a feature that, like most such things, slows down rendering.
 

Home | Computer Graphics | Adventures in Ray Tracing |     Share This Page