Skip to content

Conversation

@panxinmiao
Copy link
Contributor

This PR adds support for the KHR_materials_pbrSpecularGlossiness extension in glTF.

It is important to note that this PR does not implement the Specular-Glossiness (SG) workflow itself (nor does pygfx intend to support the SG workflow).

Instead, during model loading, materials that use the SG workflow are converted into an approximate Metallic-Roughness (MR) representation.


For those who are interested in background:

In the early days of PBR rendering, two primary workflows were commonly used: the Metallic-Roughness workflow and the Specular-Glossiness workflow. Some engines supported both workflows simultaneously. The early glTF specification also supported both workflows via extensions. However, with the introduction of extensions such as KHR_materials_ior and KHR_materials_specular, the gap between MR and SG workflows was significantly reduced.

Over the following years, the MR workflow became increasingly dominant. Many newer glTF extensions and advanced PBR features—such as clear coat, thin-surface transmission, volumetric effects, iridescence, and sheen—were designed around the MR workflow. In late 2021, Khronos officially archived the KHR_materials_pbrSpecularGlossiness extension and no longer recommended it for authoring new glTF assets. Many engines gradually dropped SG workflow support and focused solely on MR. pygfx’s PBR pipeline is based on the MR workflow and has no plans to add full SG workflow support.

However, a substantial number of earlier assets were authored using the SG workflow, and many models on platforms such as Sketchfab still export with KHR_materials_pbrSpecularGlossiness. For engines that do not support the SG workflow (such as pygfx), users typically need to convert SG assets to MR using external tools before loading them, which can be inconvenient. This PR streamlines the process by automatically converting SG workflow materials to approximate MR materials during loading, allowing SG-based glTF assets to be used directly.


Test Case: SpecGlossVsMetalRough

image

The bottle on the right was originally authored using the Specular-Glossiness workflow. During loading, we convert it to the Metallic-Roughness workflow for rendering. As shown, its appearance is almost indistinguishable from the bottle on the left, which was created directly using the MR workflow. The visual differences are minimal and can be considered negligible.

@panxinmiao panxinmiao requested a review from Korijn as a code owner November 7, 2025 08:25
Copy link
Member

@almarklein almarklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These techniques are all new to me 😄 Thanks for the explanation; sounds reasonable to me!

@Korijn Korijn merged commit a16c23f into pygfx:main Nov 7, 2025
13 checks passed
@Korijn
Copy link
Collaborator

Korijn commented Nov 7, 2025

Pretty awesome that we can provide this "backwards compatibility" so plainly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants