Looks great! The logic is indeed much more clear now.
This is not a flatten operation, maybe call it something like copy_light_tree_node_to_device()
?
Similar here, it's mainly copying to device but also flattens subtree. Maybe better to rename too? Something with copy_and_flatten()
The last few commits aim to mitigate the energy loss issue.
Energy loss due to single-scattering microfacets
We refer to the paper [Practical multiple scattering compensation for…
refract_angle()
I tried to isolate individual lobes. The TRRT+ term in Principled Hair doesn't seem to make a drastic difference:
Not sure why this was 4 before, there are only 2 closures, ...HairBSDF
and ...HairExtra
.
The curve normal (which is needed for orienting the cross-section) is not considered in the legacy hair curve. I don't want to put too much effort into this if the legacy curve is to be discarded at some point.
These are utitily functions for matching direct color with absorption coefficient. They are designed for Principled Hair BSDF, and don't seem to match very well with the Microfacet Hair BSDF. Currently I just "borrow" these functions so direct coloring is also available for the new model. I could move the three shared functions to bsdf_util.h
, or duplicate them in bsdf_hair_microfacet.h
, if this matters.