# r3f-lighting

r3f-lighting is a Claude Code skill for lighting React Three Fiber scenes with direct lights, environments, and shadows. It helps investigate shadow artifacts and render costs.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 2200 installs · ★ 138 repo stars
- Author: EnzeD
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/EnzeD/r3f-skills/tree/HEAD/skills/r3f-lighting/SKILL.md
- Updated: 2026-08-31
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/r3f-lighting

## What it does

This skill covers lighting for React Three Fiber scenes: direct sources, environment maps, HDR/EXR assets, `Sky`, shadows, and materials. It starts by checking the installed Three.js, Fiber, Drei, and renderer versions; its example is aimed at Fiber 9, React 19, and WebGL. The guide includes `Canvas` shadow settings, shadow-camera bounds, `bias`, `ContactShadows`, and `AccumulativeShadows`.

It also explains how to narrow a shadow frustum, verify `castShadow` and `receiveShadow`, compare static and animated captures, and count render passes. `RectAreaLight` gets a separate WebGL caveat, while moving light targets requires a scene-linked target whose world matrix updates. A detached target can leave the light pointing at an old transform.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-lighting -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/r3f-lighting/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/r3f-lighting/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-lighting -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/r3f-lighting/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-lighting -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/r3f-lighting/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install EnzeD/r3f-skills skills/r3f-lighting
```

2. **Manually: put the files in place**
- File: `.github/skills/r3f-lighting/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-lighting -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/EnzeD/r3f-skills --path skills/r3f-lighting
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/r3f-lighting/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-lighting -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/EnzeD/r3f-skills/tree/HEAD/skills/r3f-lighting/SKILL.md

## When to use it
- set up direct and environment lighting for a PBR scene
- trace acne and detached-shadow artifacts
- tune the shadow camera bounds and map size
- measure the cost of contact and point-light shadows

## Example prompts
- Set up lighting for this React Three Fiber scene with direct lights, an environment, and shadows.
- Investigate the model’s shadow acne and separation, then tune `bias` and the shadow-camera settings.
- Compare static and animated `ContactShadows` and identify the render passes to measure.

## Similar
- [threejs-lighting](https://affpapa.org/en/nevibecode/skills/threejs-lighting.md) — skill · 19400 installs
- [lighting-shadows-advanced](https://affpapa.org/en/nevibecode/rules/lighting-shadows-advanced.md) — rule · ★ 4719 repo stars
- [perf-r3f-perf](https://affpapa.org/en/nevibecode/rules/perf-r3f-perf.md) — rule · ★ 4719 repo stars
- [3d-wood-lighting-scorecard](https://affpapa.org/en/nevibecode/skills/3d-wood-lighting-scorecard.md) — skill · ★ 7995 repo stars
- [threejs-materials-lighting](https://affpapa.org/en/nevibecode/skills/threejs-materials-lighting.md) — skill · 11100 installs
- [3d-web-experience](https://affpapa.org/en/nevibecode/skills/sickn33-3d-web-experience.md) — skill · 5400 installs

From the same set: [enzed/r3f-skills](https://affpapa.org/en/nevibecode/by/enzed/r3f-skills.md) — 11 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
