kopaka1822 / ImageViewer

HDR, PFM, DDS, KTX, EXR, PNG, JPG, BMP image viewer and manipulator
MIT License
323 stars 37 forks source link

Crashes on loading sample KTX file #31

Closed mcclure closed 1 year ago

mcclure commented 1 year ago

3D rendering library "LOVR" includes a file ibl.ktx in its samples.

https://github.com/bjornbytes/lovr-docs/tree/v0.16.0/examples/Lighting/PBR_Materials

This was created from filament's "cmgen" app.

When ibl.ktx is opened in ImageViewer using FIle->Open, ImageViewer crashes (suddenly closes). There are no error messages.

Expected behavior

The file is probably legitimate. But if it is not valid ImageViewer should at least display an error message rather than crashing..

Desktop (please complete the following information):

mcclure commented 1 year ago

Tried it on another viewer and it failed due to an unusual color format (GL_R11F_G11F_B10F). Could have been the same problem here.

kopaka1822 commented 1 year ago

Hello, thank you for reporting the issue. I can confirm that the format is the problem. My current library does not have this format and crashed for this reason. I will try to take the official ktx loader to fix this (I already implemented this for the ktx2 format).

Honya2000 commented 1 year ago

Unfortunately the viewer still crashes on those .ktx files.

Honya2000 commented 1 year ago

Tried another format for .ktx file: RGBA16F. Still crashes. So i guess the problem not in format but in cube-map. It cannot open cube-maps.

kopaka1822 commented 1 year ago

Hi, so I tried updating the ktx loader on a different branch and there are still a few formats that do not work correctly. However, the ibl.ktx with the GL_R11F_G11F_B10F format works at least. @Honya2000 Can you send me a link to those ktx files so that I can test them? Once I get them working as well I would like to make a new release with the updated ktx loader

Honya2000 commented 1 year ago

For example this one: https://github.com/google/filament/blob/main/docs/webgl/default_env/default_env_skybox.ktx

kopaka1822 commented 1 year ago

Thanks for the additional files. They also seem to work now. I have added a new Release (3.7) which should include the fixes. If you encounter any other issues with the ktx files feel free to open the issue and send me a link to the files that do not work