Loading a CubeTexture with cubemaps produces black skybox/specular

I spent half a day on this problem and I must confess I’m out of idea right now. Hopefully, you can help me now.

I’m using cmgen/Filament to bake HDR environments, resulting in several files:

  • a cubemap (DDS file) without mipmap in full resolution, used to draw the skybox
  • a cubemap (DDS file) with 5 levels of mipmaps, smaller resolution (256x256 for level 0), containing the prefiltered specular contribution
  • a text file with spherical harmonics for the diffuse contribution

Loading the full resolution without mipmap seems to work fine, with the fix I have submitted yesterday.
However, with my prefiltered specular cubemap, it results in a black screen even if the cubemap appears correctly in Spector.js:

The PG can be found here: https://www.babylonjs-playground.com/#LVAB4K#3

The dds looks broken and actually you can see the result in firefox

By Broken I mean it might be a texture format not supported by babylon

Thanks, the message wasn’t displayed on Chrome, and actually, it’s quite helpful.
The problem is my DDS file contains 5 levels of mipmaps, but it’s 256x256, so incomplete because the 5th mipmap level is 8x8 (4x4, 2x2 and 1x1 aren’t uploaded).
The problem is TEXTURE_MAX_LEVEL is never set in Babylon (the default value 1000 is used)…
If I call gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAX_LEVEL, 4); in _setCubeMapTextureParams, it works just fine!
I’ll try to submit a PR.

2 Likes