-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add support for glTF EXT_texture_webp #7486
Conversation
Thanks for the pull request @OmarShehata!
Reviewers, don't forget to make sure that:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
Thanks @OmarShehata. When you open the glTF extension PR:
Please don't discuss the above here; the glTF repo is the right forum when you open the PR. Also, as we discussed offline, please have a warning of some sort when WebP isn't supported - and, I assume, when it is "supported" but crashes - and submit an issue to remove the warning when the browser vendors issue a fix. |
@OmarShehata let me know if you want to investigate a WASM decoder instead, I have code that might help you get started. |
Firefox 65 is now out with official WebP support, so Safari is probably the only major browser we ultimately need to worry about (since all iOS browsers are Safari under the hood.) |
Fixes #6935 |
@OmarShehata what's the plan for this PR? I assumed we wanted it in the next release (sans fallback) but is that not the case? |
|
That's all I have for this pass. |
Ok @lilleyse I think all of Matt's comments have been resolved now, this should be ready. The only thing I have not been able to test yet is whether it correctly detects WebP support on Safari/on a Mac. |
In Safari it correctly throws the error "Loaded model requires WebP but browser does not support it." if the extension is in |
Thanks @lilleyse ! Should be all good now. |
Can we also consider the avif format, which is twice as small as webp. |
This PR provides a reference implementation for the glTF extension
EXT_image_webp
(KhronosGroup/glTF#1534). It also provides a sample model (CesiumBoxWebp.gltf) that uses this extension.The extension is defined on the
texture
node:FeatureDetection
will check if WebP is supported in this browser, and if so, use the provided WebP, otherwise it will fallback to the PNG. If the glTF definesEXT_image_webp
inextensionsRequired
and this browser does not support WebP, it will currently throw a runtime error.To test in Sandcastle:
localhost url. Current browser support:
To Do
FeatureDetection.supportsWebp
works is a little weird because it's the only async function in there. I haven't found a way to synchronously test this. This might be a good time to have something where we do a series of quick canvas checks on startup that'll be cached (where we could check WebGL extensions that are reported to be supported but aren't actually).Consider decoding WebP in the browser with libwebpjs if it's not supported?Will address in a future PR