donmccurdy / three-gltf-viewer

Drag-and-drop preview for glTF 2.0 models in WebGL using three.js.
https://gltf-viewer.donmccurdy.com/
MIT License
2.12k stars 537 forks source link

Feature basis texture support #199

Closed JohannesDeml closed 4 years ago

JohannesDeml commented 4 years ago

Support linked basis textures would be great. I tried implementing the feature here: https://github.com/JohannesDeml/three-gltf-viewer/tree/feat-basis

I get errors for not finding the blob basis file: blob:http://localhost:3000/d_image_template.basis net::ERR_FILE_NOT_FOUND

The url also does not look hashed. Do you have any idea how I can fix this? This is my test file: sculpture_extended.zip

donmccurdy commented 4 years ago

The glTF format supports references to PNG and JPEG images only, for now.

There is work in progress to support textures compressed with Basis technology, although the file extension will be .ktx2 and not .basis. You can use gltfpack to create files using the (still experimental) .ktx2 extension, and view them in https://sandbox.babylonjs.com/.

JohannesDeml commented 4 years ago

Thanks a lot for the response and your insights!

Even though I did hear of ktx2, I didn't know that this will be the sole supported format for gltf (apart from jpg and png). Thanks a lot for the gltfpack reference, very interesting repo.

When including the basis file directly in the gltf te GLTFLoader from threejs can handle the basis file if the basisloader is set for loading basis files (I think that is also the way gltfpack handles basis files when setting the -tb flag). This is what I did and that works for files accessed normally, I think the problem lies somewhere in the blob url creation for basis files?

From what I understand, even if I get it running, this solution is not of interest for you, since gltf with use ktx2 in the future?

donmccurdy commented 4 years ago

From what I understand, even if I get it running, this solution is not of interest for you, since gltf with use ktx2 in the future?

Right, sorry — I'm not interested in supporting features that aren't officially part of glTF, or at least pretty close to becoming so. You can find an in-progress KTX2 loader at https://github.com/mrdoob/three.js/pull/18490.

JohannesDeml commented 4 years ago

Got it, totally understand that you don't want to move away from the official feature list. Thanks for the explanation!