Logging material (Spot diagrams)
Using a plane primitive, create a new material which logs every intersections but passes rays through unaffected. Record some ray properties, maybe colour by wavelength?
This could be implemented as a decorator with an interstitial logging material that wraps an existing material and logs all ray interactions with the material.
Might be interesting in lens system designs to colour a material surface by ray density.
A cython version of this, and a decorator to apply it.
class LoggingMaterial(Material):
def __init__(self, material, log):
super().__init__()
self.material = material
self.log = log
self.importance = material.importance
def evaluate_surface(self, world, ray, primitive, hit_point, exiting,
inside_point, outside_point, normal,
world_to_primitive, primitive_to_world):
self.log.append(hit_point.transform(primitive_to_world))
return self.material.evaluate_surface(
world, ray, primitive, hit_point, exiting,
inside_point, outside_point, normal,
world_to_primitive, primitive_to_world
)
def evaluate_volume(self, spectrum, world, ray, primitive, start_point, end_point,
world_to_primitive, primitive_to_world):
return self.material.evaluate_volume(
spectrum, world, ray, primitive, start_point, end_point,
world_to_primitive, primitive_to_world
)
Would probably want to collect more information than just the hit point, e.g. spectral range of ray etc... Could be options on the logging material.