Soon, we will launch a new and updated customer portal, which is an important step toward providing our customers with one place to learn, interact, and get help.
Learn more.

Modeling Frustrated Total Internal Reflection in Non-Sequential Mode

This article describes how to model evanescent field effects like frustrated total internal reflection in Zemax. This is useful in applications like fingerprint scanners.
Mike Tocci
Polarization and Thin Film Coatings


Total Internal Reflection (TIR) is a phenomenon where a light ray is caused to reflect completely (100% reflection) when the light ray is traveling inside a higher-index medium and strikes a surface boundary into a lower-index medium.  When the light strikes this surface boundary at a certain angle (or greater angles), the light is completely reflected back into the higher-index medium.

Some optical systems (such as light pipes and reflective prisms like the Pechan) depend on this total internal reflection, to keep light contained inside a higher-index medium (such as glass or plastic), preventing any light from escaping into the lower-index medium (such as air).  Other optical systems (such as fingerprint scanners) take advantage of the fact that TIR can be spoiled, by bringing another higher-index object into near-contact with the medium that contains the light.  When this happens, and some of the light that should be totally internally reflected actually escapes across the small airgap into the second higher-index object, the situation is called Frustrated Total Internal Reflection (FTIR).

The amount of light that can be drawn out with FTIR is dependent on many things: wavelength, airgap thickness, refractive index of each medium, and angle of incidence.  The physics behind FTIR can be complicated, but Zemax models it very accurately using simple instructions.

Please note that while this article concentrates on the use of non-sequential ray-tracing, FTIR can be modeled in sequential ray-tracing using the same techniques as described in this article.

TIR Model

We’ll begin by setting up a TIR model.  You can open the attached file “TIR_NSC_example.ZMX”, which can be downloaded from the last page of this article, to begin this example.  If you’re going to type the file in by hand instead of loading the attached file, you’ll want to first put Zemax into Non-Sequential Mode, and then you’ll want to check the Wavelength and General values (found in the System section).  Here are the values I’m using:

Object 1 is a “Rectangular Volume” made of silica, measuring 50x50x100mm. To create this object yourself, type in the following values:

Comment: Top Slab
Material: SILICA
X1 Half Width: 25
Y1 Half Width: 25
Z Length: 100
X2 Half Width: 25
Y2 Half Width: 25

It will also help to right click on Object 1, and then click on the “Draw” tab, and change the Opacity to 10%.

Object 2 is a “Source Ellipse” placed inside of the first block of Silica and aimed at a 45-degree incidence angle at the bottom face.  To create this object yourself, type in the following values:

Comment: Source
Ref Object: 1
Inside Of: 1
Y Position: 5
Z Position: 20
Tilt About X: 45
# Layout Rays: 20
# Analysis Rays: 100000
X Half Width: 10
Y Half Width: 10

Object 3 is a “Detector Rect” placed at the back end of the silica slab. To create this object yourself, type in the following values:

Comment: top slab det
Ref Object: 1
Z Position: 75
Material: ABSORB
X Half Width: 25
Y Half Width: 25
# X Pixels: 500
# Y Pixels: 500
Color: 2

The NSC Shaded Layout for this set of objects is shown below:

The NSC Shaded Model settings for this layout are as follows:

Clear the detector and trace rays (We need to make sure that the “Split Rays” and “Ignore Errors” boxes are checked every time just before we trace rays in this demonstration).  You’ll find that 100% of the light is internally reflected and hits the detector.

Two Blocks Touching

Now we’ll add some objects to the TIR model to make it an FTIR model.  You remember that in order to “frustrate” TIR, we need to have another high-index (silica) object brought into very close proximity to the first silica object.

To make the bottom slab, simply select the top slab (do this by clicking on Object 1 and dragging down and then dragging back up until the entire Object 1 row is selected), hit CTRL-C, click on Surface 2 (that’s where we want the bottom slab to go), and then hit CTRL-V.  We need to make a few adjustments now.  Change the comment of our new Surface 2 to “bottom slab” and set the Y Position value to -50.  Since the y-height of each slab is 50mm, and the center-to-center spacing is now 50mm, they will now be in direct contact with one another at their edges.  The NSC Editor should look like this:

