---
name: hdri-lighting
description: "Use high-dynamic-range environments to control reflections and illumination consistently. Use for HDRI, RGBELoader, PMREM, свет."
---

# Свет и отражения HDRI

Use high-dynamic-range environments to control reflections and illumination consistently.

## Implementation decisions

1. Load a 1K HDR for the interactive preview. Increase resolution only if the final shot needs it and the device budget allows.
2. Generate a PMREM environment for physical materials. Keep the original equirectangular texture only when it is also the visible background.
3. Compare materials under the same environment and exposure. Avoid compensating for incorrect color space with arbitrary lighting.
4. Dispose old PMREM targets when changing the environment and stop loading work when the scene unmounts.

## Working source

Read [components/asset-viewer.tsx](../webcraft-shared/source/components/asset-viewer.tsx) when implementing this capability. The example belongs to the WEBCRAFT React/Three.js playground except the Python commerce starter, which runs without third-party dependencies. Use [shared catalog](../webcraft-shared/source/lib/catalog.ts) only to resolve related examples. Adapt the source to the target framework and preserve existing project conventions.

The original workshop uses Three.js 0.180 and procedural builders. The external asset viewer separately loads licensed glTF, scanned PBR maps and HDRIs. Preserve the provenance of each corpus. See [objects.ts](../webcraft-shared/source/lib/objects.ts) for material and geometry ownership and [scene.tsx](../webcraft-shared/source/components/scene.tsx) for renderer lifecycle.

## Verify observable behavior

- Metal reflects the selected environment.
- Exposure updates without a geometry reload.
- Selecting a second environment does not retain the old GPU textures.

## Scope

Use only the parts relevant to the requested task. This skill does not grant permission to publish, spend money, change account access or expose secrets. The original brief and environment rules remain authoritative.

Version 2.0.0 · Original WEBCRAFT content · MIT
