Non-sequential ray tracing implies that there is no predefined sequence of surfaces which rays that are being traced must hit. The objects that the rays hit are determined solely by the physical positions and properties of the objects as well as the directions of the rays. Rays may hit any part of any non-sequential object, and may hit the same object multiple times, or not at all. This can be contrasted with sequential ray tracing where all of the rays traced must propagate through the same set of surfaces in the same order.
In sequential mode in ZEMAX, all ray propagation occurs through surfaces which are located using a local coordinate system. In non-sequential mode, optical components are modeled as true three-dimensional objects, either as surfaces or solid volumes. Each object is placed globally at an independent x, y, z coordinate with an independently defined orientation.
The non-sequential ray tracing capabilities of ZEMAX do not suffer from the same limitations that sequential ray tracing does. Since rays can propagate through the optical components in any order, total internal reflection (TIR) ray paths can be accounted for. While sequential mode is limited to the analysis of imaging systems, non-sequential mode can be used to analyze stray light, scattering and illumination in both imaging and non-imaging systems. If an optical system can be traced with rays, it can be traced with non-sequential analysis in ZEMAX.
There are many types of optical components which cannot be modeled using the simple sequential surface model. Such optics need to be modeled as real, 3D components. Examples of objects that require non-sequential ray tracing include: complex prisms, corner cubes, light pipes, faceted objects, objected created in CAD programs and embedded volume objects (i.e. objects located within other objects). For example, here is a liquid crystal on silicon projector, designed in non-sequential mode by Michael Pate of OSCI:

Non-sequential ray tracing can be modeled in ZEMAX using one of two modes:
When using pure non-sequential ray tracing, all optics to be traced are in a single non-sequential group. In addition, source and detector objects are setup within the group to launch and capture rays, respectively. The source modeling capabilities of pure non-sequential mode in ZEMAX are far more comprehensive than sequential mode. In sequential mode, you are limited to modeling point sources located on the object surface. Using the image analysis capabilities of sequential mode, planar extended sources located at the object surface can be modeled. Using pure non-sequential ray tracing, sources can be placed anywhere in the non-sequential group, at any orientation, and can even be placed inside of other objects. The source objects themselves can range from simple point sources (like those used in sequential mode) to complex, three-dimensional source distributions. ZEMAX can even import measured source data for real sources from programs like ProSource (Radiant Imaging) and Luca Raymaker (Opsira).
Rays from non-sequential sources, known as NSC rays, can be split and scattered by optical components. These rays can also be diffracted at phase surfaces/objects. The analysis options available when tracing NSC rays include evaluating radiometric data on detectors and the storing of ray data in ray database files. Detectors can be modeled as planar surfaces, curved surfaces and even three-dimensional volumes. Non-sequential detectors support the display of a variety of data types including: incoherent irradiance, coherent irradiance, coherent phase, radiant intensity and radiance. Ray database files store the history of each ray traced. Ray paths can be filtered to isolate rays that hit specific objects. The filtered ray data can then be displayed in layouts and on detector objects. All of the above makes pure non-sequential ray tracing very useful for ghost analysis, stray light analysis as well as a variety of illumination applications.
When using mixed sequential/non-sequential ray tracing (also known as hybrid or mixed mode ray tracing), a collection of non-sequential objects are setup inside of a non-sequential group. This non-sequential group is part of a larger sequential system. Sequentially traced rays enter the non-sequential group through an entrance port, and exit the group through an exit port to continue propagating through the sequential system. Multiple non-sequential groups may be defined in the same sequential system, and any number of objects may be placed in each non-sequential group. This allows non-sequential components such as faceted mirrors, roof prisms or CAD objects to be included in a sequential design.
Open the file "Samples > Non-sequential > Faceted objects > Toroidal faceted reflector.zmx" using then menu option, "File > Open" or the "Ope" button on the button bar.
This file demonstrates the use of mixed sequential/non-sequential ray tracing, where non-sequential components are used in combination with sequential surfaces.
If the "Use Session Files" option is checked under the File menu when the file is opened, both the the Lens Data Editor and Non-Sequential Editor will appear on the screen along with several analysis windows.
The 3D Layout plot shows sequential rays traced from a point source at the object surface at the middle-right hand side of the layout. 
TIP: You can double click on the title bar of a window to enlarge the window. Do this now with the 3D Layout window.
Select "Settings" from the 3D Layout window menu bar. Check the box that says "Fletch Rays" and then click "OK". ZEMAX now draws fletches (arrows) indicating the direction that rays are propagating. This option can be particularly helpful in many non-sequential systems where the ray paths can be complex.
The rays initially travel from left to right and enter a non-sequential component group where they hit a faceted mirror (object 1 in the Non-Sequential Component Editor) and reflect to the left where they exit the non-sequential group and hit a sequentially defined lens (surfaces 3 and 4 in the Lens Data Editor). The 3D Layout window may be rotated with the keyboard arrow keys and Page-Up and Page-Down keys to show different views. Double click again on the title bar of the layout to reduce the window to its original size.
TIP: You can zoom in on an analysis window by clicking dragging inside the window to draw a box around the region you want to zoom in on. Do this now by drawing a box around the reflector in the 3D Layout window. Zoom settings can be fine tuned in the analysis window menu option, "Zoom".
You can now better see the individual facets of the reflector. There are many types of faceted objects that can be modeled in non-sequential mode in ZEMAX including toroidal surfaces, radial and polynomial aspheres and Fresnel lenses among others.
The Geometric Image Analysis window shows the unique and complex ray distribution formed on the image surface to the left of the lens. 
We will now look at an example of non-sequential ray tracing in ZEMAX.
Open the file "Samples > Non-sequential > Faceted objects > 3 helical lamps with reflectors.zmx". The file shows rays traced from three lamps onto three detectors. Zoom in on one of the lamps in the NSC 3D Layout window and you will then see the helical structure of the sources being modeled. In this example, each lamp is simulated using the Source Filament NSC object type which is a coiled helix. Rays are launched from random points along the helix and then reflect off of the faceted reflectors surrounding each helix.

