Alpha Masking
The original idea I had concerning the scene I wanted to render for the rendering
computation would have involved a lot of plants. Since modelling the actual geometry
of each individual leaf is time-consuming and also expensive to render, alpha masking
gives the option to instead supply a much simpler geometry and selectively ignore
intersections with the object based on the provided alpha mask.
This check could easily be done in the intersection routine of the Instance
class.
Yet while creating a test for my implementation I stumbled upon an issue of this approach,
because I happened to apply the alpha mask to a Sphere.
Simply dismissing the intersection in this case leads to incorrect results,
since the ray can intersect this primitive two times and would therefore still be
able to hit it even if the first intersection is dismissed based on the alpha mask.
This meant that the shape itself rather than the instance had to take the alpha mask into account, since the instance is unable to tell whether the ray might intersect its child shape multiple times.
I did not encounter any further problems while implementing this logic for each of the
three shapes available in lightwave.
Neither the FakeVolume class nor the
SdfMandelbulb class I implemented in addition to the default lightwave shape classes, take a possible alpha map into
consideration though, since the first class was only meant to be a temporary solution
and the second one does not have a straightforward way to define UV-coordinates.
In my render, alpha masking was used to include the birds, which are actually just rectangles with a hand-drawn alpha mask in the shape of a bird and a black diffuse BSDF.