RSL
|
Introduction
The tutorial "Reflections using trace() & gather()"
provides basic information about the use of the |
Basic CodeThe basic code for a shader that calculates raytraced refractions is given in listing 1. Listing 2 is a sample rib document that was used to render a series of images shown in figure 1, 2 and 3. |
|
|
|
Listing 1
Listing 2
The "lens" is made from a quadric disk and a hemi-sphere. To raytrace refractions correctly it is very important to ensure the surfaces that define an object face "outwards". For example, figure 4 shows refraction through a lens that has outward facing surfaces. The same lens produced the image shown figure 5 but the disk was incorrectly facing inward. |
|
|
Reality Check
An important question to answer is "how realistic are raytraced
refractions"? To find out I photographed a sheet of grid paper through
a plano-convex lens. The radius of the convex lens surface was 3 inches
and its axial thickness was 0.50 inches. The lens was suspended over the
paper with its flat surface facing the camera. The distance from the
paper to the lens and the paper to the camera were accurately measured.
The camera was oriented so that it was perpendicular to the horizontal
grid paper.
|
|
|
© 2002- Malcolm Kesson. All rights reserved.