Material Error Diagnostic With Raypaths
After a raytrace has been completed, it is always valuable to view the Raytrace Summary that is automatically printed to the Output Window to check for errors, One reasonably common error that the user needs to look out for is "Num rays halted because could not resolve proper material."
Material errors occur when a ray is known to be traveling in a material (e.g. "material A") but then is incident upon a surface that is defined as an interface between two different materials (e.g. "material B" and "material C") - thus demonstrating an inconsistency in the model setup. FRED halts the ray at this surface with this error message.
The FRED script attached to this article can help the user diagnose the cause of these errors.
First the user needs to run an Advanced Raytrace with "determine raypaths" and "create/use ray history file" options checked. Then, once the raytrace has completed, the script should be run which will loop over all rays and raypaths, gather some information and produce a report in the Output Window showing details regarding which ray paths these halted rays are on, the rays' material, and the materials of the surfaces.
For example, in the picture below the rays in the 1st, 3rd, and 4th rows are in a material called "491755.574711" but then arrive at surfaces which are defined as Standard Glass / Air interfaces. The full sequence of events leading up to this point can be viewed via the Raytrace Paths Report (under the Tools menu).