File: RoomEnvironment.md | Updated: 11/15/2025
This class represents a scene with a basic room setup that can be used as input for PMREMGenerator#fromScene. The resulting PMREM represents the room's lighting and can be used for Image Based Lighting by assigning it to Scene#environment or directly as an environment map to PBR materials.
The implementation is based on the EnvironmentScene component from the model-viewer project.
const environment = new RoomEnvironment();
const pmremGenerator = new THREE.PMREMGenerator( renderer );
const envMap = pmremGenerator.fromScene( environment ).texture;
scene.environment = envMap;
RoomEnvironment is an addon, and must be imported explicitly, see Installation#Addons.
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
Frees internal resources. This method should be called when the environment is no longer required.