This skill helps a coding agent make three.js surfaces read correctly. It picks a material (MeshStandardMaterial by default), builds a light rig of an environment or hemisphere fill plus one directional key, turns shadows on in the renderer, the light and the meshes, and sets colour spaces and tone mapping once.
It targets three.js r187, where lighting has been physically based since r155, so intensities copied from older tutorials come out too dark. It starts every debugging session by swapping in MeshNormalMaterial to tell a geometry problem from a lighting problem.
What You Get
- Five code patterns: a PBR material under key and fill, an unlit textured material, shadows with a fitted shadow camera, a PBR texture set, and image-based lighting from an HDR file
- A probe expression that lists lights, shadow casters, the environment, the tone mapping value and any colour maps missing sRGB
- A gotcha list for black meshes, missing or blocky shadows, shadow acne, washed-out colour and a dark image after post-processing
- A reference table of materials and lights with starting intensities, transparency sorting and RoomEnvironment lighting without an HDR file
Common Use Cases
- Fixing a mesh that renders pure black
- Adding a sun with shadows that cover the play area without blocky edges
- Setting up HDR reflections so imported glTF models look right
- Restoring brightness after adding EffectComposer post-processing
What Makes It Unique
The skill orders three.js debugging so that each step rules something out, starting with a normal material that proves the geometry is visible. It names the three switches shadows need, gives a starting key intensity for the post-r155 lighting model, and moves the light and its target with the player for large levels, because a bigger shadow frustum spreads the same shadow map over more ground.
Under The Hood
The agent loads the SKILL.md and reads the materials and lights reference only when it needs a lookup table. It edits your game source and runs the project build or type check. For the runtime check it exposes the renderer and scene on window and evaluates a probe expression in your local page, using Playwright if present or asking you to paste it into the browser console. It does not fetch web pages or call outside services.