Add Chiang hair BSDF
Add Chiang hair BSDF.
This PR provides Chiang hair BSDF model and related nodes proposed by #1973
The nodes to add are:
<hair_chiang_bsdf>: The BSDF<hair_roughness>: User friendly roughness mapping<hair_absorption_from_melanin>: Absorption coefficient mapping from melanin parameters<hair_absorption_from_color>: Absorption coefficient mapping from user input color
It also include simple_hair_default material as a node graph example.
Just to recap concretely the request made in the TSC meeting - it would be great if this PR could also include updates to the PBR spec document reflecting the new nodes being added here
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/Specification/MaterialX.PBRSpec.md
Thanks for the recap @ld-kerley. I will update this PR including the PBR spec document sometime soon.
I think the sqrtPiOver8 factor might be an internal BSDF implementation detail, rather than something that should be done externally. For example, MDL already applies this factor internally. https://github.com/NVIDIA/MDL-SDK/blob/master/src/mdl/jit/libbsdf/libbsdf_hair.h#L174
It can be internal. Although that part in MDL I'm not sure. MDL applies the $\sqrt{\pi/8}$ factor for both longitudinal and azimuthal roughness but the original paper (Appendix A. eq. 12) applies it only for azimuthal roughness, so I followed the paper. Other than that, it works for me.
MDL applies the π/8 factor for both longitudinal and azimuthal roughness
I don't think it does. The MDL hair_prepare_roughness() function in that github link I posted only applies it to the Y component.
Given the π/8 factor is in the appendix, rather than in equation 8, makes me think it probably should be part of the internal BSDF implementation rather than in <hair_roughness>. But happy to defer to others for that decision.
The MDL hair_prepare_roughness() function in that github link I posted only applies it to the Y component.
You're right. The factor is applied to only azimuthal!
I also see where your suggestion came from, and I feel the same now. I will include the change in next update.
I think <hair_roughness> might need some more changes. In its current form, someone can't tweak the TT and TRT scaling factors. So I'm thinking of two potential changes to accommodate this.
possible change 1) <hair_roughness> returns only a single "vec2 roughness" value (corresponding to roughness_R). This means it's only implementing equations 7 and 8, and any TT and TRT scaling should happen externally. or possible change 2) <hair_roughness> takes two additional inputs "tt_scale" and "trt_scale", which default to 0.25 and 4.0 (or should that be 0.5 and 2.0 with them being squared internally?)
Option 1 has less redundancy, but is more work for the user. Option 2 is easier to use, but has redundancy. I'm fine with either option.
I would prefer the second option with pre-squared defaults, 0.5 and 2.0. Indeed these scaling values are somewhat arbitrary but most implementations follow the Marschner's paper so I think it makes sense that the scaling is built-in and exposed in the parameters.
I will make this change as well. Thank you for the suggestion!
Great to hear that, and thank you for correcting the spelling issues!