# Exploring Non-Sequential Mode in OpticStudio

This article is part of the Getting Started with OpticStudio free tutorial.

This article is intended to introduce prospective and new OpticStudio users to the suite of capabilities available in Non-Sequential Mode. The advantages of Non-Sequential Mode and mixed mode are discussed. A brief overview of some object types and features unique to Non-Sequential Mode is also provided.

Authored By Akash Arora

## Introduction

In Sequential Mode, rays are limited to propagating from one object to the next. This property makes Sequential Mode ideal for analysis of imaging and afocal systems. If you are working with a system that requires more flexibility, then you will want to use Non-Sequential Mode. Non-sequential ray tracing allows rays to propagate through optical components in any order and allows rays to be split, scattered, and reflected back to an object that they've already encountered. This property makes Non-Sequential mode ideal for analyzing stray light, scattering, and illumination for any system type. If an optical system can be traced with rays, then it can be simulated in OpticStudio's Non-Sequential Mode.

## What is non-sequential ray tracing?

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.

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. There are many objects that cannot be accurately modelled using single surfaces in Sequential Mode and need to be instead modelled as real, 3D components. Some examples of these optics include: complex prisms, corner cubes, light pipes, faceted objects, objects created in CAD programs and embedded volume objects (i.e. objects located within other objects).

Non-sequential ray tracing can be modeled in OpticStudio using one of two modes:

• Pure Non-Sequential Mode
• Mixed Sequential/Non-Sequential Mode

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 record rays, respectively. The source modeling capabilities of pure Non-Sequential Mode in OpticStudio are far more comprehensive than Sequential Mode. In Sequential Mode, you are primarily limited to using point sources located on the OBJECT surface and modelling them using the various image analysis capabilities available. Non-Sequential Mode allows for more freedom in the definition of your system. 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. OpticStudio Premium provides a library of several hundred measured sources. Alternatively, you can import measured source data for real sources from vendors or external programs.

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, radiance, and true color photometric results. Ray database files store the history of each ray traced. Additionally, 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. Advanced path analysis also provides ways to sort ray paths based upon criteria such as total flux. All of the above makes pure non-sequential ray tracing very useful for ghost analysis, stray light analysis, as well as a variety of other illumination applications.

## Mixed mode

The Mixed Mode ray tracing is a mix of sequential and non-sequential ray tracing. When used, a collection of non-sequential objects are set up 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. This mode of simulation is ideal for systems that are inherently sequential but contain one or more components more easily modeled as 3D volumes.

In this example, we will demonstrate the use of mixed mode ray tracing using a sample file. To open this file, navigate to File...Open and select the file {Zemax}\Samples\Non-sequential\Reflectors\Toroidal faceted reflector.zmx.

If the Use Session Files option is checked under the General settings in Project Preferences when the file is opened, both the Lens Data Editor and Non-Sequential Component 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 floating window to enlarge the window. You can enlarge a docked window by dragging its borders to make it larger.

