New advertisers: 50% off your first month with code FIRSTMONTHSee slots
enzed avatar

R3f Lighting

Practical React Three Fiber lighting guide covering light types, shadow setup, environment maps, and performance tradeoffs.

skills.sh installs
2.1K
GitHub stars
138
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers direct lights versus environment (IBL) lighting, with guidance on when each is needed for PBR reflections and real-time shadows
  • Includes a shadowed <Canvas> example with directional light and shadow camera settings, plus notes on Drei Environment, Lightformer, and ContactShadows
  • Enforces checks that shadow-casting lights, casting meshes, and receiving materials are all configured, and that the shadow frustum is tightened before raising map resolution
  • Designed for React Three Fiber 9 and Three.js r182+ projects that need tuned shadows, environment lighting, and lighting performance control

Install

$ npx -y skills add enzed/r3f-skills --skill r3f-lighting -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

React Three Fiber lighting

Check installed Three.js, Fiber, and Drei versions and the renderer first. This example targets Fiber 9 / React 19, Three.js r185, and WebGL.

Start with a deliberate lighting setup

  • Use environment lighting for PBR reflections/fill and direct lights for direction and real-time shadowing. More ambient light will not restore missing metallic reflections.
  • A scene background and scene.environment serve different purposes. Drei Environment assigns lighting; background additionally makes it visible behind the scene.
  • Prefer an owned HDR/EXR asset in production. Drei presets are useful for prototyping but depend on external hosting. Check loader support before choosing newer formats.
  • Sky is visible sky geometry, not automatically a matching sun light or environment. Align the sky, direct light, and environment when visual consistency matters.

Shadowed scene

Mount inside <Canvas shadows="percentage">. On Three.js r182+, PCFShadowMap is soft; Fiber 9's bare shadows selects the deprecated PCFSoftShadowMap.

Details

Repository
github.com/enzed/r3f-skills
Categories
3D, CAD & Modeling, Frontend & UI Code
First seen
May 16, 2026

More from enzed/r3f-skills

All 11

Similar to R3f Lighting

More 3D, CAD & Modeling