Skip to main content

Interface: ThreeEnvironmentPortOptions

Defined in: threejs-environment/src/environment-port.ts:53

Properties

PropertyModifierTypeDescriptionDefined in
keyLightDistance?readonlynumberHow far from the origin the key light sits. Default 50 m.threejs-environment/src/environment-port.ts:59
parent?readonlyObject3D<Object3DEventMap>Where the lights are parented. Default: the scene.threejs-environment/src/environment-port.ts:55
prefilter?readonly(scene: Scene) => TextureTurns a scene into a prefiltered environment map, for ibl: { kind: "room" }. Prefiltering is PMREMGenerator.fromScene, which needs a live renderer and a GL context, so it cannot happen inside a port that is unit tested with neither. Pass (scene) => pmrem.fromScene(scene, 0.04).texture to get three.js's real room probe; leave it out and room falls back to a neutral grey gradient, which is honest and costs nothing.threejs-environment/src/environment-port.ts:86
reflection?readonly(probe: object) => Texture<unknown, TextureEventMap> | nullTurns the session's light probe into a usable environment map. WebXR hands back a reflection cube map through new XRWebGLBinding(session, gl).getReflectionCubeMap(probe), which needs the GL context this port does not hold - so the app supplies the two lines that do it, and gets ibl: { kind: "estimated" } in return. Without it, light estimation still delivers ambient and key, and says plainly that the reflections were not measured.threejs-environment/src/environment-port.ts:97
renderer?readonlyXrRendererLikeThe renderer, for the two sensor-backed features. Without it sky, fog, lighting and image-based lighting all work exactly as before, and occlusion and light estimation report unsupported rather than failing quietly. Only renderer.xr is ever touched.threejs-environment/src/environment-port.ts:67
skyResolution?readonlynumberRows in the generated sky texture. Default 64.threejs-environment/src/environment-port.ts:57
textureLoader?readonlyEquirectLoaderResolves a texture src. Injected for tests; defaults to a TextureLoader. Typed as the one method rather than as Pick<TextureLoader, "loadAsync">, because that spelling drags in three's Texture<HTMLImageElement> generic and then nothing but a real TextureLoader fits - including an app's own RGBELoader, which is the loader an HDR environment map actually needs.threejs-environment/src/environment-port.ts:76