-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
KHR_texture_basisu samples #1750
Comments
Can you expand on what you mean by "manually"? I can generate samples with gltfpack because it knows how to do this, although it's not able to generate the extra JSON metadata. |
My understanding is that the ktx2 branch of KTX-Software doesn't yet generate mipmaps, you'd need to create them in advance with imagemagick or similar. There is also some final work to be done on the mip padding section of the KTX2 spec... I'm working on support for ktx2 in three.js now. If you're able to generate samples with |
Ah - I see. gltfpack doesn't use toktx/libktx because honestly these tools didn't seem ready. It can generate files with full mip chain using basisu and re-encode them using a ktx2 container. Thanks for the heads up, I'm going to update my code to not use KHR_image_ktx2. |
Here's an example model, converted using |
It is toktx that does not generate mipmaps yet. libktx is fully capable of handling files containing mipmap pyramids.
@zeus, in what way did they not seem ready? |
@MarkCallow Two biggest issues were no mip-map generation support and no JPEG conversion support. |
mipmap generation is next on my list. I'm not planning to add jpeg support as you will be starting with an already compressed image. But perhaps in view of all the jpeg images produced by digital cameras I should revisit that. |
@zeux thanks! I now have mips loading in threejs using the base color |
Since glTF supports PNG and JPEG, I would expect any tool that transcodes images in glTF context to support both. To be fair, basisu doesn’t support it either but there’s an open PR for that. |
Thanks @zeux for the Avocado model! Can we discuss the file extension for KTX2? I have been using |
Ahh, thanks. |
Here's an Avocado model built with new padding rules as per KhronosGroup/KTX-Specification#117 |
@zeux you'll be glad to hear that the files in Avocado-newpadding all pass the updated validator. KhronosGroup/KTX-Specification#117 and the matching KhronosGroup/KTX-Software#170 will be merged soon. |
@MarkCallow @zeux I'm getting two odd results with the Avocado base color
The first issue seems like a transcoder bug, unless there's some technical reason overwriting the old response array is necessary? The second, I'm not sure... has anyone else got this sample rendering correctly? |
I am transcoding a file with 12 levels in my libktx.js test and a 12-level cubemap (hence 72 images) in my native tests. Both work fine so I don't think there is any bug in the underlying native transcoder, which is used by both libktx.js and msc_basis_transcoder.js. msc_basis_transcoder.js has the following:
Since |
Probably msc_basis_transcoder should do |
Yeah this looks like a bug in transcoder. The Basis transcoder has the same code as Mark quoted:
Repeat calls would definitely reuse the allocated memory causing the old mip content to change, but even within a singe call there are no guarantees and it's possible that heap data gets corrupted in the first pixel, causing the issue #2 as well. (it's also possible that my encoded data somehow "poisons" the first mip, I'll double check the code I was using to produce this image) Something like this is probably the correct solution:
|
Yeah - both issues are one and the same. I've fixed both in this branch by fixing the transcoder: You can grab the .js/.wasm from this branch, and I'll open a PR to KTX-Software shortly. |
The Avocado-newpadding now works with libktx.js/wasm in the Babylon sandbox. I believe @zeux's fix has no effect on the libktx version. |
Correct. |
Thanks for tracking this down so quickly! :) |
Hello, I'm trying to parse avocado_normal.ktx2 texture file by myself and parsing seems to be OK till sgd block, but with sgd looks something wrong. Could you guide me how to find the problem. globalFlags = 1 For this variables I read 28 bytes from sgd block
Similar situation is for Avocado_baseColor.ktx2 |
@donmccurdy , thank you It looks very similar to my code except
because here for avocado we have imageCount = 12 * 1 * 1 * 12 = 144 instead of just 12. But anyway sgd total size does not match with sum of sizes of its components. |
Here are the values I am seeing, with
There was an error in the imageCount calculation, fixed in draft19 published on 2020-03-04. Sorry about that. |
@MarkCallow Thank you, this data will be helpful. I'll doblecheck and compare |
Two large samples: |
This ticket is over two years old and StainedGlassLamp is still the only BasisU example in |
I agree that there should be a targeted sample that uses no other extension besides BasisU. With the tools to create them freely available anyone can add them via PR. Imho adding a BasisU version for all (or some more) assets is not a good idea though. Same could be requested for Draco or glTF-embed variants. It just adds a lot of redundancy (wrt functionality). Unfortunately there's already an ambivalence in glTF-Sample-Models between models for functional feature tests and visually appealing demonstration objects. |
I download this Sponza file, and it's running 60fps on my old iPhone SE (1st generation) with Threejs. Can I ask for the compression settings of this files, gltf-transform uastc? |
@hecodeit I don't seem to have the full, original encoder settings used for these textures, sorry. They were all encoded with glTF-Transform, using the UASTC mode of |
They must have been created a long time ago because the early beta version of |
Right, it was an older version of |
Provide samples with Basis/KTX2 for color textures. Note mipmaps will have to be done manually for now.
The text was updated successfully, but these errors were encountered: