7.8. Scattering classes (TLightSurfaceInteractionStokes)

The implementation of the raytracer follows a strict object-oriented programming hierarchy. This means that an abstract base class defines the essential functionality that has to be provided, whereas the descendants of that base class carry the actual implementations based on different physical models.
In order to perform the scattering of the traced ray at material interfaces, the abstract (=empty) base class TLightSurfaceInteractionStokes is introduced. Its straightforward definition is:

As can be seen in the definition above, apart from an initialisation function, each descendant class of TLightSurfaceInteractionStokes essentially needs to implement a Process method. The method receives the current ray object, which, in turn, contains information on the current and previous collision point (see section 7.3.1). The Process function performs all evaluations and samplings processes that are required to determine the outcome of the current scattering event.
Depending on the three potential outcomes and result values of the function, the following manipulations of the current ray have to be performed by any implementation of the Process function:

  • lsiAbsorbed. The ray is absorbed, and the raytracing can be terminated. No further calculations of the Process function have to be performed, as the collision object already contains all information required for further processing (e.g. material etc.).
  • lsiReflected. The ray has been reflected off the surface. The ray origin point (rp) is set to the collision point, and the outgoing direction (rdir) is provided. Further, a new polarisation state defined by the Stokes vector (pState) and polarisation reference direction vector (spol), have to be set.
  • lsiTransmitted. All information regarding the refracted ray’s new origin, direction and polarisation has to be set. Beyond that, the entered medium’s absorption coefficient has to be provided (enteredTransparentMediumAlpha).

The currently implemented descendant classes of TLightSurfaceInteractionStokes are listed in Table 14. For reference, each class name begins with LSIS for Light Surface Interaction Stokes, as an early implementation of the raytracer did not consider polarisation.

Only the classes TLSISroughPol, TLSISidealBlack and TLSISidealTransparent are relevant for all validation and application cases covered in chapters 8 and 9. While the first is used to model any physical materials, the latter two are used to define surfaces used for measurement purposes (see section 7.10.4). The other classes were implemented for testing and additional validation purposes during implementation only.
Following the logic of object-oriented programming, further scattering classes can be implemented straightforwardly, inheriting definitions either from the base class or from its descendants.