# Fitting ABg scattering coefficients from raw measured data

## Abstract

In this article we explain how to fit the coefficients of OpticStudio’s ABg model from partial BRDF measurements to get the most accurate model of scattering. We explore two aspects of the problem: fitting the coefficients and managing the TIS issue.

Authored By Benoit Moulin

## Overview of the case study

Zemax OpticStudio uses various models for simulating scattering in optical systems (see What scattering models are available in OpticStudio?). The most precise model is obviously the BSDF model. One can set complete BSDF model from recording data with a full motorized goniometer bench, which gives an exact modeling of the real behavior of the sample.

Sometimes it is difficult to provide these data: measuring is complex and costly, data are partial, or imprecise. Thus, using a simpler model is easier in these cases.

## Description of the ABg mode

The ABg model is well described in the Help Files under The Setup Tab...Editors Group (Setup Tab)...Non-sequential Component Editor...Non-sequential Overview...Scattering (non-sequential overview)...Available Scatter Models.

$$\text{BSDF}(x) = \frac{A}{B+\left | x \right |^g}$$

Where x is the vector between the reflected and scattered rays projected in the sample plane and A, B and g are the parameters of the model.

In the above image, a ray is incident on a surface at some angle to the surface normal. We trace both a specular ray (shown only in reflection for simplicity) and a scattered ray.

• βo is the projection of the specular ray vector on the surface (not a unit vector)

• β is the projection of the scattered ray vector on the surface (not a unit vector)

• X = β0 -β

• θs is the angle of the scattered ray vs the surface normal.

• θr is the angle of the specular ray vs the surface normal

The ABg model gives a quite simple evolution of the BSDF value when x increases.  For many application cases this model is sufficient to model real scattering samples as scattering generally drops when the scattering angle is far from the specular ray.

g is the slope of the line in log-log space for x >>0 (see above).

A is the origin of this line.

A/B is the specular part, or the value of the flat line for x~0.

$$\log(\text{BSDF}(x)) = \log(A) - \log(B+\left |x \right |^g)$$
When x >> B, $$\log(\text{BSDF}(x)) \sim \log(A) - g\cdot \log(\left |x \right |)$$

## Fitting ABg coefficients

In our application example, the BSDF data are partial with only BRDF data of the sample for 4 incidence angles (0°, 20°, 40° and 60°) and for a single azimuth angle (incidence 20°, azimuth 30°). The specular data are not known for 0° incidence and there are no data over 70° of emergence angle (the emergence angle θr is the angle between the specular ray and the surface normal).

When one plots data in log-log space, a good linear evolution is seen. Thus the ABg model should be a good model to fit these data

The values are fitted with a Scilab/Matlab script to get the A, B, g coefficients .

x is calculated from angles: (here for a single phi angle)

function x=xABg(th0, th, phi) //th0 = incidence, th = emergence, phi = azimuth
for m=1:length(th0)
for n=1:length(th)
x(m,n)=sqrt((sin(th(n))*cos(phi)-sin(th0(m)))^2+(sin(th(n))*sin(phi))^2);
end
end
endfunction

For each incidence angle, A, B and g are fitted with a linear regression of the BRDF data. The script uses the 'polyfit' function which fits polynomials : here a first order polynomial is used y=ax+b.

function [A, B, g]=ABg_fit(x, brdf)
%%sort arrays values to get arrays with x growing
[x,k]=gsort(x,'g','i');
for i=1:length(k)
brdf2(i)=brdf(k(i));
end
j=1;
%%suppress 0 values from brdf
for i=1:length(brdf2)
if brdf2(i)<>0 then
brdf3(j)=brdf2(i);
x2(j)=x(i);
j=j+1;
end
end
%%linear fit in log-log space excluding weak x values (here only the first value)
p=polyfit(log10(x2(2:$)),log10(brdf3(2:$)),1);
%%calculus of coefficients
g=-p(1);
A=10^p(2);
B=A/brdf3(1);
endfunction

N.B: The special case of the unknown specular at 0° incidence can be solved by manually estimating the ratio A/B from other angles.

## TIS and OpticStudio simulation mechanism

TIS is the “total integrated scattering”. It is the part of incident energy which is scattered considering all scattering angles.

$$\text{TIS}(\theta_i,\phi_i)=\iint \text{BSDF}(\theta_i,\phi_i, \theta,\phi)\cos\theta\sin\theta \,d\theta \,d\phi$$

For most scattering models, OpticStudio normalizes the scattering BSDF data to get a TIS equal to the “Fraction to scatter” parameter which is generally a user input of the model. Below, the case of Lambertian scattering parameters:

For the ABg model, there is no possible “Fraction to scatter” parameter. OpticStudio automatically adds specular rays with the weight of all non-scattered energy (1-TIS).

When fitting data from BSDF measurement; TIS is more likely the part of all transmittance/reflectance energy, including specular. In the BSDF data, the non-scattered energy is considered absorbed by sample.

Using the fitted ABg coefficients with TIS < 1 will over-estimate the specular part in the scattering pattern simulated by the software.

The sample absorption can be modelled using the coating tools to define the surface reflectance, transmittance and absorbance. For example, the coating SAMPLE_ABSORB is defined with the “TABLE” keyword. It defines a sample that will reflect 20% of the incident energy and will transmit 0%, thus will absorb 80% of the incident energy.

