r3f-lighting
React Three Fiber lighting - light types, shadows, Environment component, IBL. Use when adding lights, configuring shadows, setting up environment lighting, or optimizing lighting performance.
What this skill does
# React Three Fiber Lighting
## Quick Start
```tsx
import { Canvas } from '@react-three/fiber'
function Scene() {
return (
<Canvas shadows>
{/* Ambient fill */}
<ambientLight intensity={0.5} />
{/* Main light with shadows */}
<directionalLight
position={[5, 5, 5]}
intensity={1}
castShadow
shadow-mapSize={[2048, 2048]}
/>
{/* Objects */}
<mesh castShadow receiveShadow>
<boxGeometry />
<meshStandardMaterial color="orange" />
</mesh>
{/* Ground */}
<mesh receiveShadow rotation={[-Math.PI / 2, 0, 0]} position={[0, -0.5, 0]}>
<planeGeometry args={[10, 10]} />
<meshStandardMaterial color="#888" />
</mesh>
</Canvas>
)
}
```
## Light Types Overview
| Light | Description | Shadow Support | Cost |
|-------|-------------|----------------|------|
| ambientLight | Uniform everywhere | No | Very Low |
| hemisphereLight | Sky/ground gradient | No | Very Low |
| directionalLight | Parallel rays (sun) | Yes | Low |
| pointLight | Omnidirectional (bulb) | Yes | Medium |
| spotLight | Cone-shaped | Yes | Medium |
| rectAreaLight | Area light (window) | No* | High |
## ambientLight
Illuminates all objects equally. No direction, no shadows.
```tsx
<ambientLight
color="#ffffff" // or color={new THREE.Color('#ffffff')}
intensity={0.5}
/>
```
## hemisphereLight
Gradient from sky to ground. Good for outdoor scenes.
```tsx
<hemisphereLight
color="#87ceeb" // Sky color
groundColor="#8b4513" // Ground color
intensity={0.6}
position={[0, 50, 0]}
/>
```
## directionalLight
Parallel light rays. Simulates distant light (sun).
```tsx
<directionalLight
color="#ffffff"
intensity={1}
position={[5, 10, 5]}
// Shadow configuration
castShadow
shadow-mapSize={[2048, 2048]}
shadow-camera-near={0.5}
shadow-camera-far={50}
shadow-camera-left={-10}
shadow-camera-right={10}
shadow-camera-top={10}
shadow-camera-bottom={-10}
shadow-bias={-0.0001}
shadow-normalBias={0.02}
/>
// With target (light points at target)
function DirectionalWithTarget() {
const lightRef = useRef()
return (
<>
<directionalLight
ref={lightRef}
position={[5, 10, 5]}
target-position={[0, 0, 0]}
/>
</>
)
}
```
## pointLight
Emits light in all directions. Like a light bulb.
```tsx
<pointLight
color="#ffffff"
intensity={1}
position={[0, 5, 0]}
distance={100} // Maximum range (0 = infinite)
decay={2} // Light falloff (physically correct = 2)
// Shadows
castShadow
shadow-mapSize={[1024, 1024]}
shadow-camera-near={0.5}
shadow-camera-far={50}
shadow-bias={-0.005}
/>
```
## spotLight
Cone-shaped light. Like a flashlight.
```tsx
<spotLight
color="#ffffff"
intensity={1}
position={[0, 10, 0]}
angle={Math.PI / 6} // Cone angle (max Math.PI/2)
penumbra={0.5} // Soft edge (0-1)
distance={100} // Range
decay={2} // Falloff
// Target
target-position={[0, 0, 0]}
// Shadows
castShadow
shadow-mapSize={[1024, 1024]}
shadow-camera-near={0.5}
shadow-camera-far={50}
shadow-camera-fov={30}
shadow-bias={-0.0001}
/>
// SpotLight helper
import { useHelper } from '@react-three/drei'
import { SpotLightHelper } from 'three'
function SpotLightWithHelper() {
const lightRef = useRef()
useHelper(lightRef, SpotLightHelper, 'cyan')
return <spotLight ref={lightRef} position={[0, 5, 0]} />
}
```
## rectAreaLight
Rectangular area light. Great for soft, realistic lighting.
```tsx
import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper'
function AreaLight() {
const lightRef = useRef()
return (
<>
<rectAreaLight
ref={lightRef}
color="#ffffff"
intensity={5}
width={4}
height={2}
position={[0, 5, 0]}
rotation={[-Math.PI / 2, 0, 0]} // Point downward
/>
</>
)
}
// Note: RectAreaLight only works with MeshStandardMaterial and MeshPhysicalMaterial
// Does not cast shadows natively
```
## Shadow Setup
### Enable Shadows on Canvas
```tsx
<Canvas
shadows // or shadows="soft" | "basic" | "percentage" | "variance"
>
```
### Shadow Types
```tsx
// Basic shadows (fastest, hard edges)
<Canvas shadows="basic">
// PCF shadows (default, filtered)
<Canvas shadows>
// Soft shadows (PCFSoft, softer edges)
<Canvas shadows="soft">
// VSM shadows (variance shadow map)
<Canvas shadows="variance">
```
### Configure Shadow-Casting Objects
```tsx
// Light must cast shadows
<directionalLight castShadow />
// Objects must cast and/or receive shadows
<mesh castShadow receiveShadow>
<boxGeometry />
<meshStandardMaterial />
</mesh>
// Ground typically only receives
<mesh receiveShadow>
<planeGeometry args={[100, 100]} />
<meshStandardMaterial />
</mesh>
```
### Shadow Camera Helper
```tsx
import { useHelper } from '@react-three/drei'
import { CameraHelper } from 'three'
function LightWithShadowHelper() {
const lightRef = useRef()
// Visualize shadow camera frustum
useHelper(lightRef.current?.shadow.camera, CameraHelper)
return (
<directionalLight
ref={lightRef}
castShadow
shadow-camera-left={-10}
shadow-camera-right={10}
shadow-camera-top={10}
shadow-camera-bottom={-10}
/>
)
}
```
## Drei Lighting Helpers
### Environment
HDR environment lighting with presets or custom files.
```tsx
import { Environment } from '@react-three/drei'
// Preset environments
<Environment
preset="sunset" // apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse
background // Also use as background
backgroundBlurriness={0} // Background blur
backgroundIntensity={1} // Background brightness
environmentIntensity={1} // Lighting intensity
/>
// Custom HDR file
<Environment files="/hdri/studio.hdr" />
// Cube map (6 images)
<Environment
files={['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']}
path="/textures/cube/"
/>
// Ground projection
<Environment
preset="city"
ground={{
height: 15,
radius: 100,
scale: 100,
}}
/>
```
### Lightformer
Create custom light shapes inside Environment.
```tsx
import { Environment, Lightformer } from '@react-three/drei'
<Environment>
<Lightformer
form="ring" // circle, ring, rect
intensity={2}
color="white"
scale={10}
position={[0, 5, -5]}
target={[0, 0, 0]} // Point at target
/>
<Lightformer
form="rect"
intensity={1}
color="red"
scale={[5, 2]}
position={[-5, 5, 0]}
/>
</Environment>
```
### Sky
Procedural sky with sun.
```tsx
import { Sky } from '@react-three/drei'
<Sky
distance={450000}
sunPosition={[0, 1, 0]} // Or calculate from inclination/azimuth
inclination={0.6} // Sun elevation (0 = horizon, 0.5 = zenith)
azimuth={0.25} // Sun rotation around horizon
turbidity={10} // Haziness
rayleigh={2} // Light scattering
mieCoefficient={0.005}
mieDirectionalG={0.8}
/>
```
### Stars
Starfield background.
```tsx
import { Stars } from '@react-three/drei'
<Stars
radius={100} // Sphere radius
depth={50} // Depth of star distribution
count={5000} // Number of stars
factor={4} // Size factor
saturation={0} // Color saturation
fade // Fade at edges
speed={1} // Twinkle speed
/>
```
### Stage
Quick lighting setup for product showcase.
```tsx
import { Stage } from '@react-three/drei'
<Stage
preset="rembrandt" // rembrandt, portrait, upfront, soft
intensity={1}
shadows="contact" // false, 'contact', 'accumulative', true
environment="city"
adjustCamera={1.2} // Adjust camera to fit content
>
<Model />
</Stage>
```
### ContactShadows
Fast fake shadows without shadow mapping.
```tsx
import { ContactShadows } from '@react-three/drei'
<ContactShadoRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.