# How to use tabular BSDF data to define the surface scattering distribution

In many cases, scattering data is delivered as a text file of experimental values that may not be easily modelled. This article discusses how to use tabular Bi-Directional Scatter Distribution Function (BSDF) data for defining surface scattering properties that may not be able to be described by Lambertian, Gaussian, or ABg models that are built in to OpticStudio.

Authored By Sanjay Gangadhara; updated by Alissa Wersal

Article Attachments

## Introduction

Surface scattering is an important effect to consider when analyzing both the illumination and stray light characteristics of a system. While OpticStudio provides Lambertian, Gaussian, and ABg models, 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)

A model has been constructed where 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 object surface in the Non-Sequential mode of OpticStudio.

## The BSDF Model: A Description

The BSDF scattering model built into OpticStudio supports the use of tabular BSDF data for defining the scattering properties of the surface(s) of an object.

Data sets are provided to the program via a text file which must follow the BSDF Data Interchange file format developed by Radiant Vision Systems (RVS). A full description of that format is provided in the Knowledgebase article "BSDF Data Interchange file format specification". Please read through that article carefully before proceeding with this article.

The direction cosines for the scattered ray are determined in the model 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 Knowledgebase 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 all cases, the necessary integrals are performed only once, when the file is first loaded into OpticStudio. 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 OpticStudio 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 set to 200. If a design were setup with more than 200 input files for the various scattering distributions, OpticStudio would not scatter rays for those surfaces after which the distribution limit of 200 was reached; rays would simply follow the specular ray path at those surfaces.

When using this model to simulate measured, complete BSDF data, it is important to set the "Scatter Fraction" parameter equal to 1.

A "Scatter Fraction" of 1 will often be used with the BSDF scatter profile, because BSDF data typically includes both the specular and scattered ray information. A scatter fraction between 0 and 1 will result in a proportional amount of energy ignoring the BSDF profile and instead following the specular path.

Then OpticStudio will correctly determine the amount of power that goes into scattering based on the value for the Total Integrated Scatter (TIS), which is read directly from the input data file (this value depends on the incident angle of the corresponding input ray, as described in the article "BSDF Data Interchange file format specification"). As with any other scattering model, the scattered power will then be divided equally amongst the number of scattered rays defined by the "Number Of Rays" parameter. Power that is not scattered is assumed to be lost at the surface, i.e. due to surface absorption. Thus, all input rays will undergo scattering, but the power of the scattered rays will be scaled by the appropriate TIS value (of course different TIS values will be used for different input rays that have different angles of incidence).

Finally, the model also supports Importance Sampling; a very nice example is provided in the file Tabular BSDF scattering surface with Tabular BSDF scattering surface with Importance Sampling.ZMX, located in the folder {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 Sampling is used, the TIS value that is needed to normalize the energy carried towards the object of interest is again 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 scattering model:

1. The RVS file format allows for measurements at multiple rotations of the sample. This is needed to account for surfaces which exhibit anisotropic scattering. All values for the rotation angles should be between 0 and 360 degrees, with non-zero values corresponding to rotation of the sample in the counter-clockwise direction relative to the +X axis. The model currently limits the Number of rotation angles to a maximum of 50.

If the surface is to be modeled in the optical system with a different orientation relative to measurement orientation, the user can specify a non-zero value for the "Angle:" input:

Angle values are input in degrees, and should also be between 0 and 360. Again, non-zero angle values correspond to counter-clockwise rotation of the surface relative to the +X axis.

2. The model limits the Number of incident angles in the input *.BSDF file to a maximum of 100, the Number of azimuthal angles to a maximum of 1000, and the Number of radial angles to a maximum of 1000.

3. The RVS file format supports two inputs for the SpectralContent value: Monochrome and XYZ (Tristimulus). However, the BSDF model in OpticStudio 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. For a Tristimulus input file, the BSDF model currently chooses the second data set (Tristimulus Y) for describing the BSDF of the surface in OpticStudio.

4. The RVS file format supports two inputs for the ScatterType value: BRDF and BTDF. However, this data is currently not used by the model; the scattering distributions in reflection and transmission are determined by which files are selected under the "Reflect:" and "Transmit:" inputs to model, respectively:

Thus, the BSDF model may be used to scatter simultaneously in both transmission and reflection, allowing for different scattering distribution in each direction. The total amount of scattered power in each direction will be based on the relevant TIS values for scattering in reflection and transmission as well as on the surface coating properties.

Finally, it is important to note that interpolation of BSDF or TIS values is only performed between data sets at different sample rotation angles, to ensure a fairly smooth transition between results as the sample is rotated in OpticStudio. At any given sample rotation angle, interpolation is also performed to correlate the random numbers selected in the algorithm with the scattering angles, analogous to the determination of scattering angles in the Knowledgebase 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 azimuthal and radial 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 BSDF model, the closest angle values are chosen to determine the appropriate data sets for calculating the scatter angles, i.e. interpolation is not performed in choosing the appropriate data sets. Thus, when using this model you must ensure that the input data have sufficient angular resolution (specifically with regards to the incident, azimuthal, and radial angles) 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 RVS (formerly Radiant Imaging). The data are for an automotive dashboard vinyl material named Brown Vinyl. The BSDF data for this material are provided in the text file BrownVinyl.BSDF, which is provided with the OpticStudio installation (located in the {Zemax}/Scatter folder). 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:

Note that the Scatter Fraction is set to 1 (as it should be) 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:

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 OpticStudio installation (located in the {Zemax}\Samples\Non-sequential\Scattering\ folder).

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

and the Radiant Intensity distribution is:

Note that the total power which hits the detector is 0.1229 W. This is in very good agreement with the expected result; for this case, the total power should equal the product of the mirror reflectivity and the TIS value for scattering for an incident angle of 30 degrees. For an uncoated mirror (for which OpticStudio assumes a coating of thick aluminum) the reflectivity is 94.555%; you can confirm this value simply by running a ray-trace in the sample file with scattering turned off. For the Brown Vinyl data file, the TIS value at an incident angle of 30 degrees is 0.1371577. The product of the mirror reflectivity and the TIS value is thus 0.94555*0.1371577 = 0.1297. The amount of power on the detector agrees with this value within 1%. Better agreement may be achieved by increasing the size of the detector, to better capture emission at the edge of the 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. For example, using an input file with 2 degrees of resolution in both the azimuthal and radial directions leads to the following incoherent irradiance distribution:

and the following radiant intensity distribution:

Note the smoother variation of the radiant intensity distribution at higher resolution. Also note that since the BSDF file format allows for non-uniform spacing of data in angle space, it may 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.  The higher resolution BSDF file can be downloaded from the Attachment section of this page.

KA-01520