The ‘Detector Volume’ object in ZEMAX is a very useful tool for detecting light inside a volume. It uses volume pixels, or voxels, to detect light. However, the ZEMAX interface allows these voxels to be viewed only in 2-D planes. This article will show how ZEMAX can be used, specifically through the use of a ZEMAX Programming Language (ZPL) macro, to create intricate CAD models of the voxels in a Detector Volume.
A Simple Example
Unlike the ‘Detector Rectangle’ object, which records light as it passes through square pixels arranged on a flat rectangle, the ‘Detector Volume’ object records light as it passes through cubic volume-pixels, or voxels, arranged in a rectangular solid. This detector object is more powerful than it might seem at first.
The following simple example begins with a glass rod and a point light source aimed at it. We would like to see where the highest intensity of light is, as it passes through the glass rod. In order to detect light inside the volume of the glass rod, a rectangular Detector Volume object is placed in such a way that it completely surrounds the cylindrical glass object:
A simple example setup comprising a cylindrical glass rod inside a Detector Volume
We see in the figure above that several rays pass through the BK7 cylinder, but because all rays are represented equally in the figure, irrespective of their relative intensity, it is impossible to tell from this view where most of the light energy is being absorbed. For that, we need to look at the Detector Volume.
Detector Volume Data Visualization using the Detector Viewer
The ZEMAX Detector Viewer window provides a method for viewing the data collected by the Detector Volume. Unfortunately, though, because the Detector Viewer presents its data in a 2-dimensional graph, it can only show the data for a single “slice” at once. The figure below shows a sample of what the ZEMAX Detector Viewer shows for our simple example.
ZEMAX Detector Viewer for our simple example setup
This window shows us the amount of flux inside the glass rod as a function of x/y position. At the bottom of the window, we see that this graph represents “Z Plane 5 of 10. Z = -1E-1.” ZEMAX does offer the ability to scroll through all the various Z Planes in sequence, to view the various “slices” through the Detector Volume.
There are a couple of important facts to note about this Detector Viewer window for the Detector Volume object. First, as with standard Detector Rectangle objects, it can be difficult to ascertain the orientation of the detector with respect to the rest of the setup. For example, we see that the majority of the intensity in the detector is in the left half of the screen, but which way is that in the setup? And which direction is +z in the layout?
Second, each time we select a different “slice” to view, the Detector Viewer automatically changes the scale of the false color plot so that the maximum value for each 2-D plot is represented by the color “red”. This feature can be misleading, as it automatically scales each Z Plane view so that it shows the full color range, irrespective of the relative intensity from one Z Plane to the next. To fix this, we must scan through all the Z Planes (Luckily there are only 10 Z-planes in this simple example), and take note of what the highest “Peak Absorbed Flux” value is. Then we would go to Settings and set the “Max Plot Scale” to that value.
We can figure out all the values for pixel size, location, and orientation, but it seems tedious. Likewise, we can find the highest value of “Peak Absorbed Flux” and then set the “Max Plot Scale”, but in systems with a large number of Z Planes this can be tedious.
And anytime we find that things are getting tedious, we know it’s time to write a ZPL macro.
Structure of the “Voxel Maker.ZPL” macro
The basic structure for the voxel viewer macro we want is as follows:
- Obtain the detected intensity values for each voxel in the detector volume, and determine the maximum overall intensity value.
- Create one rectangular volume object for each voxel whose recorded intensity is greater than some threshold value
- Export all these rectangular volume objects as a single, CAD object
The “Voxel Maker.ZPL” macro we have written does all this, and a bit more. It will create several different CAD objects, each one with a different threshold cutoff value. Then it imports these CAD objects into the current lens file, so that the user may color the objects to match the different threshold values (red for the highest threshold value, followed by yellow, green, and blue).
Our custom macro also gets around the memory limit for total number of allowable objects (for files that have very large numbers of detector volume voxels) by saving multiple sub-systems of pixels, and then re-loading these sub-systems and finally exporting one, large CAD object for each threshold color.
After running our macro with the above simple example setup, the result is shown in the figure below.
The result of running CODE's custom macro on the simple example setup
You can clearly see where the ‘hot’ voxels are inside the glass cylinder. Keep in mind that this simple example had just 10 pixels in each of the x-, y-, and z-directions; there are 1000 voxels in the detector volume. A detector volume with finer pixels will have far more voxels.
Our custom macro is designed to handle such large voxel numbers with ease. Of course, the resulting CAD object files will be quite large, and the production of these files will take some time. But the results can be truly illuminating. Below are some samples of voxel objects created using the attached macro for some more complex setups.
The image below was made using the file supplied with ZEMAX (in the directory ZEMAX/Samples/Non-sequential/Miscellaneous) called “voxel detector for flash lamp pumping.ZMX,” with the number of z-planes increased from 25 to 100. In the example below, the detector volume has 101 x 101 x 100 pixels, or over 1 million voxels.
The result of running CODE's custom macro on a ZEMAX sample file
The next example shows how our custom macro is also useful for visualizing light patterns on the surfaces of complex objects. The image below was made by choosing a highly-absorbing material for the complex object, so that light rays would not penetrate beyond a single voxel into the object. With this method, it is now possible to use the entire surface of any complex object as a detector plane, as if the detector plane were draped over the object.
For this setup, an LED was positioned above and aimed at a mechanical mirror mount. The detector voxels clearly show the exact locations of the very brightest portions of illumination on the mirror mount, and they also show the exact size and shape of shadows (regions where no voxels are lit) in the illumination pattern.
Result of running CODE's custom macro on a complex illumination system
With our custom macro, it is now possible to visualize 3D stray light patterns over complex objects.
The final example shows how to use Contrast’s custom macro to envision a detection volume, where an imaging detector is set up to view a volume of space that is being illuminated, as one might find in a detector for smoke or particulates. The figure below shows the basic setup.
Layout of a simple illumination/detection system
A large lens (yellow) is placed in front of a high-power LED (blue-green). Light from this LED/lens system (rays shown in purple) illuminates a volume of space, where a sample of gas or particles will be introduced.
A very small detector (red) is placed inside a tube (purple) with a small lens (blue) at the front end. This detector is meant to view the same volume of space that is being illuminated by the LED/lens system.
To see where the detector/lens system is looking, we replace the detector with a Source Rectangle:
A simple illumination/detection system with rays drawn showing where the detector is "looking"
Now there are rays (gray) showing exactly where the detector is looking. Looking at the layout above, it would be easy to assume that this system is set up very well, with the detector looking exactly at the brightest part of the LED illumination. We’re now going to go several steps further, in order to really evaluate how well this LED/detector system works.
We’ll add a detector volume to the system, as shown in the figure below.
A simple illumation/detection system with a Detector Volume
Next, we will run our custom macro, using only the LED rays at this time, in order to view the 3D pattern of the LED/lens system.
Illumination/detection system with colored voxels showing the brightest volumes of illumination
We can see that the LED illumination pattern is well-aligned with the detector’s general imaging path. Note that the voxels in the above figures are lit only when the irradiant flux on any given voxel exceeds a certain value. Some tuning of these threshold limit values (in the macro) is necessary in order to achieve the best quality picture.
Note also that the light pattern, especially the pattern of the blue voxels, appears to be shaped like a plume, as though light were bending around. However, there is still light in the regions of space where no voxels are lit: the light there just did not exceed the threshold chosen for the blue voxels.
Next, a material was applied to each of the newly-created voxel CAD objects. The absorption of each material was set to match the intensity level of light in each of the four (red, yellow, green, and blue) objects. For example, the red object had a threshold irradiance level twice as high as that of the yellow object. Therefore a material was created for the red object that had twice the absorption as that of the yellow object.
After all the voxel CAD objects were prepared in this way, light was projected out of the detector into the volume, and our custom macro was run once more. The image below shows the overlap between LED light and detector imaging (red/yellow). For reference, the main body of LED illumination is also shown in gray.
Side view of illumination/detection system with illumination area colored gray, and the areas of greatest interaction between illumination and detection colored red and yellow
The animation below shows how the entire system can easily be rotated and manipulated to help visualize the spatial characteristics of the illumination/detection overlap area.
Illumination/detection system with voxels showing the volume of greatest interaction
For the advanced ZEMAX user, a complete how-to of this article and macro are published on the ZEMAX website. The ZEMAX Macro used for this example was written by Mike Tocci and a printer friendly version can be downloaded here.
SUMMARY
We have written and published a custom macro to create complex voxel objects, in order to clearly see the 3-D structure and intensity profiles of light interacting with various NSC setups. Contact us to learn more about how Contrast Optical can solve your optical design and analysis problems.