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

Improvements to texture export functionality to handle compressed textures #5386

Merged
merged 1 commit into from Jun 13, 2023

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jun 13, 2023

Improvements to texture conversion code to canvas, which is internally used by Usdz and Gltf exporters. If the texture is not natively supported by the browser, it gets rendered by a simple shader to render target (which decompresses it from Basis or other compressed formats). We extract pixels from this render target and construct a canvas from it.

Note that this function has internally been made async and returns a promise, to in the future allow async getPixels call.

Additionally, the exporters themselves were update to use this modified function as async, so their internal flow has been changed a bit to handle this.

Fix: originally, those public export functions were incorrectly declaring return type as ArrayBuffer. This has now been fixed to declare it as Promise<ArrayBuffer> as that is what they are returning.

@mvaligursky mvaligursky merged commit 97e30f6 into main Jun 13, 2023
7 checks passed
@mvaligursky mvaligursky deleted the mv-texture-export-improvements branch June 13, 2023 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: gltf area: graphics Graphics related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants