cloudai-x/threejs-skills/threejs-lighting
- community
Checking that the SKILL.md file is still in the repository.
Light types and physical units, shadow maps, HDR environment lighting, light probes, and lighting performance, on WebGL or with WebGPU and TSL. Use when adding or tuning lights, fixing shadow acne, setting up image-based lighting, or dimming an environment map.
Install
npx vskill@latest install cloudai-x/threejs-skills/threejs-lightingSKILL.md
Three.js Lighting
Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer.
Quick Start
Light Types and Units
| Light | Shadows | Intensity | Notes | |
|---|---|---|---|---|
| AmbientLight | no | multiplier | Flat fill from every direction | |
| HemisphereLight | no | multiplier | Sky color from above, ground color from below | |
| DirectionalLight | yes | multiplier | Parallel rays (sun); shines at its target | |
| SunLight (addon) | yes, cascaded | multiplier | Shadow frustum fitted to the view automatically | |
| PointLight | yes, six faces | candela | Inverse-square falloff (decay 2) | |
| SpotLight | yes | candela | Cone; inverse-square falloff (decay 2) | |
| RectAreaLight | no | nits | Only MeshStandardMaterial and MeshPhysicalMaterial | |
| LightProbe | no | multiplier | Spherical-harmonics ambient, usually baked |
PointLight and SpotLight intensity is candela with inverse-square falloff (decay 2 by default): a 1-candela light 5 units away contributes 1/25, so useful values depend on distance and typically run to the hundreds (the official docs' examples use 80 to 1000). light.power sets the same thing in lumens. light.distance is a smooth cutoff range (0 means no limit). Directional, ambient and hemisphere intensities are plain multipliers with no unit. RectAreaLight intensity is nits (candela per square metre).
Ambient and Hemisphere
DirectionalLight
SunLight: automatic cascaded shadows
SunLight (three/addons/lights/SunLight.js) is a parallel light with two cascaded shadow maps, suited to large scenes. It has no target: it shines from its position towards the origin, straight down by default. With WebGLRenderer it works out of the box; under WebGPURenderer register it first (see WebGPU and TSL).
The cascades are fitted automatically to slices of the camera's view frustum, up to sun.shadow.camera.far or the view camera's far plane, whichever is smaller. shadow.camera.left/right/top/bottom are ignored; the default mapSize is 1024 × 1024 per cascade. There is no shadow frustum to hand-tighten.
PointLight and SpotLight
angle is the cone half-angle in radians with an upper bound of Math.PI / 2; penumbra (0 to 1) softens the cone edge.
RectAreaLight
A rectangular emitter for soft window- or strip-style lighting. It lights only MeshStandardMaterial and MeshPhysicalMaterial, and it cannot cast shadows.
Under WebGPURenderer, register the LTC textures with RectAreaLightTexturesLib instead (see WebGPU and TSL).
Shadows
shadow.radius above 1 widens the PCF filter and the VSM blur; it has no effect with BasicShadowMap. VSM also exposes shadow.blurSamples (default 8), and PointLight shadows do not support VSM at all — WebGLRenderer warns and skips the light's shadow. PCFSoftShadowMap is deprecated: it warns and falls back to PCFShadowMap, which is already soft. With VSMShadowMap, every mesh that receives shadows also casts them.
Tuning a directional shadow
Point and spot shadow cameras are derived
The renderer rebuilds these cameras on every shadow pass: a spot light's shadow fov is 2 × angle × shadow.focus (in degrees) and its far comes from light.distance; a point light's far also comes from light.distance. The fov is always overwritten, and a manual far survives only while distance is 0. Control the cone with angle and shadow.focus, the range with distance.
Visualize a directional or spot light's shadow camera with new THREE.CameraHelper(light.shadow.camera) added to the scene, and call the helper's update() after changing the camera.
Contact shadows (fake, cheap)
A shadow map per light is overkill for a grounded look; a radial-gradient blob costs one textured quad.
For a blob that follows the object's silhouette, render depth from below into a render target and blur it — the official webgl_shadow_contact example does this with HorizontalBlurShader and VerticalBlurShader from three/addons/shaders/.
Light Helpers
Every light helper copies the light's color only in update(), and DirectionalLightHelper, SpotLightHelper and HemisphereLightHelper also re-aim only there: call update() after recoloring a light, and after moving or re-aiming one of those three.
Environment Lighting (IBL)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/threejs-lighting/SKILL.md
Popularity
- Repository stars
- 1,848
- Repository forks
- 204
- 7-day trend score
- 38
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cloudai-x/threejs-skills/threejs-lighting)