question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Any interest in shared KTX 2.0 parser?

See original GitHub issue

Discussed this briefly with @bghgary recently, but I think the current state of (non-WASM) KTX 2.0 parsers for web is:

  • three.js has a custom plain JS parser, THREE.KTX2Loader. Parses KTX2 wrapper and decodes using MSC Transcoder.
  • babylon.js has a TypeScript port KTX2 Decoder. Parses KTX2 wrapper using combination of MSC Transcoder and lightweight AssemblyScript transcoders.
  • (new) I’ve started a TypeScript KTX2 parser + serializer, ktx-parse. It’s a standalone repository with an npm package, so that I can use it in other projects like glTF-Transform. My intention (open to discuss) was to keep it focused on parsing the container, not transcoding, so that it could be used with any of the various Basis transcoders or other GPU texture formats.

three.js does not bring in production dependencies from NPM, so my ability to package that code for reuse is a bit limited. If you’re interested though, I’d be glad to collaborate on a repo/package for the other two, and for future users. Currently the code I’ve written in read.ts is very similar to your own ktx2FileReader.ts, and outputs a nearly-identical container interface. I’ve added support for key/value data, otherwise I think they’re functionally equivalent. I intend to include serialization as well (not functional yet), which will be tree-shakeable if you don’t need it:

import { read, write } from 'ktx-parse';

// Load.
const data = await fetch('./input.ktx2').then(r => r.arrayBuffer());

// Parse.
const container = read(new Uint8Array(data));

// Serialize.
write(container); // → Uint8Array

Open to ideas on how to structure this, or let me know if this doesn’t make sense. 😃

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
donmccurdycommented, Feb 1, 2021

Closing this, since it is more of an open-ended idea than an actual issue. The repo is currently at https://github.com/donmccurdy/KTX-Parse, if you would like to use it and are having any issues let me know!

2reactions
bghgarycommented, Dec 17, 2020

Yeah, we don’t bring in npm dependencies either. Would it be possible to create a standalone js file that we distribute? For example, Draco has the js file directly commited in their repo and we just copy it. Another example is glTF-Validator where we use browersify to build a standalone js.

That is what we were thinking for the KTX2 Decoder. It would live in its own repo and we would bring in a pre-built js file. Open to other ideas though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

donmccurdy/KTX-Parse: KTX 2.0 (.ktx2) parser and serializer.
KTX -Parse reads/writes KTX 2.0 containers, and provides access to the compressed texture data within the container. To decompress that texture data, ...
Read more >
KTX example files issues - Khronos Forums
I'm trying to integrate KTX support into my application, but I'm encountering some issues trying to make sure my KTX serializer and parser...
Read more >
Overview of the Google Play Core libraries - Android Developers
Google and its licensors own all right, title and interest, including any and all intellectual property and other proprietary rights, in and to...
Read more >
ktx-parse - npm
KTX 2.0 (.ktx2) parser and serializer.. Latest version: 0.4.5, ... Start using ktx-parse in your project by running `npm i ktx-parse`.
Read more >
KTX - Your Tickets | PDF | Government | Business - Scribd
Any duplicated tickets will be automatically detected on entry and could prevent the ticket holder from gaining entry to the event.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found