Skip to content

KTX2 file without mipmaps does not load #31602

@hybridherbst

Description

@hybridherbst

Description

The attached file does not load with three.js KTX2Loader at the moment, probably because of an incorrect check in the loader.

The attached file does not have mipmaps – it was generated using:

toktx --t2 --assign_oetf srgb --automipmap --encode etc1s  testimage4k.ktx2 inputimage.jpg 

--automipmap according to the docs "causes the KTX file to be marked to request generation of a mipmap pyramid when the file is loaded", so should load the file and then request mipmaps to be generated on the GPU side automatically (without adding them in the file).

Reproduction steps

  1. Load this image with KTX2Loader: testimage4k.ktx2.zip
  2. Note file does not load with Error: THREE.KTX2Loader: Invalid texture

Screenshots

Seems the check here is wrong, it should probably check levelCount for undefined or null or "not a number" and not !levelCount?
Image

Version

r177

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions