# pbr-environment-lighting

Light PBR materials with an image-based environment (generated RoomEnvironment or an .hdr), ACES tone mapping, sRGB output and soft shadows

- **Space:** threejs-public (https://github.com/Tech-Realm/space-threejs-public/tree/main/pbr-environment-lighting)
- **Level:** L1 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3, playwright-python, chromium
- **Routes:** static-local; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use threejs-public/pbr-environment-lighting` or MCP `get_pack threejs-public/pbr-environment-lighting`
- **Files:** CHANGELOG.md, code/boot.js, code/index.html, code/main.js, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal
Physically based materials that look right without hand-tuned lights: PMREM environment map, tone mapping, correct colour space, one shadow-casting key light.

## Steps
1. Copy `code/`. By default the environment is `RoomEnvironment` (no download).
2. To use an HDRI, pass `?hdr=file.hdr` (RGBELoader); CC0 HDRIs: polyhaven.com.
3. Tune `renderer.toneMappingExposure` (UI slider in the template).
4. Check: `python3 ../tools/webgl_check.py code --js "window.__env === true"`.

## Edge cases
- HDR files are large (2K ~ 6 MB); use 1K for the web.
- Shadow acne: raise `shadow.bias` slightly; keep the shadow camera tight.

## Don'ts
- Don't add many real-time lights to fake GI; use the environment.
- Don't forget `outputColorSpace = SRGBColorSpace` (r152+ default) when porting old code.



---

Canonical URL: https://logicpacks.io/packs/threejs-public/pbr-environment-lighting

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
