Figure 1: Use cases where ray tracing algorithms were extended using custom intersectors. From left to right: billboards, the alpha mask stored in the billboard images is ignored. Second from left: the alpha mask from the billboard images is used to conditionally continue BVH traversal when the surface has zero opacity near the hit point. Second from right: procedural alpha mask applied using custom intersectors. Right: debug image, the number of BVH nodes and the number of primitives inside the encountered leaf nodes is used to generate a heat map. This is done by intercepting the BVH traversal routine with a custom intersector that counts the number of ray object interactions.
AbstractMost ray tracing libraries allow the user to provide custom functionality that is executed when a potential ray surface interaction was encountered to determine if the interaction was valid or traversal should be continued. This is e.g. useful for alpha mask validation and allows the user to reuse existing ray object intersection routines rather than reimplementing them. Augmenting ray traversal with custom intersection logic requires some kind of callback mechanism that injects user code into existing library routines. With template libraries, this injection can happen statically since the user compiles the binary code herself. We present an implementation of this "custom intersector" approach and its integration into the C++ ray tracing template library Visionaray.