Now we want to add a detector inside this bottom slab.  To do this, select the detector object (It should now be numbered Object 4), and copy and paste it right below (same way as before) so that the new detector copy is Object 5.  Change the “Comment” of this new detector to “bottom slab det” and then change the “Ref Object” to “2”.  Here is what the NSC Editor should look like at this point:

And here is what the layout should look like:

Because the two slabs are in direct contact, the interface has the same refractive index on either side, as hence no reflection occurs.  Our next step will be to introduce a small airgap between the two slabs in order to model FTIR.


Physically, what happens in FTIR is this: the electric field encounters a glass-air boundary and undergoes Total Internal Reflection. However, the electric field on the air side of the boundary cannot go to zero infinitely quickly. Therefore the electric field on the air side of the boundary goes to zero in a very short, but non-zero distance. If another piece of glass is placed sufficiently close to the first, the evanescent field in air couples into the second glass block and light continues to propagate.

Now normally, the reflection coefficient that a ray sees is dependent purely on the refractive index on either side of the boundary, and the angle and polarization of the ray. In FTIR however, we need to account for three materials, not two: we need both glass indices and the gap material. This is done in Zemax by adding a coating between the two glass objects.

To do this, we alter our coating.dat file, adding a new coating as follows:

COAT AIR-100nm
AIR .100 1

This coating is an airgap with a thickness of 100nm.  Add these lines to the coating.dat file, and then save the file.  It’s also a good idea to save the file with a different filename (such as coating2.dat), because each time you install a new version of Zemax, the coating.dat file will get overwritten. 

We now need to reload the coatings file in Zemax (Tools | Coating | Reload Coating File) so that Zemax knows about this new addition to the coating file.

Now we can add an airgap coating to the second slab.  Note that coating the first slab will have no effect – you must coat the second slab in order to have the airgap.  The reason is that Zemax overwrites objects as it reads through the list of objects in the order they appear in the NSC Editor.  If you were to coat the top slab with a small airgap, and then the next object in the list is the bottom slab in direct contact (as we have here) then the bottom slab “overwrites” the airgap.  If you really desire, for whatever reason, to coat the top slab with the airgap, then you would have to place the bottom slab before the top slab in the NSC Editor.

Right click (or double-click) Object 2 in the NSC Editor.  Click on the Coat/Scatter tab, and then click the drop-down box next to “Coating:” and select the AIR-100NM coating.  Note that the default Face to coat is “0, Side Faces,” which is want we want in this case.  When coating an object, always be careful to look at which Face is selected in this window.

