Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Add support for generating mipmaps #2

Closed
suikki opened this issue Sep 18, 2016 · 16 comments
Closed

Add support for generating mipmaps #2

suikki opened this issue Sep 18, 2016 · 16 comments

Comments

@suikki
Copy link

suikki commented Sep 18, 2016

No description provided.

@Denzilb55
Copy link

Is this on the roadmap? We are interested in using etc2comp and it's essential for us that we can write out mipmaps. If this isn't planned we'll probably go ahead and do it ourselves.

@bog-dan-ro
Copy link

Are you planning to add this feature in the near future?

@Denzilb55
Copy link

@bog-dan-ro This work is not quite complete, but I forked the repo and adding mip level support to the libs, which was good enough for our use case. Perhaps it can help you. Here it is: https://github.com/Denzilb55/etc2comp

You'll probably need to do some hackery to get it working for you too though.

@bog-dan-ro
Copy link

@Denzilb55 thats, I'll give it a try

@mainroach
Copy link
Contributor

One thing that's unclear for this request is 'how are the mip-maps generated'?
In one scenario, the user will need to generate each smaller level, and pass it into the encoder.
In the other scenario, the tool will take ownership of the resizing process to generate the images itself (and in this case, we need to figure out what types of resampling/rescaling filters to use).

Is there preference / guidance / input on these topics?

@Maksims
Copy link

Maksims commented Nov 30, 2016

PlayCanvas experience on that might be one of the case study:
We had to support multiple compression formats, and in fact most developers will have to provide multiple formats for different platforms. What is important in such case is that textures shall look same, of course except compression artefacts of different formats.
So from all tools we've used to generate: DXT, PVR, ETC1, we've noticed that either some of tools didn't provide mips generation, or the resizing sampling filter were used did not satisfy our needs. So we decided to not use any of auto mips generation of those tools, and do rescale source textures using ImageMagick with desired filter, and provide it to all those tools, then they produce each file as mip, and we even do our own packing into container and header.

Containers (KTX, PVR, DDS) - some of tools provided DDS container, some KTX, and some even none. So not to implement all different headers in engine, we've only implemented DDS headers parsing, and simply put all textures of different formats in DDS containers, of course providing correct header information so when parsing it can be easily identified what compression textures are inside the container.

In advanced cases, where people use those tools in their tool-chain, they want to control and be able simply get the raw texture data, no header, no mips.
Some users who are experimenting with tools, do want to get ready-to-consume files out of the tool, and that does include header and mips.

Based on that, there should flexible settings to provide users a control, as well as default behaviour that applies to majority and starters of the tool: read-to-consume files.

@romainguy
Copy link

etc2comp was designed to be usable as a library with the hope that use cases like this would be covered when integrating the compressor into other tools. But given how useful it would be to generate mipmaps from the command line we should support this feature.

@Denzilb55
Copy link

For our use case we generated the mipmaps ourselves.

That said, it would be useful if it could generate them as well, like Mali does.

@mainroach
Copy link
Contributor

@Denzilb55 What resampler / resizer are you using?

@Denzilb55
Copy link

@mainroach For generating the mip levels? We just generate them with OpenGL. We have an OpenGL app, so we already have gl-textures available with generated mip-maps.

@Maksims
Copy link

Maksims commented Dec 1, 2016

@Denzilb55 in WebGL generateMipmap does not work on compressed textures. I assumed that is the same case with native gl platforms. So mipmaps for compressed textures have to be statically provided as a pre-generated files. Unless decoding > resize > encoding is done in runtime, which IMHO is very inefficient, and would suffer dramatically from quality reductions.

@mainroach from many tests, we found that Kaiser filter produces one of visually best results on generic variety of textures, and preserves sharpness really well comparing to many other filters we've tried. IM provides tons options.
And looking at Unity, it uses Kaiser for rescaling as well.
I've read somewhere that in Source Engine, it was used with mix of some other techniques, but couldn't find references to it.

@Denzilb55
Copy link

@Maksims yeah, that's not what I meant. Our app provides the texture with all miplevels (generated with OpenGL), and then then we modified the KTX-writer module to accept mip levels. So for us, the responsibility is still on us to provide the mip levels, it would just be nice if the KTX-writer in Tools could write multiple levels. (If it wasn't clear, we're not using the provided Etc2Comp app, we've integrated the libs into our app and make function calls into it).

@bog-dan-ro
Copy link

I think you can inspire from existing tools (e.g. PVRTexToolCLI generates quite acceptable mipmaps).

@mainroach
Copy link
Contributor

Addressed in bf22b48

@bog-dan-ro
Copy link

Yupee !!!

@bog-dan-ro
Copy link

bog-dan-ro commented Feb 28, 2017

@mainroach shall I dare to ask for texture lists too ? :D
I already did it in #9

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants