MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Proposal: Add `thinfilm_weight` input to supporting BSDF nodes

Open jstone-lucasfilm opened this issue 1 year ago • 2 comments

In shading models such as open_pbr_surface and gltf_pbr, we currently end up duplicating each thin-film supporting BSDF node, in order to correctly handle the thin-film and iridescence weights that these shading models require:

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/open_pbr_surface.mtlx https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/gltf_pbr.mtlx

Would it make sense to add a thinfilm_weight input to each thin-film supporting BSDF node, so that this duplication would no longer be required?

This would likely provide a significant performance improvement to these shading models, especially in filtered importance sampling contexts where environment lighting must be separately sampled and summed for each of the duplicated BSDFs.

jstone-lucasfilm avatar Jun 01 '24 23:06 jstone-lucasfilm

I'm CC'ing @niklasharrysson and @proog128 for their initial thoughts on this proposal, and members of the OpenPBR team may be interested as well.

jstone-lucasfilm avatar Jun 01 '24 23:06 jstone-lucasfilm

This sounds good to me. Besides the performance improvement, being able to blend in the thin-film effect feels very useful for artists.

Since this effect is achieved by switching in a different fresnel term, I'm not sure if there are any implementation details to work out? I guess both fresnel terms will need to be calculated to blend between. For path tracers it might complicated importance sampling if the fresnel term is accounted for there. But since this parameterization is part of the OpenPBR specification I'm sure there is a reference implementation one could follow there.

niklasharrysson avatar Jun 02 '24 14:06 niklasharrysson