From the main menu bar, select the option, "Analysis > Detectors > Ray Trace/Detector Control". A dialog box will open. This dialog is used to trace analysis rays. Click the button "Clear Detectors", and the detectors will be cleared. Next click the "Trace" button. This will trace a new set of random analysis rays to the detectors. Click the "Exit" button once the ray trace is complete.
To view the results of the ray trace, open a Detector Viewer. This can be done via the main menu option, "Analysis > Detectors > Detector Viewer". The Detector Viewer will default to the first detector object in the list of objects in the Non-Sequential Editor which is object 10.
Click on "Settings" from the Detector Viewer window menu bar. To change the detector viewed, change the "Detector" setting from "Detector Object 10" to another detector object and then click "OK".
TIP: To see where a detector is placed and determine its orientation, click anywhere on the row corresponding to the detector in the Non-Sequential Component Editor (NSCE). The rectangle corresponding to the detector will be highlighted in red in the NSC 3D Layout window. Here is the layout window shown when detector object 11 is selected.
In this example ten thousand analysis rays are traced from each source during each trace. The number of rays traced for detector analysis is set for each source in the Non-Sequential Component Editor. The number of rays can be changed in the full, licensed version of ZEMAX. To see where the number of rays is defined, click on a row corresponding to any of the Source Filament objects (objects 3, 6 and 9) in the Non-Sequential Component Editor. Next, move the cursor to the right with the right arrow key until you see a column with the title "# Analysis Rays" displayed. The NSC Editor has "active" column headings like the Lens Data Editor. The column headings change to tell you what the values are in each cell depending upon the type of object that you have selected.
The "# Layout Rays" in this example is set to 5 for each source object. The number of layout rays is set separately from the number of analysis rays so that layout windows do not become confusing when thousands upon thousands of rays are traced for analysis. Each time you double click on an open layout window, or select "Update" from a layout window's menu bar, a new set of random layout rays will be drawn.
NSC Shaded Model layout windows can show the results of analysis traces. This option is controlled via the "Detectors" option in the NSC Shaded Model window settings. If this setting is set to "Color pixels by last analysis", then detector objects in the layout will be drawn based on the results of the last analysis trace.

TIP: Users of the full, licensed version of ZEMAX can learn more about setting up pure non-sequential ray tracing systems in the Knowledge Base article, "How to Create a Simple Non-Sequential System". For more information on modeling complex source geometries, see the Knowledge Base article, "How to Model LEDs and Other Complex Sources".
Open the file "Samples > Non-sequential > Prisms > Half penta prisms and amici roof.zmx". This is another demonstration of mixed sequential/non-sequential ray tracing. Rays are traced from a sequential object surface at infinity, through the stop at surface 1, then through the non-sequential prism system, and then to the sequential image surface.
The Shaded Model layout shows a roof on the center prism with the roof facing out of the screen. The roof is constructed with two surfaces at 90 degrees to each other, and appear pitched like a roof. Roofs act like a flat mirrors except they add path length and flip the image about the axis of the roof by reflecting rays that hit on each side to the other. Zoom in on the Shaded Model layout to get a better look at the three prisms and then use the "Page Down" key on the keyboard to rotate the view in the plot.
TIP: The semi-transparent appearance of the prisms above was generated using the Shaded Model "opacity" capability. Users of the full, licensed version of ZEMAX can change these settings as needed. For more information, see the opacity section of the Knowledge Base article, "How Do I Create Presentation Quality Graphics and Animations?"
The Polarization Pupil Map shows the effects of the roof on the polarization state of the sequentially traced rays.

