As of d5b81a8ddd1f429bd55f4bd25ad92f7ca5a6dfc8 the hit record always stores the Jacobians and metric when created. Since most hit records are discarded due to being further away from the camera and therefore are not used for scattering, it is desirable to keep their computation as light-weight as possible.
idea 1: Make metric + Jacobians std::optional and store const ref to geometry. This leads to lazy evaluation and caching of these quantities.
idea 2: Never include the matrices in the hit record and always calculate them on the fly.
As of d5b81a8ddd1f429bd55f4bd25ad92f7ca5a6dfc8 the hit record always stores the Jacobians and metric when created. Since most hit records are discarded due to being further away from the camera and therefore are not used for scattering, it is desirable to keep their computation as light-weight as possible.
idea 1: Make metric + Jacobians
std::optional
and store const ref to geometry. This leads to lazy evaluation and caching of these quantities.idea 2: Never include the matrices in the hit record and always calculate them on the fly.