Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTFLoader, GLTFExporter: Remove KHR_materials_pbrSpecularGlossiness #24950

Merged
merged 2 commits into from
Nov 15, 2022

Conversation

donmccurdy
Copy link
Collaborator

@donmccurdy donmccurdy commented Nov 14, 2022

The Khronos Group archived the KHR_materials_pbrSpecularGlossiness extension ("no longer recommended for creating new files") about a year ago. I think it would be reasonable for us to remove support at this point, and focus efforts on the metal/rough workflow instead. All new and upcoming PBR features — volumetric refraction, iridescence, clearcoat, subsurface scattering, ... — are authored around the metal/rough model. With support for KHR_materials_ior and KHR_materials_specular, there is no particular advantage left to the spec/gloss model.

Existing spec/gloss models can be converted losslessly to metal/rough with:

npm install --global @gltf-transform/cli

gltf-transform metalrough in.glb out.glb

Related:

Migration guide:

@donmccurdy
Copy link
Collaborator Author

@takahirox
Copy link
Collaborator

I think it's ok to remove them. For users who still need the extension, we can provide the plugins at or somewhere else.

https://github.com/takahirox/three-gltf-extensions

@donmccurdy
Copy link
Collaborator Author

donmccurdy commented Nov 14, 2022

@elalish following up on #23630 (comment) — the web app https://gltf.report will now do the spec/gloss → metal/rough conversion automatically. The same conversion could be applied in other web-based tools, with:

import { WebIO } from '@gltf-transform/core';
import { KHRONOS_EXTENSIONS } from '@gltf-transform/extensions';
import { metalRough } from '@gltf-transform/functions';

const io = new WebIO().registerExtensions(KHRONOS_EXTENSIONS);

const document = await io.readBinary(byteArray);

// spec/gloss → metal/rough
await document.transform(metalRough());

const glb = await io.writeBinary(document);
@mrdoob
Copy link
Owner

mrdoob commented Nov 15, 2022

I also think it's time 👍

@mrdoob mrdoob added this to the r147 milestone Nov 15, 2022
@mrdoob mrdoob merged commit e29c14b into mrdoob:dev Nov 15, 2022
@donmccurdy donmccurdy deleted the cleanup/gltfloader-remove-specgloss branch November 15, 2022 11:13
@elalish
Copy link
Contributor

elalish commented Nov 21, 2022

SG, thanks @donmccurdy! Now I just need to remember to point people to that tool in our next release notes.

@donmccurdy
Copy link
Collaborator Author

donmccurdy commented Nov 29, 2022

Also, here's a migration guide for converting existing glTF files:

@takahirox
Copy link
Collaborator

It's good to add it to the Three.js migration guide? https://github.com/mrdoob/three.js/wiki/Migration-Guide

@donmccurdy
Copy link
Collaborator Author

Thanks, I'd missed that it covered r147 already — done!

@elalish elalish mentioned this pull request Dec 12, 2022
@elalish
Copy link
Contributor

elalish commented Dec 12, 2022

@donmccurdy Does gltf-transform work in the browser so that I could add this conversion to our editor?

@donmccurdy
Copy link
Collaborator Author

donmccurdy commented Dec 12, 2022

@elalish the script above, #24950 (comment), will work in a browser, yes. 👍

What I'd do would be to load from the URL or DataTransfer API into glTF Transform, then export a GLB as Uint8Array, and to parse or load from a Blob URL in THREE.GLTFLoader from there. Happy to take questions in discussions as well!

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