-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
CompressedTextures: Add support for serialization/deserialization. #17974
Comments
I guess #17745 should already implement a better error handling. It would be great if you can give it a try 👍 |
Hmm it seems like the issue is a bit more complex than I thought, but I think I can make this work. Do you know by any chance if there are situations where it is actually possible to serialize CompressedTextures? Or would it be ok to just generate a warning whenever you try to serialize any CompressedTexture? I don't want to break existing functionality. |
I'm not aware of anything like that. That would mean you have to decode the compressed texture on JS side and then transform it into something that can be serialized via |
It should be possible to implement that, but the behavior might not be what you want. For example, after loading a Basis texture, the original data is transcoded into something compatible with the device's GPU. If you serialize that, you'll be serializing data that's only compatible with certain GPUs, and other devices won't be able to use it at all. So in terms of saving or transmitting textures, it's not ideal. :/ |
@donmccurdy ah yes, I was expecting that. The original basis data is lost once it is transcoded to a format that the gpu supports. My plan was not to include the texture in the serialized data. But rather to show a warning in the console and continue with the serialization of the object, instead of throwing an error. |
This should do it #17978 |
Description of the problem
When calling
toJson()
on an object that contains a CompressedTexture, an error gets thrown:My specific use case is that I load textures in the basis universal format, and I call
toJSON()
to export my entire scene to a file in order to debug it in the threejs editor.I don't think it's easy to convert a compressed texture to a data url. But I'll try to make a pull request that at leasts gives a warning and exports it without the texture. Instead of throwing an error.
Three.js version
r110
Browser
Chrome
OS
MacOS
The text was updated successfully, but these errors were encountered: