Skip to content

Packs / threejs-public

pbr-environment-lighting

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

Install

logicpacks pack use threejs-public/pbr-environment-lighting
get_pack threejs-public/pbr-environment-lighting

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: static-local
  • Checks: 1 in outcome/checks.yaml
  • Code: boot.jsindex.htmlmain.js
  • Tools: python3, playwright-python, chromium

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from 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.