threejs-lighting_skill

This skill helps you implement and optimize Three.js lighting, shadows, and environment lighting to improve realism and performance.

958

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill cloudai-x/threejs-skills --skill threejs-lighting

  • SKILL.md11.7 KB

Overview

This skill covers Three.js lighting: choosing light types, configuring shadows, setting up image-based environment lighting, and optimizing lighting performance. It distills practical patterns for indoor/outdoor setups, shadow tuning, IBL with PMREM, and common lighting rigs like three-point lighting.

How this skill works

The skill explains what each Three.js light does (Ambient, Hemisphere, Directional, Point, Spot, RectArea) and when to enable shadows. It shows renderer and light shadow settings, shadow camera tuning, contact-shadow fallbacks, light helpers, and how to load HDR or cube maps with PMREM for accurate PBR reflections. It also covers light probes and animated light techniques.

When to use it

  • Adding basic scene illumination or ambient fill
  • Simulating sunlight or outdoor skies with Directional and Hemisphere lights
  • Creating localized lamps or spot effects with Point and Spot lights
  • Soft realistic studio lighting using RectArea lights and helpers
  • Setting up IBL and reflections with HDR or cube environment maps
  • Optimizing performance for real-time apps with restricted shadows and baked lighting

Best practices

  • Enable renderer.shadowMap and use PCFSoftShadowMap for balanced quality
  • Keep shadow camera frustums tight and choose appropriate map sizes (512–2048)
  • Limit the number of dynamic lights; bake static lighting when possible
  • Use PMREMGenerator for HDR environment maps and dispose resources after use
  • Only enable castShadow/receiveShadow on objects that need them
  • Use light layers or selective shadows to reduce shader cost and complexity

Example use cases

  • Outdoor daylight: Directional light with shadows plus HemisphereLight for sky/ground ambient
  • Indoor studio: Multiple RectAreaLights for soft, realistic highlights and ambient fill
  • Product render: Three-point lighting (key, fill, back) with MeshPhysicalMaterial and IBL
  • Mobile optimization: Reduce dynamic lights, use smaller shadow maps, or bake lightmaps
  • Interactive scene: Animate a SpotLight for a flashlight effect and update helpers for debugging

FAQ

No. RectAreaLight shadows are not supported out of the box; use baked maps, custom shadow shaders, or additional shadow-casting lights as workarounds.

How do I get accurate reflections from an HDR file?

Load the HDR with RGBELoader, convert it using PMREMGenerator.fromEquirectangular, set scene.environment to the generated env map, then dispose the source texture and PMREM when done.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational