uploadCubeTexture fails with mipmaps undefined

i am using compressed textures (ktx) to create a CubeTexture, using the example of this thread: https://discourse.threejs.org/t/three-cubetexture-using-three-compressedtexture/7868/12.

The textures load fine and the .mipmap property exists when i log the whole texture.image[i] object to console. However the internal “uploadCubeTexture” function of threejs (r123) fails with “Uncaught TypeError: mipmaps is undefined” when accessing mipmaps.length in uploadCubeTexture.
When i add code inside threejs to the uploadCubeTexture function loop that fails:

if ( isCompressed ) {
for ( let i = 0; i < 6; i ++ ) {
				mipmaps = cubeImage[ i ].mipmaps;
				for ( let j = 0; j < mipmaps.length; j ++ ) {

it shows that mipmaps is undefined, but the full cubeImage[i] object has the mipmap property with an array of size 1 that is filled with the actual image data. This somehow looks like a GPU to CPU memory problem to me, but how should uploadCubeTexture access the mipmap array otherwise then?
Thanks in advance for any help!

Can you please share a complete live example that demonstrates the runtime error?

yes i will try to get a minimum example working and post it here!

Hi, while creating the minimum example i found the problem. The loading for the 6 textures seems to have not been done at the moment the scene was rendered the first time. When i blocking load the 6 textures it works without the mipmap problem. Its only strange that the console.log() was able to print out the full object inside uploadCubeTexture, but maybe that call is deferred a bit?
Still, thanks for the quick answer and offer to help!
Best, m.b.

1 Like