Many different prisms are included with ZEMAX. Prisms can be defined in a text file format which gives the x,y,z coordinates of the corners of each facet. These files are called Polygon Objects. Prisms and faceted objects can also be imported as STL files, a file format exported by many CAD programs. Note that the POB and STL objects in ZEMAX are real faceted objects.

We will now take a look at the ray splitting capabilities of pure non-sequential mode in ZEMAX. Open the file "Samples > Non-sequential > Ray splitting > Beam splitter.zmx".
This example demonstrates the use of two adjacent prisms (modeled using the Polygon Object type) to model a cube beam splitter. By default, the Polygon Objects will simply transmit the incoming beam. By applying a partially reflective/partially transmissive coating, we can generate both reflected and transmitted beam paths. Coatings are applied in the Coat/Scatter tab of the Object Properties dialog. Double-click in the Object Type column for object 3 in the Non-Sequential Component Editor (NSCE) and click on the Coat/Scatter tab. This is where coating properties are assigned for each object.
TIP: Users of the full, licensed version of ZEMAX can change coating assignments in this tab. For more information on how to do this, see the Knowledge Base article, "How To Model A Partially Reflective and Partially Scattering Surface".
Coatings have been applied to all surfaces of the beam splitter cube in this example. Anti-reflective coatings have been applied to each of the outer surfaces while a 50/50 reflective/transmissive coating has been applied to the interior splitting surface. You can see the rays splitting in the NSC 3D Layout window.
Open the settings for the NSC 3D Layout and observe that "Split Rays" and "Use Polarization" are both checked.
Polarization calculations are required in order for ZEMAX to split rays. As such, both boxes needed to be checked in order to see ray splitting. Uncheck both of these boxes and click "OK". Notice that there is no longer any ray splitting and the single ray that is launched transmits right through both halves of the cube.
Rays can also be split during analysis traces. Ray splitting and polarization calculations must both be turned on in the Ray Trace/Detector Control dialog.
TIP: ZEMAX also supports an option called "Simple Ray Splitting" where either the reflected or refracted ray is traced at each splitting interface, but not both. The choice of which path to trace is random and the probability is proportional to the relative reflective/transmissive components of the splitting surface. Activating this option can speed up ray tracing in many optical systems. For more information, take a look at the Knowledge Base article, "What is Simple Splitting?".
Open the file "Samples > Non-sequential > Scattering > ABg Scattering Surface.zmx". This example demonstrates ray splitting as well as non-sequential mode's scattering capabilities.
The NSC 3D layout shows the scattering of a ray at object 2 (a flat, rectangular mirror) since the "Scatter Rays" box is checked in the settings for the layout . Ray splitting is turned off in this layout so for each incident specular ray, we get one scattered ray in reflection. The NSC Shaded Model layout shows splitting and scattering (since both "Scatter Rays" and "Split Rays" boxes are checked).

When ray splitting is turned on for scattering systems, ZEMAX will generate multiple split scattered rays based on the "Number of Rays" setting in the Coat/Scatter tab of the Object Properties for the scattering surface/object. Take a look at the Coat/Scatter tab for object 2. Observe that we are asking ZEMAX to generate 5 scattered rays for each incident specular ray.
ZEMAX supports Lambertian, Gaussian, ABg and User Defined scattering models. This example demonstrates ABg scattering as can be seen in the Coat/Scatter tab for object 2.
The fraction of energy scattered is a function of the ABg model parameters selected. To see the specific ABg scattering profile being used here, from the main menu bar, choose "Tools > Scattering > ABg Scatter Data Catalogs". Change the "Name" to LAMB-SPEC.
A very small detector (object 3) is intentionally centered and placed in front of the large detector (object 4) to collect the energy in the specular ray. The small detector can be seen in the layouts only by zooming in very closely on the layout windows. The large detector collects the energy in the scattered rays. To see the scattered energy, open a Detector Viewer, set the "Detector" setting to Detector Object 4 and then click "OK".
TIP: Scattered and unscattered energy can also be separated on a single detector using ZEMAX' filter string capabilities. For more information on what filter strings are and how to set them up, take a look at the Knowledge Base article, "How To Perform Stray Light Analysis in Non-Sequential ZEMAX".
While diffractive optical elements can be modeled in both sequential and non-sequential mode in ZEMAX, non-sequential mode's ray splitting capabilities can be quite advantageous for diffractive modeling.
Open the file "Samples > Non-sequential > Diffractives > Diffraction grating multiple orders.zmx".
Notice that the single input ray is split into five rays at object 2.

