- Home
- Non Sequential Ray Tracing
- Sources, Splitting and Scattering
- How to Use Tabular BSDF Data to Define the Surface Scattering Distribution
How to Use Tabular BSDF Data to Define the Surface Scattering Distribution
- By Sanjay Gangadhara
- Published 2 May 2008
- Sources, Splitting and Scattering
- Unrated
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.