TABLE SAMPLE_ABSORB
ANGL 0
WAVE 1 0.2 0.2 0 0 0 0 0 0

In the OpticStudio ray trace procedure, the ray first interacts with the surface, then generates reflected and transmitted rays with the energy weighted by the coating parameters. Then the ray is scattered, generating multiple rays weighted by scattering model parameters.

As the coating step is separated from the scattering step, OpticStudio cannot absorb energy in the scattering step. So, even with a coating, the specular is over-estimated, and the scattering under-estimated. This is because the energy is lost at the coating step which leaves less energy to scatter.

## Adaptation of TIS to get accurate modeling

To get an accurate model from the data, one should adapt the fitting process to take in account the TIS value and compensate the data in order to get a TIS = 1, or as close of 1 as possible. The fit process should respect OpticStudio methodology so that, in the software, the two ray tracing steps lead to a good model of scattering.

First, a fit of the data with the previous method gives a first set of A, B, g parameters. From these parameters, a first TIS value can be calculated.

function tis=TIS(A, B, g, th0, dth, dphi)
%A,B,g are parameters, th0 incidence angle, dth and dphi the numerical integration depth.
%initiate angle arrays
th=0:dth:%pi/2;
phi=0:dphi:2*%pi;
%calculus of x and product cos(theta)*sin(theta) for each angle
for m=1:length(th)
for n=1:length(phi)
x_tis(m,n)=sqrt((sin(th(m))*cos(phi(n))-sin(th0))^2+(sin(th(m))*sin(phi(n)))^2);
cossin(m,n)=cos(th(m))*sin(th(m));
end
end
%integration of the resulting arrays
tis=sum(A./(B+x_tis.^g).*cossin)*dth*dphi;
endfunction

This TIS value is stored: it will be the reflectance value in the coating table data. Then, the input data are divided by the TIS value. This leads to greater BRDF data values, which can be seen as the BRDF values without any absorption.

Finally the new BRDF data are fitted to find a new set of A,B,g coefficients. The new TIS2 value of these coefficients must be 1, or really close to 1.

This way, it is possible to get data for OpticStudio input into separate data for absorbance and scattering. Parameters of the scattering surface are added in the ABg Scatter Catalog Editor (Libraries tab), and a TABLE coating is defined in the Coating Catalog

Accuracy of the TIS calculations highly depends on the numerical integration depth. When a value is input in OpticStudio, one could find a small gap between the software calculation and value originated from the script. In the case of a TIS above 1 (example: 1.00002), OpticStudio does not accept the value. One could slightly adjust the value of A to get TIS just below 1.

## Experimental data vs simulation data

To confirm the model, OpticStudio is used to model the BRDF measurement. In Non-Sequential mode, a punctual collimated source generates rays towards the sample surface. A set of detectors around the sample measures the scattered radiance from the sample. The detector acceptance angles are -90° to 90° with 181 pixels to get 1° radiance resolution when used in radiance mode.

A Multi configuration editor is used to modify the incidence of the source.

The merit function is built to calculate automatically the BRDF coefficients. The NSDD operand retrieves the maximum flux per solid angle (pix = -1 (max value), data = 2 (flux/solid angle)).

The BRDF is defined as radiance / irradiance in $$sr^{-1}$$ unit.

The power of the source is 1W.

The surface of the detector equals the sample surface.

So, the NSDD value must be divided by cosine of emergence angle to get the BRDF value. This will take in account the variation of apparent area of the sample viewed from the detector.

Results of the fit are represented as solid lines, and the measurement are cross points. The model fits accurately measured data, except far from the specular ray. This is partly due to the accuracy of the ray-tracing : the more rays are traced, the more accurate the simulation of scattering far from specular ray is.

Here is the same graph with 5x and 25x more rays in the simulation.

A gap remains between the measured and simulated data due to the model itself.

The ABg model has only 3 parameters. It cannot fit exactly the measured BRDF. Often, it is not necessary to get an exact model of scattering. A scattering simulation close to a good order of magnitude of real scattering is sufficient. Here the model found is far more accurate than just “an order of magnitude”.

It is interesting to see that the 30° azimuth plot (purple) has not been used to fit the ABg coefficients. Still, these data are accurately fitted. This is the strength of the ABg model. The BRDF depends only on the X factor, but this is accurate for many scattering patterns.

Before using ABg model, check that the BRDF measurement can be correctly linearly fitted in Log-Log space as explained in the beginning of the Fitting ABg coefficients section. In some cases, data shows some parts of linear behavior with various slopes. ABg model could be used, thanks to “ABg files” which could superimpose multiple scattering patterns. For more information on ABg files, see How to use multiple ABg profiles to define an object's surface scatter property.

## Conclusion

ABg scattering model is a simple and powerful tool to simulate scattering effects. In this article we give a method to fit the parameters of the model on a partial BRDF data measurement set. Then we explore the TIS aspect of the model in OpticStudio, which should be addressed with care to correctly simulate absorption, specular reflection, and scattering. Finally, we see results on fitting real BRDF data, and an overview of a simulation of BRDF measurement in OpticStudio.

## References

About ABg scattering model: Approximated Scatter Models for Stray Light Analysis, Richard N. Pfisterer