Update glTF PBR implementation to support current Khronos definition
Target
- To improve glTF <-> USD interop.
Requirements
The glTF PBR implementation is out of date and requires updating to support:
- [x] Anisotropy: https://github.com/AcademySoftwareFoundation/MaterialX/issues/2390 : In progress
- [ ] Dispersion : Not started.
- [ ] Diffuse Transmission (future extension) : Not started.
- [ ] Thin Walledness: https://github.com/AcademySoftwareFoundation/MaterialX/issues/1936 : Started, Not completed
Requester
There is a RFP for work to be done for Khronos.
Thanks for getting this ball rolling @kwokcb! I'll fill in a bit more detail here on the work Khronos is looking for specifically:
The gltf_pbr.mtlx node of MaterialX should be updated to include new PBR parameters that have been made available since this node was first introduced, specifically:
- The
anisotropyStrengthandanisotropyRotationparameters from KHR_materials_anisotropy. This MaterialX node doesn't need to consider glTF'sanisotropyTextureparameter here, although transformation scripts will need to take it into account (for example if a given MaterialX graph supplies a texture to one of the first two parameters, it will need to be encoded into a texture when it is exported to glTF). - The
dispersionparameter from KHR_materials_dispersion. This is equivalent to OpenPBR'stransmission_dispersion_scaleonly when OpenPBR'stransmission_dispersion_abbe_numberis set exactly to its default value of20. If the Abbe number is not 20, one must scale the dispersion accordingly (see formulas; it's just an inverse relationship). - The
diffuseTransmissionanddiffuseTransmissionColorparameters from KHR_materials_diffuse_transmission. Don't get distracted by the glTF spec's use of the terms "Factor" vs "Texture", those are just choices between uniform vs per-texel in glTF land and have no bearing on the MaterialX node graph, which is always procedural. ThediffuseTransmissionparameter allows forward-scattering of light through a surface via the diffuse lobe, anddiffuseTransmissionColormodulates the color of such light. - The thin-wall issue mentioned in the original post above.
Also, looking in the MaterialX translation folder, I currently see translation graphs from OpenPBR to SS, and another from SS to glTF. Ideally, Khronos PBR would like to see a graph go directly from OpenPBR to glTF, and another from glTF back to OpenPBR.
/cc @DrX3D who is putting together an RFP
During ASFW Dev Days, May 15th, I would like to take a stab at getting anisotropy into the gltf_pbr node.
Welcome @bowald - good to have you onboard - if you have any questions related to this PR the #materialx slack channel on the ASWF slack is a great place to get your question in front of a lot of wise minds.
@bowald Awesome! If you have questions about glTF's PBR, please get them to me or just post them here on GitHub, and I'll find the right person to answer from the Khronos / glTF side of things.
@ld-kerley as an admin thing so that this issue does not completely get marked as fixed, can we spawn a child issue and assign that and link it here ? (Similar to how thin-wall is separated out).
@bowald - I've created a sub-issue for the anisotropy work
Regarding Dispersion, I would say to wait until issue: https://github.com/AcademySoftwareFoundation/MaterialX/issues/2202 is resolved. When the abbe number input exists in the dielectric_bsdf then it should be to multiply the dispersion input with 20.0 and hook it into the bsdf.
Dispersion Input is now added to gltf_pbr as of PR: https://github.com/AcademySoftwareFoundation/MaterialX/pull/2636
However, without rendering support (which is the same status as the corresponding versions in OpenPBR and Standard Surface mtlx shaders)