Cubemap texture from single image

I am going to create cube map texture from a single image, ideally from skydom image, if not possible from an image consisting of 6 parts. Please check attached images.

The second texture is in the equirectangular format which you can use directly as an environment map in three.js. If you still need to convert it into the cube map format, use the method WebGLCubeRenderTarget.fromEquirectangularTexture().

The first texture is a bit more problematic to load since CubeTextureLoader expects six single textures representing each side of a cube. Other formats are not supported since there are many layout variations (horizontal vs. vertical cross, column vs. row all with potential different image sequences) and they are not very common. If possible, it’s best to split the texture into six ones with a tool and then use CubeTextureLoader.

If you don’t like to do this, use the approach from webgl_panorama_cube. It loads a cube map with a row layout via ImageLoader and then splits the single image into six ones via the canvas API.

Hi, @Mugen87 . Thanks for your advice.
Just fixed cube map using three.js webgl - panorama.

Thank you again.

1 Like

One more question. It is not working for hdr files. Any other solution?

There is a PR that adds HDR cube texture support for KTX2Loader:

Other related issue:

Is it possible with r147?

No, HDR cube maps from a single file are not yet supported.