Skip to content

Support loading Radiance HDR panoramas as cubemaps - #25802

Open
stuartparmenter wants to merge 7 commits into
bevyengine:mainfrom
stuartparmenter:feat/equirectangular-to-cubemap
Open

stuartparmenter wants to merge 7 commits into
bevyengine:mainfrom
stuartparmenter:feat/equirectangular-to-cubemap

Conversation

@stuartparmenter

@stuartparmenter stuartparmenter commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Objective

Load lat-long panoramas from Radiance HDR (.hdr) files as cubemaps without an external conversion tool. The HDR loader currently returns a 2D image, which cannot be used directly as a skybox.

Related to #12455 and #19125. This grew out of loading the environment map for Zorah v2.

Depends on #25959.

Solution

Add Image::equirectangular_to_cubemap(face_size), built on ctt's equirectangular projection and gated behind a new equirectangular_cubemap feature. Add an optional cubemap_face_size setting on HdrTextureLoaderSettings so asset_server.load() can return the cubemap directly.

Also register the HDR loader with CompressedImageSaver, so the asset processor can convert and compress the panorama in one step.

Testing

  • Unit tests for the conversion and the HDR loader, including processing to a compressed cubemap.

This was AI w/ Fable 5.1 and Astra as part of my work to get the Zorah scene working. I needed to be able to take their hdr skybox/environment map file and load it and apply it, so had the LLM help build it, test it, then iterated on it to optimize it and add asset loading and compression support, then reviewed and cleaned it up.

@stuartparmenter
stuartparmenter force-pushed the feat/equirectangular-to-cubemap branch from 797fd86 to 096b588 Compare September 15, 2026 20:24
@stuartparmenter stuartparmenter added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 15, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Sep 15, 2026
@stuartparmenter
stuartparmenter force-pushed the feat/equirectangular-to-cubemap branch from 096b588 to 64c1d8c Compare September 15, 2026 20:29
@stuartparmenter stuartparmenter changed the title Load Radiance HDR panoramas as cubemaps Support loading Radiance HDR panoramas as cubemaps Sep 15, 2026
use wgpu_types::{Extent3d, TextureDimension, TextureFormat};

/// Loads HDR textures as Texture assets
/// Loads Radiance HDR images, optionally converting lat-long panoramas to cubemaps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels strange to bolt this onto HdrTextureLoader , rather than have a separate loader

@Zeophlite Zeophlite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR would benefit from a screenshot

@stuartparmenter

Copy link
Copy Markdown
Contributor Author

ctt 0.6.0 added support for equirectangular to cubemap, so I've rewritten this on top of #25959 so we don't need to write all of this ourself

@stuartparmenter

Copy link
Copy Markdown
Contributor Author

I think this PR would benefit from a screenshot

equirect-cubemap-pr25802

Comment thread crates/bevy_image/src/equirectangular.rs
# Conflicts:
#	crates/bevy_image/Cargo.toml
#	crates/bevy_image/src/compressed_image_saver/ctt.rs

@cwfitzgerald cwfitzgerald left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here comes the sun, do do do do

@stuartparmenter stuartparmenter added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 2, 2026

This branch has not been deployed

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

Labels

A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants