# Zemax Tabular BSDF data file format

This article describes the Zemax Tabular BSDF data file format that is required for the BSDF scattering model. This model is used to apply a scattering distribution as provided by tabular BSDF data on a non-sequential surface.

Authored By Ron Rykowski, reviewed by Sandrine Auriol

Article attachments

## Introduction

The Zemax Tabular BSDF data file format is a compact, simple way to transfer BSDF data. Devices like the Imaging Sphere (IS-SA) developed by Radiant Vision Systems can provide a full hemisphere of BSDF data in a single measurement, thus requiring a way to export this data for straightforward use in an optical design program, such as OpticStudio.

This file format is employed by the BSDF scattering model, which is described in the article "How to use Tabular BSDF Data to Define the Surface Scattering Distribution". This model uses the BSDF data provided in the input file to generate a scattering distribution, which may be applied to any non-sequential surface in OpticStudio.

## Definition of angles and coordinate systems

There are four important angles that describe how light scatters from a surface. They are defined below in order of importance:

• Sample Rotation (enumeration label: SampleRotation)
• Angle of Incidence (enumeration label: AngleOfIncidence): this name is a misnomer. This angle actually represents the specular reflected or transmitted angle.
• Azimuth Scatter angles (enumeration label: ScatterAzimuth)

The order of the four angles is important:

• for every Sample Rotation, you can have data for multiple Angles of Incidence.
• For every Angle of Incidence, you can have data for multiple Azimuth angles.
• For every Azimuth angle, you can have data for multiple Radial angles.

## Sample rotation

The sample rotation measures the angle between the normal of the plane of incidence and the +X local axis of the object in the counterclockwise direction.

All values for the sample rotation are between 0 and 360 degrees with non-zero values corresponding to rotation of the sample in the counterclockwise direction relative to the +X axis of the object.
It means that if an incident ray is in the YZ local plane of the object (and the angle setting of the BSDF in OpticStudio is set to 0), then the sample rotation would be considered equal to 0. The angle setting of the BSDF is defined in "How to use Tabular BSDF Data to Define the Surface Scattering Distribution".
OpticStudio uses the +X local axis of the object, and not the face of the object. This is important to consider when using a BSDF on an object, as the BSDF might not be correct on faces other than the front face.
Here are a few examples to understand how the sample rotation works. Both images assume that the 'Angle' setting in object properties is set to zero:

## Angle of incidence

The angle of incidence can be a bit of a misnomer. It is the angle of the specular ray AFTER reflection or transmission.

 BRDF BTDF Angle of incidence Angle of specular reflection Angle of direct transmission

• For BRDF, the ScatterRadial and ScatterAzimuth angles are defined relative to the angle of specular reflection. In this way, the number of values that must be reported is reduced, especially for mostly specular samples.
• For BTDF, ScatterRadial and ScatterAzimuth angles are defined relative to the angle of direct transmission.

