Code Monkey home page Code Monkey logo

Comments (4)

alecazam avatar alecazam commented on May 24, 2024

No, it's not currently supported. The code is setup to build 1d array, 2darray, 3d, and cube, and cube array off strips. So the mip system is all built off being able to pull from that. Ideally these should be vertical strips since that's how KTX/KTX2 store chunks and the rowBytes are simple then. But it can also copy out rows of a horizontal strip or grid. There are some samples of that in the example test files. There is a command to define the layout of images if using a grid, and kram can determine the other dimension of simple vertical or horizontal strips.

It gets more complex when editing these kinds of files, since Photoshop and other tools really don't understand GPU textures. There a strip can be easier to view/edit. It wouldn't be hard to concatenate these into a strip in the command processor, and then the rest of the code is blissfully unaware. The "Show All" feature is also handy once you have a 2d array, since artists want to see all the icons/images in one view instead of flipping through 1 image at a time.

cuttlefish is a another good tool, and here's how it handles that on its command line. Usually these are specified in a given order for cube maps and arrays, etc. The command line can get long and hard to read in these cases. Also Apple has a texture_converter tool for mac/win, but I think it also is 1:1 on input/output. And you don't source code to that.

Input files: at least one required, cannot mix different types
-i, --input file the input image for a standard texture
-a, --array [n] file the input image for an array or 3D texture:
n: the index of the image
file: the path to the image
-c, --cube face file the input image for a cube map:
face: the face, which is one of:
+x, -x, +y, -y, +z, -z
file: the path to the image
-C, --cube-array n face file the input image for a cube map:
n: the index of the image
face: the face, which is one of:
+x, -x, +y, -y, +z, -z
file: the path to the image
-I, --input-list type file specify a file with a list of image paths:
type: type of texture, which is one of the
following: image, array, cube, cube-array;
cube faces are in the order:
+x, -x, +y, -y, +z, -z
file: path to a file containing a list of
image paths, one per line

from kram.

perludum avatar perludum commented on May 24, 2024

Thanks a lot for your detailed and helpful answer.
With your hints I figured it out how to create arrays based on strips.

This is a great tool, thank you for creating it!

from kram.

alecazam avatar alecazam commented on May 24, 2024

I'm glad you are enjoying it. It doesn't have many stars, and for some reason, the comments don't show up in my email feed, so I sometimes am late to answer. I also have only ported libkram and kram to Windows, but the viewer, thumbnailer, and PS plugin would be nice there too

Nice thing about KTX and KTX2 files is that they can be concatenated pretty easily. The mips all live in one set of chunks. KTX2 is even better since the mips are compressed. See the sample scripts, but they do an uncompressed zip archive of the KTX2 files. Then can pull those and use them directly from the data, decompress from staging, and then twiddle that to the GPU textures.

Also note there's a KTX/KTX2 loader in ObjC in kramv. That pulls the texture directly from the zip archive. That zip archive can be wrapped in an Asset Catalog or whatever AAP Android used. Then can keep the backing store for textures in read-only mmap pages. These don't count towards jetsam. Tying this to sparse texturing is still an exercise for the reader.

I'm not a big fan of Apple Preview or the MTLTextureLoader. These are very limited tools when working with KTX and KTX2 files. So kramv fills that gap. Also Apple's thumbnails don't support ETC2 or many of the explict and non-2D KTX types. So kram's thumbnailer will handle all that. I'll be checking that support in soon.

from kram.

perludum avatar perludum commented on May 24, 2024

Just installed the kram viewer on macOS and this is another really useful app to work with ktx files.
I think this repo will get more users and stars when ktx2 becomes more known and popular.

We chose KTX2 as texture format for our custom game engine and tried various ktx conversion tools ... kram seems to be the only tool that handles everything we want.

Btw if you'd like to receive messages about issues etc, you'd probably need to "watch" your own repo with custom notification settings (issues on).

from kram.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.