Select Settings from the 3D Layout window tool bar. Check Fletch Rays and then click OK. OpticStudio now draws fletch marks (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.

TIP: You can zoom in on an analysis window using your mouse's scroll wheel, or by clicking and 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. The zoom can be reset by clicking the icon in the menu bar or by right-clicking and selecting Reset Zoom.

By zooming in, the individual facets of the reflector become clear. There are many types of faceted objects that can be modeled in Non-Sequential Mode in OpticStudio 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.

Next, open the file {Zemax}\Samples\Non-sequential\Prisms\Half penta prisms and amici roof.zmx. This is another demonstration of Mixed Mode ray tracing. Rays are traced from a sequential object surface infinitely far away, 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. Roofs act like a flat mirror 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. For more information, see the opacity section of the Knowledgebase article, "How do I create presentation quality graphics and animations?"

The Polarization Pupil Map, accessible via Analyze...Polarization...Polarization Pupil Map, shows the effects of the roof on the polarization state of the sequentially traced rays.

Many different prisms are included with OpticStudio. 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 file types produce real faceted objects in OpticStudio.

## Source Modeling

We will now look at an example of non-sequential ray tracing in OpticStudio. Open the file {Zemax}\Samples\Non-sequential\Reflectors\3 helical lamps with reflectors.zmx. The file shows rays traced from three lamps onto three detectors. Open an 3D layout by navigating to Analyze...NSC 3D Layout. 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 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.

Select Analyze...Ray Trace to open Ray Trace Control dialogue. This analysis tool is used to trace, filter, and save rays for non-sequential analysis. Click Clear & Trace to clear existing results from the detectors and initiate a new ray trace. This will trace a new set of random analysis rays to the detectors. Select Exit after the ray trace is complete.

To view the results of the ray trace, open a Detector Viewer via Analyze...Detector Viewer. The Detector Viewer will default to the first detector object in the list of objects in the Non-Sequential Component Editor. In this example, that is object 10.

Click Settings from the Detector Viewer window tool bar. To change the detector being 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 orange in the layout windows. (This feature will not work in Express View). 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 is set for each source in the Non-Sequential Component Editor. To change the number of rays 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 a smaller number for each source object. The number of layout rays is defined separately from the number of analysis rays so that layout windows do not become cluttered 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 ray traces. This option is controlled via the Detector 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.

OpticStudio supports many types of sources, from simple geometric approximations (point sources, elliptical disks, etc.) to ray files based upon measured source data. To see the sources available in the Premium edition of OpticStudio, navigate to Libraries...Radiant Source Models...Download Radiant Source Models. Take a look through the available sources.

TIP:  Learn more about setting up pure non-sequential ray tracing systems in the Knowledgebase article, "How to create a simple non-sequential system". For more information on modeling complex sources, including using measured source data, see the Knowledgebase article, "How to model LEDs and other complex sources".

## Complex geometry creation

We will now look at the complex geometry creation capabilities of Non-Sequential Mode in OpticStudio.

There are many different types of objects that are built in to OpticStudio that can be used to model a variety of geometries. Several of these have been shown in the previous examples.

### CAD import

Effective December 31, 2021, SOLIDWORKS integrations with Zemax products are deprecated and will not be available in future software releases of OpticsBuilder or OpticStudio. Learn more.

If the object you wish to build is too complex for the native objects in OpticStudio, one option is to build the geometry that you need in a CAD program and then import the CAD object into OpticStudio. Two methods are supported: static import and dynamic import. Static import is achieved using common CAD formats: STP, SAT, IGS, and STL. These file types can be imported, assigned optical properties, and included in a simulation. The shapes of the objects cannot be modified beyond uniformly scaling them, hence the static nature. Dynamic import is achieved via a CAD link capability (only available in the Premium version) that supports importing Solidworks, Autodesk Inventor, or PTC Creo parts/assemblies. Full parametric control is available with this capability. This capability requires an installed, working version of the respective software.

An image of a Creo component imported into OpticStudio is shown below.

### Boolean commands

Another approach that can be taken is to use 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.

Open the file {Zemax}\Samples\Non-sequential\Geometry Creation\Boolean example 4- a 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 objects 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.

Because “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.

TIP: Complex geometry creation can be explored in more detail in the Knowledgebase article, "How to use the Boolean CAD, Boolean Native, and Compound Lens objects, and the Combine Objects tool". This article describes how to exploit the speed of native objects, while still getting the visualization of boolean objects: "Improving non-sequential ray tracing speeds with nested and Boolean objects".

## Ray splitting and scattering

### Beam splitting

Effective December 31, 2021, SOLIDWORKS integrations with Zemax products are deprecated and will not be available in future software releases of OpticsBuilder or OpticStudio. Learn more.

We will now take a look at the ray splitting capabilities of pure non-sequential mode in OpticStudio. Open the file {Zemax}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 section. This is where coating properties are assigned for each object.

TIP:  For more information on how to do this, see the Knowledgebase article, "How to model a partially reflective and partially scattering surface".

Ideal 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.

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 OpticStudio 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 ray traces. Ray splitting and polarization calculations must both be turned on in the Ray Trace Control dialog.

TIP:  OpticStudio 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 Knowledgebase article, "What is Simple Splitting?".

### Ray scattering

Let's now take a look at scattering. Open the file {Zemax}\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. When ray splitting is turned off, the layout shows one scattered reflection ray for every incident specular ray. The NSC Shaded Model layout below shows splitting and scattering (since both Scatter Rays and Split Rays boxes are checked).

When ray splitting is turned on for scattering systems, OpticStudio 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 have defined 5 scattered rays for each incident specular ray.

OpticStudio supports Lambertian, Gaussian, ABg, BSDF, IS, and User Defined scattering models. The IS scatter capability is a library of measured scatter data from common, commercial materials. This example demonstrates ABg scattering as can be seen in the Coat/Scatter tab for object 2 (please choose TP_TEST for the ABg model if this is not already selected).

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 ribbon bar, choose Libraries...ABg Scatter Catalogs. Change the Name to TP_TEST.

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 OpticStudio's filter string capabilities. For more information on what filter strings are and how to set them up, take a look at the Knowledgebase article, "How to perform stray light analysis".

## Advanced features

### Diffraction grating

While diffractive optical elements can be modeled in both Sequential and Non-Sequential Mode in OpticStudio, Non-Sequential Mode's ray splitting capabilities can be quite advantageous for diffractive modeling.

Open the file {Zemax}\Samples\Non-sequential\Diffractives\Diffraction grating multiple orders.zmx.

Notice that each 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 section of the Object Properties dialog. In this section, the relative amount of energy that is split into each order is specified.

TIP: OpticStudio allows you to 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.

### Coherence modelling

Another advanced feature is the ability to model coherence. Open the file {Zemax}\Samples\Non-sequential\Coherence\A Simple Interferometer.zmx. This is another pure non-sequential file which demonstrates the coherence modeling capabilities of non-sequential mode.

The file contains an interferometer setup. 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, OpticStudio adds the energy in the rays that reach the detectors coherently according to the amplitude and phase of each ray detected. This allows OpticStudio 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, and in the settings change Detector to Detector Object 6. Set Show Data: 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: 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 {Zemax}\Samples\Non-Sequential\Diffractives\Diffracting grating fringes.zmx demonstrates this.

### Absorption analysis

Lastly, we'll take a look at measuring absorption inside bulk volumes. Open the file {Zemax}\Samples\Non-sequential\Miscellaneous\Voxel detector for flash lamp pumping.zmx.

In the pure non-sequential examples that we have been looking at so far, the detectors we have been using are Detector Rectangle objects. These are flat surface detectors. OpticStudio can also model more complex detectors such as curved surface detectors and volumetric detectors.

This example demonstrates the use of the Detector Volume object in a simple laser flash pump model. The cavity is modeled using one toroidal mirror at each end (objects 3 and 4). Near each mirror is a Source Tube emitting rays (objects 1 and 2). In the middle of the cavity is a Cylinder Volume object (object 6) which simulates a laser crystal.

Notice also that there is also a Detector Volume (object 5) overlapping the Cylinder Volume object.

The Detector Volume object is a rectangular volume consisting of three-dimensional pixels called voxels. OpticStudio can record the incident flux on each voxel. In addition, if the Detector Volume is overlapped with another volume object for which transmission data has been defined, OpticStudio can record the absorbed flux for each voxel in the Detector Volume. In this case, the overlapping Cylinder Volume is comprised of BK7 for which transmission data has been defined in the Materials Catalog, accessible via Libraries...Materials Catalog.

Click anywhere on the row corresponding to object 5 in the Non-Sequential Component Editor and scroll to the right to observe the parameters of the Detector Volume. Observe that there are 101 pixels in X and Y and 25 pixels in Z.

Take a look at the open Detector Viewer and notice that it is showing the Absorbed Flux within the Detector Volume. Also notice that there is a Z Plane listed at the bottom of the Detector Volume. The Detector Viewer can only display detector data two-dimensionally. As such, you can only look at one plane or "slice" of voxels within the Detector Volume at a time. The Z Plane setting allows you to tell OpticStudio for which Z pixel (in this case, from 1 to 25), you wish to see the corresponding X and Y pixels.

You can change the Z Plane in the settings for the Detector Viewer or simply use the left or right arrows on the keyboard to scroll through the Z Planes.

TIP: Many object types can be turned into detectors in OpticStudio. This allows you to easily model complex surface/shell detectors.

## References

Zemax LLC. 2018. NSC Overview

KA-01504

Was this article helpful?
23 out of 24 found this helpful

### Comments

0 comments

Please sign in to leave a comment.