So if light is incident at an angle of 20 degrees on a scatter rectangular volume with an index of refraction of 1.5, the angle of specular reflection is 20 degrees and the angle of direct transmission is 13.2 degrees (=asin(sin(20)/1.5).

To find the scatter distribution in reflection, one needs to look at the BSDF block for an "angle of incidence" of 20 degrees.
To find the scatter distribution in transmission, one needs to look at the BSDF block for an "angle of incidence" of 13.2 degrees.

## Scatter Radial / Scatter Azimuth

• For BRDF: the ScatterRadial and ScatterAzimuth angles are defined relative to the angle of specular reflection for BRDF.
• For BTDF, ScatterRadial and ScatterAzimuth angles are defined relative to the angle of direct transmission.

Radial 0° is defined at the angle of specular reflection, with increasing Radial angles extending outward.
Azimuth 0° is defined by pointing from the angle of specular reflection towards the axis normal to the sample, with Azimuth angles increasing in a counterclockwise fashion.

## Geometry in an example

Let’s have a look at an example. The scattering surface below has a scatter profile given by the following Tabular BSDF.

Let's compare two cases:

• A Source Ray sends rays in the YZ plane with an angle of incidence of 20 degrees.
• A Source Ray sends rays in the XZ plane with an angle of incidence of 20 degrees.
 Plane of incidence YZ XZ Angle of incidence 20 degrees 20 degrees Sample rotation 0 degrees 90 degrees Azimuthal reference The phi angle is pointing up. The phi angle is pointing to the right. Geometry

## Definition of file format

The Zemax Tabular BSDF data file is simply a formatted text file with a *.BSDF extension. Below is a table which lists each text and data line of the file along with possible values.

  Line  Description  Values  #    1 Source Measured  2 Symmetry PlaneSymmetrical Asymmetrical Asymmetrical4D PlaneSymmetrical: The measured data is symmetrical about the illumination axis of the measurement, so only 180° degrees of Azimuth data are reported. Use this setting for isotropic samples with plane symmetry. Asymmetrical: Use PlaneSymmetrical or Asymmetrical4D instead. There is no symmetry in the measured data; no sample rotations. All 360° of Azimuth data is reported. Use this for isotropic samples (only one sample rotation). Asymmetrical4D: There is no symmetry in the measured data; includes sample rotations. All 360° of Azimuth data is reported. Use this for anisotropic samples (multiple sample rotations).  3 SpectralContent Monochrome XYZ Monochrome: There will only be one group of enumerated data between DataBegin and DataEnd. This group is labelled by an added line above the DataBegin line (line 14 in Table 1). XYZ: There will be three groups of enumerated scatter data, one for each Tristimulus value. Each group is labelled by an added line above the DataBegin line (line 14 in Table 1). Note in this article, we explain the format of BSDF data for CIE tristimulus values XYZ. However, OpticStudio doesn't currently support the scattering model for the BSDF data with CIE tristimulus values. If you load the BSDF data with CIE tristimulus values XYZ in your system, only Y group values will be used.Radiant Vision Systems’ IS-SA does not measure full spectral content, but only Tristimulus data. Monochrome is the same as Tristimulus Y (photopic).  4 ScatterType BRDF BTDF The file format supports two inputs for the ScatterType value: BRDF and BTDF. However, this data is not used by OpticStudio. The software will ask for a BRDF and a BTDF files. BRDF: The coordinate system is defined so that Radial 0° corresponds to the angle of specular reflection. BTDF: The coordinate system is defined so that Radial 0° corresponds to the angle of direct transmission.  5 SampleRotation  Positive integer (no decimal points allowed)The model currently limits the Number of rotation angles to a maximum of 50.In order for the interpolation to work correctly, the Sample Rotation for anisotropic samples have to be defined from 0 to 360 degrees.  6   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. All enumeration values are positive. The number of enumeration values must match the number of sample rotation.The enumeration values do not have to be evenly spacedEach data line must terminate at the end of the last enumeration value for that line (i.e. there should be no additional spaces or tabs at the end of the data line).  7 AngleOfIncidence  Positive integer (no decimal points allowed).The model limits the Number of incident angles in the input *.BSDF file to a maximum of 100.  8   All enumeration values are positive. The upper limit for the angle of incidence is 90 degrees.The number of enumeration values must match the number of angles of incidence.The enumeration values do not have to be evenly spacedEach data line must terminate at the end of the last enumeration value for that line (i.e. there should be no additional spaces or tabs at the end of the data line).  9 ScatterAzimuth  Positive integer (no decimal points allowed)The model limits the Number of azimuthal angles to a maximum of 1000.  10   The upper limit of Azimuth angles is defined by the Symmetry variable:- 180° for PlaneSymmetrical- 360° for ASymmetrical, ASymmetrical4DAll enumeration values are positive. The number of enumeration values must match the number of azimuth angles.The enumeration values do not have to be evenly spacedEach data line must terminate at the end of the last enumeration value for that line (i.e. there should be no additional spaces or tabs at the end of the data line).  11 ScatterRadial  Positive integer (no decimal points allowed) The model limits the Number of radial angles to a maximum of 1000.  12   The overall upper limit of Radial angles is 180°.All enumeration values are positive. The number of enumeration values must match the number of radial angles.The enumeration values do not have to be evenly spacedEach data line must terminate at the end of the last enumeration value for that line (i.e. there should be no additional spaces or tabs at the end of the data line).  13   14   15 DataBegin  DataBegin and DataEnd statements surround each large group of data. Following the TIS value, Scatter data is enumerated with columns representing the ScatterRadial values for each ScatterAzimuth row. The rows are organized in groups. First, the ScatterAzimuth values are reported for each AngleOfIncidence. Data for each AngleOfIncidence, which contains various ScatterAzimuth rows, is then reported by following rows. Data for each SampleRotation, which contains various AngleOfIncidence groups, is then reported by appending more rows. 16   Before each block of scatter data for a given Angle Of Incidence is a value for Total Integrated Scatter. That value is on a separate line preceded by “TIS”. The value is a fraction, such that a value of .500 would indicate that 50% of the light is scattered, and the remaining is absorbed or transmitted in the case of BRDF.  17   Table of the measured BSDF according to radial and azimuthal angles, for the sample rotation N°1 andthe incident angle N°1.The table may take several lines.  18+   Table of the measured BSDF according to radial and azimuthal angles, , for the sample rotation N°1 andthe incident angle N°2.The table may take several lines  19 DataEnd 
1.

## Example 1: Monochrome Isotropic sample

Isotropic samples show symmetrical data about the illumination axis of the measurement. The built-in sample file BrownVinyl.bsdf is an example of an isotropic BSDF.
It can be found under "{Zemax}\ScatterData\BrownVinyl.bsdf". Open the file in a text editor.

• There is only one wavelength (SpectralContent is set to Monochrome), so it means that there is one contiguous data group with one DataBegin and one DataEnd statements.
• The BSDF symmetry setting is set to PlaneSymmetrical, meaning that the azimuthal values are defined from 0 to 180 degrees.
So, the BSDF value for a radial angle = 10 and an azimuthal angle = 200 (180 + 20) is the same than the BSDF value for a radial angle = 10 and an azimuthal angle = 160 (180-20).

• Note the placement of Incidence angle groups, Azimuth angle groups, and Radial angle columns.
• This example only includes data for one sample rotation. If there are multiple sample rotations, the data group will have additional lines of data after the last data line, but before the DataEnd statement.

## Example 2: Monochrome anisotropic samples

Anisotropic samples show no symmetry in the measured data and so the distribution will vary with the sample rotation. Although OpticStudio can read Asymmetrical data (one sample rotation) or Asymmetrical4D (several sample rotations) in the symmetry setting of the BSDF data format, it is recommended to use Asymmetrical4D as an anisotropic sample will likely change with the rotation of the sample.

The file called asymmetrical4d_btdf_zemax.bsdf in the Download section is an example of a monochrome asymmetrical4D BSDF data format. It shows how to define an anisotropic sample.
There is only one contiguous data group, and one DataBegin and DataEnd statement. The BSDF symmetry is set to Asymmetrical4D, meaning that the azimuthal values are defined from 0 to 360 degrees. The file also contains different sample rotation values, as the BSDF will change against the sample rotation.

## FAQ

• OpticStudio can’t read my BSDF file. Is there an issue with the format?
The BSDF file is sensitive to formatting, so for any issues, we recommend opening the BSDF file with a text editor like Notepad++ and click on Show All Characters. The formatting should be identical to one of the attached examples.
• Are measured tabular BSDF with Radiant Vision System’s IS-SA direct given in the same format as OpticStudio?
Data from Radiant Vision System's IS-SA undergoes a rotational transformation to match this coordinate system, as the illumination axis of IS-SA is not defined at 0° Azimuth.
Note that the data appears rotated. Azimuth 0° is defined to be along the axis of illumination for this format, but the standard Imaging Sphere coordinate system (which is used to display this transformation) defines Azimuth 0° as normal to the axis of illumination, as shown in the top image.
• Can tabular BSDF in OpticStudio vary with the wavelength?
The Zemax Tabular BSDF data format can contain BSDF values for each Tristimulus XYZ. However, OpticStudio will only read the data for the Tristimulus Y.
An example is provided under Download. The file called XYZ_PlaneSymmetrical_btdf_zemax.bsdf is an example of the Color (XYZ) BSDF data format.
Note that each separate Tristimulus value has a separate DataBegin and DataEnd statement. If there are multiple sample rotations, each Tristimulus grouping will have additional lines of data after the last data line, but before the DataEnd statement.

KA-01372