rememberHDREnvironment
Builds an Environment from an equirectangular HDR image instead of pre-baked KTX — no cmgen step, just ship the .hdr. The reflection cubemap and skybox are prefiltered on the GPU at load via IBLPrefilterContext/EquirectangularToCubemap/SpecularFilter.
The sibling of rememberKTXEnvironment (which loads pre-baked KTX) — same returned type, same scene wiring:
val engine = rememberFilamentEngine()
val env = rememberHDREnvironment(engine) { Res.readBytes("env/lobby.hdr") }
val scene = rememberFilamentScene(
engine = engine,
skyboxState = env.skyboxState,
indirectLightState = env.indirectLightState,
) { GltfInstance(asset = duck) }Tradeoff vs. rememberKTXEnvironment: there's no baked diffuse irradiance (cmgen's spherical harmonics). Filament approximates diffuse from the reflection's lowest mip — visibly lower quality. Prefer KTX when you can bake offline; use this for raw .hdr workflows. The prefilter runs on the GPU at load, so the first frames render before it lands.
Parameters
The hoisted engine, shared with the scene that consumes the returned states.
IBL intensity scale.
Render the environment cubemap as the skybox. False = IBL only.
Internal format for the decoded HDR equirect texture.
Reloads when this changes. Defaults to Unit for static assets.
Invoked once if hdr throws or the bytes can't be decoded as HDR.
Loader for the equirectangular HDR bytes (2:1 aspect).