Note that the layout plot shows both transmitted and reflected rays (make sure "Split Rays" is select in the layout plot's settings):

Clear the detectors and trace rays again.  You’ll find that only 20% of the light is internally-reflected now, and 80% of the light is “drained” across the airgap into the bottom slab.

Experimentation with the light wavelength, airgap thickness, and angle of incidence will show that Zemax gives extremely accurate results, providing the user with a powerful model for FTIR.

Wedged Airgap

Suppose you wanted to model a wedged airgap between the two silica slabs.  It might seem like the easiest thing to do would be to tilt one of the slabs, by entering a small angle value for the “Tilt About Z” of the bottom slab.  Unfortunately, that won’t work because Zemax, you’ll recall, only sees an airgap if it’s created using a coating between two surfaces that are in direct contact with one another, because it needs all three sets of material data.

The answer here is to keep the two slabs as they are (parallel and in direct contact) and then to create a new air coating that is wedged.  We do this using the TAPER coating function, specifically the [Cartesian] Polynomial Taper (PT).

Add the following lines to your coating.dat file:

PT 0 1
PT 1 0.1
AIR 0.200 1 0 LINEAR

The first three lines define a taper shape, which is linearly increasing as a function of x across the surface. 

The second two lines define a coating that has a nominal thickness of 200nm and then varies in thickness according to the taper function defined above.  Following the description of tapered coatings in the Zemax manual, we see that the thickness of the coating is actually given by the following equation:

deff = (0.2mm) * (0.1x + 1),

where deff  is the effective coating thickness and x is the distance measured in the x-direction across the surface.After adding the above lines to the coating.dat file and then saving the file, go back into Zemax and click to “Reload Coating File” again.  Change the coating on Surface 2 to “FTIR_LINEAR.” 

Now clear the detectors and run a new raytrace.

Now you’ll see that the amount of light that is TIRed varies across the surface in the x-direction.  Note that there is still a conservation of light: the sum of the total powers on the two detectors is still 1.0 Watt (46.2% on the top detector and 53.8% on the bottom detector).

Curved Airgap

We can get even more detailed! Now suppose you want to model FTIR for the case where a curved surface comes into near-contact with a flat surface. For example, you might have a slab of silica with light totally internally reflecting off the inside of the bottom surface.  You then might want to know how much light is coupled out when a slightly curved surface is brought into contact with the planar surface.

We’ll start with the original “TIR NSC example.ZMX” file, and this time we’ll add a new object (Object 4) of type “Standard Lens” with the following properties:

Comment: bottom lens
Ref Object: 1
Y Position: -25
Z Position: 50
Tilt About X: 90
Material: SILICA
Radius 1: 2.00000E+5
Clear 1: 20
Edge 1: 20
Thickness: 5
Clear 2: 20
Edge 2: 20

It will also be useful to set the Opacity of this lens object to 10%, as we did with the top slab previously.

Note that for the present example we want to see the changing FTIR effects over the beam, so we have chosen a very shallow curved surface with a 200-meter radius of curvature (ROC).

Now we’ll add a bottom detector.  Select and copy the “top slab detector” and paste it at the bottom of the NSC Editor spreadsheet (so the new detector becomes Object 5).  We’ll need to change a few things.  First, the Comment for this new detector should read “bottom detector”.  Second, we’ll change the “Ref Object” to “4”.  Finally, we need to change the “Z Position” of this new bottom detector to “1”.  This is what the NSC editor spreadsheet should look like:

Note that this lens just touches the bottom of the silica slab, but it does so at just one, infinitesimally tiny point.  Here is a Shaded Layout of our setup (note that I’ve rotated the image a little bit, to give a better view of the bottom detector inside the bottom lens):

Clear the detectors and trace rays.  You’ll notice that the rays are totally internally reflected everywhere, except in a very small area around the infinitesimal contact point.  This small area shows where the surface of lens comes within the glue distance (1.0nm in our case) of the top slab, where Zemax considers the two objects to be touching and so the rays are completely transmitted within this small area.

In order to see FTIR effects, once again we must do so with the help of coatings.  We’ll use the same trick we used for the wedge, but this time instead of a linear tapered coating, we’ll need to define a slightly more complicated spherical-sag tapered coating. 

First thing we need to do is convert our lens from a curved surface to a flat one, because, remember, the lens needs to make direct contact over its entire surface with the top slab.  To do this, we change the “Radius 1” value of our bottom lens (Object 4) to 0.000.

We now need to create a tapered coating to simulate the sag of a 200m ROC sphere, which is 40mm in diameter.  First step is to fit a 200m ROC circle to a polynomial (for the range 0 < r < 20mm, where r is the radial distance). 

Note that Zemax takes the radial distance value, r, in lens units (which in our case are mm) but it converts these to thickness units that are in microns.  Effectively, Zemax will apply a factor of 0.001 to our sag measurement when calculating coating thickness.

Therefore, to model a 200m ROC sphere, we need to fit the surface sag of a 200mm ROC sphere.  The equation for the surface sag of a sphere is

s = R - (R2 - r2)1/2

where s is the surface sag, R is the ROC of the sphere, and r is the radial coordinate.

I chose to fit this spherical lens shape to a 4th degree polynomial, but you are free to choose any number, up to 20th order, for a polynomial fit in Zemax tapered coatings.  Because we want a radially-symmetric coating, we’ll use a Radial Taper (RT) this time.

Here are a few lines that need to be added to the coating.dat file:

RT 0 1.350545e-7
RT 1 -1.964583e-7
RT 2 2.5000646e-3
RT 3 -7.6597998e-9
RT 4 1.5947742e-8
AIR 1 1 0 LENS

After adding these lines to coating.dat and then saving the file, return to Zemax and click to “Reload Coating File” once again.  Change the coating on Object 4, Face 1, to “200MM_LENS,” as shown below:

Clear the detectors and trace rays once more.

Results for the two detectors are shown below:

Note that the curved surface has drained power from the center of the beam, and note also that 58% of the beam is now drained out of the top slab.

Summary and Attachments

Zemax has the very powerful, and often overlooked, ability to accurately calculate Frustrated Total Internal Reflection (FTIR) in Non-Sequential Mode.  Through the use of coatings, FTIR across relatively complex interface shapes can be calculated.