In this case, the rays are not splitting as a result of a coating or scattering settings. Instead, we are seeing the splitting of energy into multiple diffractive orders by the transmission diffraction grating (object 2). The fundamental property of this grating (i.e. the grating frequency in lines per micron) is defined in the parameter columns for this object. Notice that the Diffraction Grating object has the same parameters as a Standard Lens object plus a diffraction grating frequency parameter (lines per micron).
The ray splitting settings for this object are set in the Diffraction tab of the Object Properties dialog.
In this tab, the relative amount of energy that is split into each order is specified.
TIP: Users of the full, licensed version of ZEMAX can use custom diffractive DLLs in which arbitrary order splitting can be specified. These DLLs can also be used to explicitly specify all of the properties of rays after diffraction including relative energy, direction cosines and electric field orientation and magnitude.
Open the file "Samples > Non-sequential > Coherence > Interferometer.zmx".
This is another pure non-sequential file which demonstrates the coherence modeling capabilities of non-sequential mode.
The file models an interferometer. The rays from the rectangular source at the top left side of the layout are split by a 50/50 coating on the front surface of the Polygon Object assigned to object 2. The rays then travel down the two arms of interferometer to the detectors (objects 6 and 7) at the lower right side. The two ray paths are recombined prior to the detectors by a second Polygon Object (object 5) with a 50/50 coating. The mirror in the lower left arm of the interferometer (object 3) has an additional 0.005 degrees of tilt about the x-axis applied to it. The tilt produces unequal path lengths in the beam at the detector surfaces.
With its coherent detection capabilities, ZEMAX adds the energy in the rays that reach the detectors coherently according to the amplitude and phase of each ray detected. This allows ZEMAX to qualitatively simulate effects such as fringes in interferometers. In order to see these effects, the "Show Data" setting in the Detector Viewer settings must be set to "Coherent Irradiance" or "Coherent Phase".
Open a Detector Viewer now by clicking on the "Dvr" button in the button bar. In the settings for the Detector Viewer, set "Detector" to Detector Object 6, set "Show Data" to Coherent Irradiance and then click "OK". Observe the tilt fringes that result from the extra 0.005 degrees of tilt in the mirror (object 3).

Now, open the settings for the Detector Viewer, set "Show Data" to Incoherent Irradiance and click "OK". Observe that you can no longer see any fringes as we are no longer viewing the detector from a coherent perspective.

TIP: In non-sequential mode, you can also see the interference from various orders of a diffraction grating. The sample file "Samples > Non-Sequential > Diffractives > Diffracting grating fringes.zmx" demonstrates this.
We will now look at the complex geometry creation capabilities of non-sequential mode in ZEMAX.
There are many different types of objects that are built in to ZEMAX that can be used to model many different varieties of geometries. There will be times, however, where the geometry you wish to create will not be possible given the available native objects in ZEMAX. Traditionally, you would then build the geometry that you need in a CAD program and then import the CAD object into ZEMAX. There is another approach that can be taken, however, using the Boolean object.
The Boolean object allows you to combine, using a variety of Boolean operations, up to 10 different non-sequential volume objects. The resulting object remains fully parametric based on the parent objects that were used to create it. As such, unlike imported CAD objects, the construction parameters of Boolean objects can be fully optimized and toleranced!
Open the file "Samples > Non-sequential > Boolean > lens mount.zmx". This sample file demonstrates the use of the Boolean object to model complex objects with ease.
Observe from the NSCE that there are four volume objects defined (Rectangular Volume as well as three Cylinder Volumes). There is also a Boolean object defined. With the Boolean object selected in the NSCE, scroll to the right until you see the columns “Object A”, “Object B”, etc. These are the objects that the Boolean operations that you specify will be applied to.

As you can see, the Rectangular Volume (object 1) is assigned as object A and the three Cylinder Volumes (objects 2-4) are assigned as object B, C and D respectively.
Scroll back to the left in the NSCE and look at the “Comment” column for the Boolean object. The “Comment” column is where the Boolean operation for the object is specified.

Since “a-b-c-d” is specified for the “Comment”, this indicates that objects B, C and D are subtracted from object A. Thus, the three Cylinder Volumes are subtracted from the Rectangular Volume to create a simple lens mounting structure! The four parent objects and the resulting Boolean object are shown side-by-side in the NSC Shaded Model that opens with this example.

While this example demonstrates the subtraction of objects using the Boolean object, objects can also be combined together using addition, intersection and exclusive or (XOR) operations.
Complex geometry creation can be explored in more detail in the Knowledge Base article, "How to Use the Boolean Object and the Combine Objects Tool".




