Skip to content

Environment maps: Add cubemap support alongside equirectangular images #143

Open

Description

@mwyrzykowski

In the explainer, it indicates the environment map is specified as an equirectangular image.

However GPUs are better suited at processing cube maps. They exhibit less artifacts around the poles and a UA may prefer or automatically convert an equirectangular image to a cubemap.

There are a few ways we could add cubemap support.

One is automatically, if the image is a file which supports layers and contains 6 layers, the image is automatically imported as a cubemap. Popular cubemap formats include ktx, exr, and dds amongst others.

Another option is specifying the cube faces directly as 6 different files. I.e., instead of:

environmentmap="envmap.hdr"

one could provide the maps for the 6 faces:

environmentmap-plus-x="envmap-x1.hdr"
environmentmap-minus-x="envmap-x2.hdr"
environmentmap-plus-y="envmap-y1.hdr"
environmentmap-minus-y="envmap-y2.hdr"
environmentmap-plus-z="envmap-z1.hdr"
environmentmap-minus-z="envmap-z2.hdr"

or alternatively we could support a comma separated list instead:

environmentmap="envmap-x1.hdr, envmap-x2.hdr, envmap-y1.hdr, envmap-y2.hdr, envmap-z1.hdr, envmap-z2.hdr"

These are just a few ideas, perhaps there are other better ones as well.

Activity

  1. added
    agenda
    on Jan 8, 2026
  2. removed
    agenda
    on Jan 13, 2026
  3. cabanier commented on Oct 14, 2026

    @cabanier
    Member

    Was this ever resolved?

  4. cabanier commented on Oct 14, 2026

    @cabanier
    Member

    /agenda

  5. added
    agenda
    on Oct 14, 2026
  6. mwyrzykowski commented on Oct 14, 2026

    @mwyrzykowski
    Author
  7. cabanier commented on Oct 14, 2026

    @cabanier
    Member

    @mwyrzykowski Thanks for finding the minutes!
    We can take this up again.

  8. AdaRoseCannon commented on Oct 14, 2026

    @AdaRoseCannon
    Member

    I drafted a more descriptive proposal in CSS for this. But I got push back because model would be the only element that used it.

    I ended up folding that work into the Spatial CSS spec since it would have wider application there and could then be applied to the model element also:

    I hope something like this is what you had in mind:

    https://webkit.github.io/explainers/css-spatial/Overview.html#environment-maps

  9. cabanier commented on Oct 29, 2026

    @cabanier
    Member

    At TPAC, we decided on the following:
    "if the image that is loaded has 6 faces, treat it as a cubemap. Otherwise, treat as equirect."

  10. removed
    agenda
    on Oct 29, 2026
  11. Yonet commented on Oct 29, 2026

    @Yonet
    Member
  12. DRx3D commented on Oct 29, 2026

    @DRx3D
    Contributor

    It is not clear to me as to how you would differentiate between a cube map and an equirect. Do you mean to use the aspect ration (4:3 for cube, 2:1 for equirect). Is there a canonical cube map format? I read in the discussion that there is use/need for KTX or other formats. Do those formats carry metadata that would indicate the use?

    If the comment above is to express intent, than I am fine with that. If it is the final word, there is a lot more that needs to be said.

  13. cabanier commented on Oct 29, 2026

    @cabanier
    Member

    12. It is not clear to me as to how you would differentiate between a cube map and an equirect. Do you mean to use the aspect ration (4:3 for cube, 2:1 for equirect). Is there a canonical cube map format? I read in the discussion that there is use/need for KTX or other formats. Do those formats carry metadata that would indicate the use?

    It would be up to the user agent to make that determination.
    Maybe the spec should be more like:
    "if the loaded file has 6 faces, treat it as a cubemap. Otherwise, treat as equirect."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions