Generating Skybox KTX files #6736
omri-polycam
started this conversation in
General
Replies: 1 comment 1 reply
-
cmgen can extract only a skybox file without doing all the integration for lighting/ibl. I don't remember the flags off the top of my head but it's possible (I often use this to generate higher resolution skyboxes for my own tests). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I'm Omri, I'm the main rendering engineering working with Chris at Polycam.
I am currently trying to integrate compressed textures for use with skyboxes to allow for higher resolution cubemap images on texture memory limited mobile devices. We also plan to use this format to take advantage of preprocessed mipmaps.
I'm currently a bit stuck trying to find the best way to generate the .ktx files to load into
ktxreader::Ktx1Reader
to feed intofilament::Skybox::Builder::environment()
. I'd appreciate any advice on what's the best way to generate a filament compatible .ktx file from either a single panorama png/jpg or 6 cube map side png/jpg images. Below are some of the approaches I've tried:ktreader::Ktx2Reader
with .ktx2 files generated from basisu. The problem is that these don't work because I hit an error inktreader::Ktx2Reader
saying that cubemaps are not yet supported for .ktx2 files.cmgen
tool built into filament. This worked, but these take an extraordinarily long time to process, presumably generating the spherical harmonics and other lighting information that I don't even need. Our app is unfortunately not a typical filament user like building a game or such where all the assets are preprocessed into the executable. We will be generating new .ktx files from our user's scans on a regular basis, so acceptable compression performance is a requirement. Is there a way to use this tool to just generate the compressed cubemap .ktx texture and that's it?basisu
to no effect. I've also experimented with the finalsrgb
boolean argument intoktxreader::Ktx1Reader::createTexture()
and that has not fixed the problem either. Setting this argument to true still succeeds but warns that the image is linear and not sRGB. As best as I can tellbasisu
is messing up the colors in the final .basis to .ktx transcoding step. If anybody at filament has any experience with thisbasisu
command line tool, do you know what options to pass to maintain color fidelity? Below are the pertinent lines in the script:utils::PreconditionPanic reason: KTX has unexpected identifier
whenever I use the--encode
option intotoktx
when callingktxreader::Ktx1Reader::createTexture()
. Without the--encode
option, it does load fine but then the .ktx file contains no compression so this defeats the point.If anybody knows of a different approach or has any advice on tweaking any of the approaches I've already tried to work correctly, I'd greatly appreciate it.
Thanks,
Omri
Beta Was this translation helpful? Give feedback.
All reactions