-
Notifications
You must be signed in to change notification settings - Fork 235
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
Feature request: Tool to create combined image by gathering channels from input images #839
Comments
@tksuoran are you the same person I worked with in the OpenGL ES (and M3G?) working groups a lifetime ago? The use cases say what you want to do but not why. I'm curious why you would want to, e.g, put two normal maps in a single texture object. Please provide further explanation. |
@MarkCallow I've had a few people request this feature from glTF Transform, and can share the use cases behind that. The glTF format and its material-related extensions define a significant number of texture inputs to the PBR shading model. Many of these require ≤3 channels, and so can be combined. The most common example would be occlusion/roughness/metalness, in red/green/blue channels. Current texture inputs, and their assigned channels in glTF: Screenshot regex'd from glTF Transform codebase. I realize that combining uncorrelated data channels into a single texture with Basis Universal compression would require some care, so I'm unsure how practical this is, or how great the memory savings would be when all is said and done. Nevertheless it is a fairly popular request. I may eventually implement it with a pre-process merging the textures to PNGs before processing them with KTX2, but direct APIs to do this in KTX Software would be very welcome! |
Hi Mark, yes I am, indeed it has been a while.
My initial thinking was that I would like to avoid artificial limitations, and promote generic interface, where use would have the freedom to choose inputs and outputs as they wish. One remotely plausible use case would be material/shader which uses both normal map (encoded in RG) and tangent texture (encoded in BA), while using same encoding for tangent texture and normal map.. However, I am not sure if using the normal map encoding scheme for tangent textures is the good idea or not. |
The libktx API gives access to the memory where the images are stored in the |
@donmccurdy does glTF require these be combined or is it optional? |
Optional, there is no requirement that textures be packed. |
To me, this sounds like some sort of "image creation/preprocessing" that, at its core, is fairly independent of KTX-Software itself. (When PBR was introduced in glTF ~8 years ago, I hacked together https://javagl.github.io/MetallicRoughnessCreator/MetallicRoughnessCreator.html , because I thought that something like this might be useful - but I haven't used it ever since...). But of course, it might very well a a use case that is so common (and so badly supported by other tools) that it might fit into KTX-Software. |
For the general usecase I do this packing when I load these textures into the engine. It will be nice that I don't have to do that and its done offline via KTX-Software but I find this very hard in practice because there is no easy way to save this information within a texture. You do need something like glTF to provide those semantics. Or have some coding for the texture names which isn't great, which brings me to my second point. This on its own isn't very useful because you still have to go and edit your glTF document to point to the packed texture. I would argue this is better done in the glTF exporter or some other glTF specific post processing tool. It makes perfect sense in glTF Transform. |
Use cases:
In theory also these could be possible:
The text was updated successfully, but these errors were encountered: