KhronosGroup / glTF-Sample-Environments

glTF sample environments for the glTF Sample Viewer
https://github.com/KhronosGroup/glTF-Sample-Viewer
84 stars 10 forks source link

sheen.ktx2 is not a valid ktx2 file. #6

Open MarkCallow opened 4 years ago

MarkCallow commented 4 years ago

https://github.com/KhronosGroup/glTF-Sample-Environments/blob/master/helipad/charlie/sheen.ktx2 has an invalid data format descriptor. Probably any other file written by "UX3D SlimKTX2 v1.0" is also invalid. The problems are:

  1. The DFD gives its length as 0 although the KTX2 file header gives the correct byte length.
  2. The color model is UNSPECIFIED but the KTX v2 spec requires RGBSDA.
  3. All BYTES_PLANE fields are 0
  4. The DFD has 0 samples.

The libktx reader uses the DFD in order to avoid a big switch on the VkFormat so the invalid DFD causes it to return an error when trying to load this file.. The three.js loader also uses the DFD info and I'm sure other software does too.

MarkCallow commented 4 years ago

This file has revealed a bug in ktx2check so thanks for that but I apologise that it showed this file as valid.

MarkCallow commented 4 years ago

I've fixed the problem in ktx2check. See issue https://github.com/KhronosGroup/KTX-Software/issues/309 and PR https://github.com/KhronosGroup/KTX-Software/pull/310.

UX3D-nopper commented 4 years ago

Thx a lot ... we will first fix the bug in slimktx2 here: https://github.com/ux3d/slimktx2/issues/7

ifiddynine commented 3 years ago

Noticing similar issues with the file here: https://github.com/KhronosGroup/glTF-Sample-Environments/blob/master/neutral/lambertian/diffuse.ktx2

The color model is UNSPECIFIED which fails with the latest libktx source, and if that is skipped then ktxTexture_calcImageSize ends up returning 0 due to invalid format data.

Probably worth doing a pass on regenerating the .ktx2 files with the latest standard, especially as libktx 4.0 is around the corner.

GasimGasimzada commented 3 years ago

I just tried to load this file (or any other file from master branch) and ktx2check gives the following error:

    ERROR: DFD totalSize differs from header's dfdByteLength.
    ERROR: DFD for a VK_FORMAT_R16G16B16A16_SFLOAT texture must have sample
    information.
    ERROR: DFD bytesPlane0 must be non-zero for non-supercompressed texture
    with VK_FORMAT_R16G16B16A16_SFLOAT.
    ERROR: DFD colorModel for non block-compressed textures must be RGBSDA.

ktx2check v4.0

MarkCallow commented 3 years ago

The file is invalid. @UX3D-nopper please regenerate the file(s).

GasimGasimzada commented 3 years ago

Yeah. I end up running ibl-sampler script manually on HDR files to create the necessary textures.