ZEMAX Users' Knowledge Base - http://www.zemax.com/kb
How to Use Tabular BSDF Data to Define the Surface Scattering Distribution
http://www.zemax.com/kb/articles/231/1/How-to-Use-Tabular-BSDF-Data-to-Define-the-Surface-Scattering-Distribution/Page1.html
By Sanjay Gangadhara
Published on 2 May 2008
 
This article explains how measured BSDF data may be used to define the scattering properties of a surface. An example using BSDF data measured by the Imaging Sphere for Scatter and Appearance, which has been developed by Radiant Imaging, is provided.

Introduction

Surface scattering is an important effect to consider when analyzing both the illumination and stray light characteristics of a system. In many cases scattering is a desired effect. Surface scattering distributions which are built into ZEMAX include the Lambertian, Gaussian, and ABg models. More information on these distributions may be found in the chapter of the ZEMAX manual entitled “Non-Sequential Components”.

There may be cases when it is necessary to model surfaces whose scattering properties do not follow any of the built-in ZEMAX distributions. If the desired distribution is both analytic and integrable, a user-defined surface scattering model may be constructed, as described in the Knowledge Base article “How to Create a User-Defined Scattering Function”. However, in many cases the desired distribution is simply provided in terms of a table of measured data for the Bi-Directional Scatter Distribution Function (BSDF). An example of this is BSDF data that is measured by the Imaging Sphere for Scatter and Appearance (IS-SA) which has been developed by Radiant Imaging, Inc. (www.radimg.com).

To address this situation, a user-defined model has been constructed in which tabular BSDF data may be used to generate surface scattering properties. This article describes the model, and provides an example of how this model can be used to specify the scattering distribution on any component surface in the non-sequential mode of ZEMAX.


The BSDF model: a description

The program RI_BSDF.DLL, supplied with ZEMAX,  is a user-defined surface scattering model which supports the use of tabular BSDF data for defining the scattering properties of the surface(s) of an object. Data are provided to the program via an ASCII text file. This file must follow the BSDF Data Interchange file format developed by Radiant Imaging, Inc. A full description of that format is provided in the Knowledge Base article “BSDF Data Interchange File Format Specification”. Please read through that article carefully before proceeding with this article.

The DLL is accessed through the User Defined option under the Coat/Scatter tab of the Object properties dialog box (under “DLL name:” choose “RI_BSDF.DLL”). Any input files that may be used by the DLL will appear as a list under the “File Name:” option. For a file to appear in the list, it must have a .BSDF extension (as indicated in the article describing the file format), and – along with the DLL file – it must be located in the directory \ZEMAX\Objects\DLL\SurfaceScatter\. The maximum number of characters that the file name can contain (including the .BSDF extension) is 60.

The direction cosines for the scattered ray are determined in the DLL by integrating the measured BSDF data provided in the input file. The necessary integrals – and their relationship to the scattered ray vector – are identical to those provided in the Knowledge Base article “How to Create a User-Defined Scattering Function”. Since the BSDF is described by tabular data rather than an analytic function, in this case it is necessary to perform numerical integration rather than analytic integration. Otherwise the procedure is the same.

In almost all cases, the necessary integrals are performed only once, when the file is first loaded into ZEMAX. The integrated data are then stored in memory, and are available for use during any number of ray traces. Since the data are stored in memory, the computational time required to perform a ray trace is basically the same as it would be for a built-in ZEMAX scattering model. Thus, multiple input files may be used to define various scattering distributions on different surfaces in the design with no significant increase in computation time. However, the number of different files that can be stored in memory is currently limited to 20. If a design were set up with more than 20 input files for the various scattering distributions, ZEMAX would need to perform the integration for some set of files (those files with which rays interact the least) multiple times, slowing down the computation. If you require this limit to be increased, please contact ZEMAX technical support.

