MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Update glTF PBR implementation to support current Khronos definition

Open kwokcb opened this issue 1 year ago • 9 comments

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.

kwokcb avatar Nov 13 '24 15:11 kwokcb

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 anisotropyStrength and anisotropyRotation parameters from KHR_materials_anisotropy. This MaterialX node doesn't need to consider glTF's anisotropyTexture parameter 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 dispersion parameter from KHR_materials_dispersion. This is equivalent to OpenPBR's transmission_dispersion_scale only when OpenPBR's transmission_dispersion_abbe_number is set exactly to its default value of 20. If the Abbe number is not 20, one must scale the dispersion accordingly (see formulas; it's just an inverse relationship).
  • The diffuseTransmission and diffuseTransmissionColor parameters 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. The diffuseTransmission parameter allows forward-scattering of light through a surface via the diffuse lobe, and diffuseTransmissionColor modulates 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.

emackey avatar Nov 18 '24 19:11 emackey

/cc @DrX3D who is putting together an RFP

emackey avatar Nov 18 '24 19:11 emackey

During ASFW Dev Days, May 15th, I would like to take a stab at getting anisotropy into the gltf_pbr node.

bowald avatar May 13 '25 14:05 bowald

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.

ld-kerley avatar May 13 '25 16:05 ld-kerley

@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.

emackey avatar May 13 '25 17:05 emackey

@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).

kwokcb avatar May 15 '25 13:05 kwokcb

@bowald - I've created a sub-issue for the anisotropy work

ld-kerley avatar May 15 '25 15:05 ld-kerley

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.

bowald avatar Sep 12 '25 12:09 bowald

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)

bowald avatar Oct 31 '25 10:10 bowald