Material Assignments During Raytracing
This process is often transparent to the user, but it is important to understand how FRED determines which material the ray is in during the trace.
FRED's raytrace is "surface-based", meaning that rays intersect individual surfaces rather than solid objects. Although the user will typically have constructed a collection of surfaces to form a solid object, each surface is treated independently of the others during the raytrace. For example, consider a cube element primitive with the immersion material set to Standard Glass. When a ray hits one of the the cube's six surfaces, the raytrace engine considers only this surface in isolation of the others. How, then, does the raytrace engine resolve the fact that the ray will pass through this solid cube made of Standard Glass?
Each surface defines a boundary between two materials. In the case of the cube example, each of the six surfaces defines a boundary between Standard Glass and Air. These two boundary materials can be seen on the Materials tab of a surface's Edit/View dialog. Observe that the specification is, generically, "Material 1" and "Material 2". There is no specification of "where" these two materials are relative to the surface's local coordinate system.
Without any additional information, the specification above would be ambiguous (which side of the surface does each material reside on?). The additional key piece of information is that every ray knows what it's current immersion material is at all times during the raytrace. This information is stored with the ray and updated each time the ray interacts with a surface. When a ray interacts with a surface, the raytrace engine identifies which material assignment, either Material 1 or Material 2, matches the incident ray's immersion material. Let's say that the ray is immersed in Material 2 when incident on a surface. If the ray reflects from the surface, the ray keeps it's current immersion material. If the ray refracts across the surface boundary, its immersion material is updated to Material 1.
So, how does FRED know which material the ray starts in? If you edit a source using the Edit/View Detailed Optical Source option you will see an Immersion Material specification on the middle left of the Source tab. The default immersion material specification is Air.
In this scheme, the source's Immersion Material specification can have profound consequences on the interpretation of solid objects in the model. Below is a raytrace of a prism created using surfaces whose material designations are Air and N-SF6 and the source's immersion material is set to Air. When the rays are incident on the prism, they refract across the surface boundary and the rays become immersed in N-SF6. Next they refract through the central hole in the prism and become immersed in Air. Finally, they refract through the central hole boundary a second time and become re-immersed in N-SF6. This is consistent with our intended interpretation of the prism being a solid object made of N-SF6 and immersed in an Air environment.
In the picture below, the source's Immersion Material has been reset to N-SF6. The rays refract across the first boundary of the prism and become immersed in Air. Next, they refract across the inner hole boundary and become immersed in N-SF6. Lastly, they refract across the inner hole boundary a second time and become re-immersed in Air. By changing the source's immersion material, we have now defined a prism made of Air and immersed in a world of N-SF6!
FRED will report useful information to the output window following the conclusion of a raytrace, including this commonly encountered warning relating to materials:
"Num rays halted because it could not resolve proper material (warn:10)"
This warning is usually caused by two scenarios, both of which will halt the rays where the error is encountered:
- Rays propagating in material X intersect a surface with material assignments Y and Z. Since the rays' immersion material, X, does not match either of Y or Z at the surface boundary, the model has a physical inconsistency that cannot be resolved by the raytrace engine. If the rays are incident in material X, the surface being intersected MUST have material X assigned as one of its two materials.
- Coincident surfaces. It may be the case that two surfaces in the model are coincident with each other, leading to an ambiguity during raytracing (because of numerical precision) regarding which surface should be intersected. Consequently, rays may not intersect the surface that was intended in the design and can acquire an incorrect material assignment after interaction with the unintended surface. This ray's material assignment is now out of sequence with the physically intended layout of the model and such a ray is likely to encounter the scenario described in (1) above during a subsequent intersection.
A useful utility for checking material assignments as a ray propagates through the system is the Single Raytrace. A separate article on that utility is provided in the related articles list below.
The associated FRED file: PentagonalPrism.frd