Otherwise, the DLL operates the same as any other user-defined scattering distribution. The amount of energy that goes into scattering is determined by the Scatter Fraction parameter, and this energy is divided equally amongst the number of scattered rays defined by the Number of Rays parameter. The DLL also supports Importance Sampling; a very nice example is provided in the file Tabular BSDF scattering surface with Importance Sampling.ZMX,  located in the directory \ZEMAX\Samples\Non-sequential\Scattering\ (the input BSDF file used in this example is discussed in more detail later on in this article). When Importance Samping is used, the Total Integrated Scatter (TIS) value that is needed to normalize the energy carried towards the object of interest is read directly from the input data file; the TIS value used for a given scattered ray is the value associated with the incident angle of the corresponding input ray.


The BSDF model: some specific considerations

There are some specific considerations to be aware of with this DLL:

1. The Radiant Imaging (RI) file format supports two inputs for the SpectralContent value: Monochrome and XYZ (Tristimulus). However, the DLL currently only supports monochromatic scattering calculations, so any input file with Tristimulus BSDF data will be interpreted as an input file with 3 individual monochromatic scattering distributions. The user may then choose which of the 3 distributions to apply to the surface via the Tristimulus input parameter in the Coat/Scatter tab of the Object properties dialog box:

Tristimulus input parameter for tabular BSDF DLL

The input value for this parameter must be an integer (and will be truncated if not). For a Tristimulus data file, a value of 0 corresponds to Tristimulus X data, a value of 1 corresponds to Tristimulus Y data, and a value of 2 corresponds to the Tristimulus Z data; ZEMAX will ignore the scattering distribution and return only the specular ray if the value is less than 0 or greater than 2. For a Monochrome data file, ZEMAX will ignore the scattering distribution and return only the specular ray if a value other than 0 is provided for this parameter.

2. The RI file format supports two inputs for the ScatterType value: BRDF and BTDF. However, this data is currently not used by the DLL; whether the surface scatters in reflection or transmission will be determined by the transmission properties of the surface (e.g. the coating on the surface). The DLL may be used to scatter both in transmission and reflection simultaneously; however the DLL currently assumes that the scattering distribution is the same for both directions.

3. The RI file format allows for measurements at multiple rotations of the sample. However, the DLL currently only allows for a single rotation angle, i.e. the DLL currently only supports isotropic scattering calculations. Thus, in the input file the Number of rotation angles must be set equal to 1, and the value for the rotation angle must be set equal to 0. The DLL also limits the Number of incident angles to be less than 15, the Number of azimuthal angles to be less than 30, and the Number of radial angles to be less than 100. If you require these limits to be increased, please contact ZEMAX technical support.

Finally, it is important to note that the DLL does not interpolate any of the input data for the BSDF or TIS values. Interpolation is performed to correlate the random numbers selected in the DLL with the scattering angles, analogous to the determination of scattering angles in the Knowledge Base article “How to Create a User-Defined Scattering Function”. Since interpolation is performed when correlating the scattering angles with the random numbers, scattering can (and in general will) occur at angles other than the input angles provided in the data file. However, this correlation requires the use of integrated data sets (analogous to the functions Iq and IN in the above article) which will only exist at discrete values of the incident, azimuthal, and radial angles, since the input data are only provided at discrete values for these angles. In the DLL, the closest angle values are chosen to determine the appropriate data sets for calculating the scatter angles. Thus, when using the DLL you must ensure that the input data have sufficient angular resolution to describe any variations of importance in the BSDF data.


A real-life example

Let’s take a look at a simple example using real BSDF data measured by the IS-SA instrument at Radiant Imaging. The data are for an automotive dashboard vinyl material named Brown Vinyl. The BSDF data for this material are provided in the ASCII file BrownVinyl.BSDF, which is provided with the ZEMAX installation (located in the directory \ZEMAX\Objects\DLL\SurfaceScatter\). This file contains monochromatic BSDF data, and data are defined for 13 incident angles, 19 azimuthal angles, and 11 radial angles:

#Data Generated by Radiant Imaging's 'Imaging Sphere'
#3/11/2008 9:37:42 AM
Source  Measured
Symmetry  PlaneSymmetrical
SpectralContent  Monochrome
ScatterType  BRDF
SampleRotation  1
0
AngleOfIncidence  13
15    20    25    30    35    40    45    50    ...
ScatterAzimuth 19
0    10    20    30    40    50    60    70    ... 
ScatterRadial 11
0    5    10    15    20    30    40    50    ....

Monochrome
DataBegin
TIS 0.134506
6.375E-02    6.180E-02    5.879E-02    5.529E-02 ...
6.375E-02    6.199E-02    5.886E-02    5.563E-02 ...
6.375E-02    6.215E-02    5.940E-02    5.591E-02 ...
6.375E-02    6.217E-02    5.975E-02    5.624E-02 ...
6.375E-02    6.246E-02    6.003E-02    5.674E-02 ...
6.375E-02    6.255E-02    6.036E-02    5.707E-02 ...
6.375E-02    6.264E-02    6.070E-02    5.720E-02 ...
6.375E-02    6.303E-02    6.078E-02    5.772E-02 ...
6.375E-02    6.314E-02    6.126E-02    5.895E-02 ...
6.375E-02    6.302E-02    6.136E-02    5.852E-02 ...
6.375E-02    6.343E-02    6.182E-02    5.889E-02 ...
6.375E-02    6.363E-02    6.182E-02    5.916E-02 ...
6.375E-02    6.366E-02    6.210E-02    5.947E-02 ...
6.375E-02    6.371E-02    6.210E-02    5.975E-02 ...
6.375E-02    6.372E-02    6.238E-02    6.003E-02 ...
6.375E-02    6.390E-02    6.248E-02    6.028E-02 ...
6.375E-02    6.404E-02    6.289E-02    6.061E-02 ...
6.375E-02    6.410E-02    6.277E-02    6.124E-02 ...
6.375E-02    6.406E-02    6.266E-02    6.103E-02 ...
TIS 0.1321704
6.501E-02    6.262E-02    5.909E-02    5.513E-02 ...
6.501E-02    6.299E-02    5.950E-02    5.554E-02 ...
.
.
.


We use this data to define the scattering distribution on a Rectangle object in non-sequential mode:

Inputting the BSDF data onto a non-sequential surface

Since the data are monochromatic, the Tristimulus parameter is set to 0. We also specify that 100% of the input ray energy goes into scattering (Scatter Fraction = 1) – so there will be no specular output ray – and that each input ray is split into 5 scattered rays (Number of Rays = 5).

A Source Ray object is then used to launch rays towards the Rectangle at an angle of incidence of 30 degrees, and a Detector Rectangle object is placed in front the Rectangle to view emission that results from scattering in reflection:

ZEMAX setup for testing BSDF DLL

The Detector Rectangle object is rotated 180 degrees with respect to the Rectangle object, and the “Front Only” flag is set to 1, so that only the reflected rays are recorded by the detector. This simple setup is provided in a lens design file (Tabular BSDF scattering surface.zmx) which is provided with the ZEMAX installation (located in the directory \ZEMAX\Samples\Non-sequential\Scattering\).

When 1 million analysis rays are launched from the source, the incoherent irradiance distribution on the detector is observed to be:

Incoherent irradiance resulting from Brown Vinyl scattering distribution

and the Radiant Intensity distribution is:

Radiant Intensity resulting from Brown Vinyl scattering distribution

Artifacts in the radiant intensity distribution can be seen near the edges of the plot, i.e. the “staircase” structure near the bottom of the plot. This structure arises from the coarseness of the input data, which are provided with a resolution of 10 degrees in the azimuthal direction and over most of the radial direction. To eliminate these artifacts, the angular resolution of the input data needs to be increased. Nonetheless, the results indicate that the resolution is sufficient over most of the field-of-view. Since the BSDF file format allows for non-uniform spacing of data in angle space, it would be sufficient to increase the resolution of the data only in the region where the artifacts appear. This keeps the file size compact while providing a high level of accuracy to the ray trace results.


Summary
A user-defined DLL has been developed that allows tabular BSDF data to be used for defining the scattering properties of a surface in the non-sequential mode of ZEMAX. Data are inputted to the DLL via an ASCII text file, which must follow the BSDF Data Interchange file format developed by Radiant Imaging, Inc. This DLL allows measured BSDF data to be used for system modeling in ZEMAX.