mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.33k stars 35.2k forks source link

Feature: HDR cubemap from a single file #9688

Open leewz opened 7 years ago

leewz commented 7 years ago

In the example materials / envmaps / hdr, a cubemap is textured using six .hdr files, using HDRCubeTextureLoader. How about texturing a cubemap from a single .hdr file?

mrdoob commented 7 years ago

/ping @bhouston

pailhead commented 7 years ago

there used to be a dds loader in the past, but it might not work with the custom mapping that clara people integrated

bhouston commented 7 years ago

I under the gun on a few projects right now. We have some code for a single image cubemap that we would like to contribute back once I or someone else on the team get some time. Sorry for the delay.

trianglestrip commented 7 years ago

hope that to be finished...like sketchfab's background hdr envmap.

Mugen87 commented 3 years ago

Since three.js properly supports equirectangular textures now (meaning by auto-converting them to the cube map format and directly by PMREMGenerator), is this issue still relevant?

Yes, cube maps can be organized in a single file but I've seen different layouts in the past e.g. vertical and horizontal cross, column and row layouts. Is it desirable to support those? I'm afraid I'm not sure how common they are...

If these layouts are not that relevant it feels more appropriate to guide users towards the equirectangular format.

donmccurdy commented 3 years ago

It seems like there are two parts to this:

  1. what file formats exist for a single-file cubemap, and do we want loaders in examples/jsm for them
  2. what layouts would we need to support in three.js core to do that

The KTX 2 format (used in glTF for Basis compressed textures) also supports cubemaps, but I haven't implemented that in THREE.KTX2Loader because glTF doesn't need them. That would be an option for (1), although i'm not sure about the best internal data format for HDR data in KTX, or the layout.

WestLangley commented 3 years ago

I've seen different layouts in the past e.g. vertical and horizontal cross, column and row layouts. Is it desirable to support those?

There has been no demand for those, as far as I am aware.

Consequently, I'd suggest removing webgl_panorama_cube.html, or modifying it, as it uses row layout.

Mugen87 commented 3 years ago

Consequently, I'd suggest removing webgl_panorama_cube.html, or modifying it, as it uses row layout.

Sidenote: This is true for webxr_vr_panorama, too.

donmccurdy commented 2 years ago

I believe these three HDR formats available in KTX2 would be candidates:

Are there any we'd prefer, or prefer to avoid? This would be loading a cubemap, i.e. six images in a single KTX2 file, not a larger image with a particular layout.

Mugen87 commented 2 months ago

VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 (gl.RGB9_E5)

Because of the findings in #27971, RGB9_E5 isn't appropriate. At least at the moment.