Plotting Surface Particulate (Mie) Scatter
For most scatter models there is no difference in the BSDF values between transmitted and reflected scatter, and so there is no need designate whether a plot in transmission or reflection.
However, the Surface Particle (Mie) Scatter model is a volume effect having scatter components both forward and backward that may need to be accounted for in a plot of the BSDF, but the default plot in FRED will be for the reflected scatter only.
The FRED file included with this knowledge base article has an embedded script which writes out BSDF data to Microsoft Excel for plotting and accounts for application of the model in transmission.
Download the FRED File: miePlottingExcel.frd
Script Overview
The embedded script creating the plot makes use of FRED’s ability to communicate with programs such as Microsoft Excel using COM and the ScatterEval scripting function. The pseudocode for the script is the following:
- Find Mie scatter node and get its properties.
- Create Excel application object and workbook
- Begin loop over incident angles.
- Set incident and specular direction vectors (accounting for transmission or reflection).
- Begin loop over scatter angles.
- Set scatter angle on range from -89.5 to 89.5 degrees
- Calculate BSDF value from incident, specular and scatter vectors using the ScatterEval function
- Write BSDF value to Excel
- Plot the results in Excel
The coordinate system used for the incident, specular and scatter direction vectors is shown in Figure 1 below. In the case of transmission, the specular direction vector is the same as the incident direction vector. In the case of reflection, the specular direction vector changes sign in the z-direction.
Other than setting up the Excel objects and specifying the direction vectors, there are only a few commands in the script specific to the scatter model itself. The scatter specific script commandsused are:
FindScatter – Returns the node number of the scatter model.
ScatterPrepareForEval – Initializes a scatter model internally for evaluation. This must be run before a ScatterEval command.
GetMieScatter – Loads the settings for the mie scatter model into the T_MIESCATTER structure. The ApplyRefl structure member determines plotting in reflection or transmission.
ScatterEval – Returns the BSDF value for a given set of incident, specular and scatter direction vectors.
ScatterTIS – Returns the total integrated scatter for the requested mode