Home | Computer Graphics | Adventures in Ray Tracing | 00: Adventures in Ray Tracing 02: The Basics 03: The Process of Image Creation 04: Orientation in POV-space 05: A First Image 06: Some enhancements 07: Changes to the Interior of Objects 08: Constructive Solid Geometry 09: More about lenses 10: Animation 11: Anaglyphic 3D 12: Virtual Telescope I: Galilean 13: Virtual Telescope II: Cassegrain 97: Anaglyph Generator Perl Script 99: Full-Size Title Image Share This Page

Click above image for 3D ()

Lenses are a nice addition to a ray tracing scene, so perhaps we should learn a little more about them. As explained previously, lenses cause light to change course by delaying the passage of light wavefronts. This page will show how to choose the right sphere sizes to get a lens of a particular diameter and having a particular focal length.

As it turns out, not by chance, the designers of lenses think of their subject the same way POV-Ray does — by picturing lenses as overlapping spheres, spheres having radii that determine their optical properties. The most basic equation of the lensmaker's art assumes two spheres, with radii r1 and r2 and a particular index of refraction (ior). Armed with these values and a basic equation, we can compute the focal length (fl) of a lens. Here is the equation:

fl =    1
 (ior-1) ( 1r1 - 1r2 )

To use this equation, provide the index of refraction and two sphere radii, remembering that in lens computations, radii have signs — for a convex lens with spherical surfaces, one of the two radii is given a negative sign (because one lens surface has positive curvature and one negative).

But, having provided the most basic equation of the lensmaker's art, it occurs to me that most of you would prefer not to perform this kind of computation manually, so here is an easier approach, a calculator built into this page:

Enter desired values: