r3f-lighting

Configure lights, shadows, and environment lighting in React Three Fiber scenes.

1|Updated Aug 20, 2023
One-click install
npx skills add https://github.com/imanlangaran/mini-projects --skill r3f-lighting-imanlangaran
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r3f-lighting
Source: https://github.com/imanlangaran/mini-projects/tree/main/react/three-gsap/.claude/skills/r3f-lighting
Command: npx skills add https://github.com/imanlangaran/mini-projects --skill r3f-lighting-imanlangaran

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @react-three/fiber, @react-three/drei, three.

What problem does it solve? Setting up realistic lighting in React Three Fiber requires understanding many light types, shadow configurations, and environment options, and getting them wrong leads to flat visuals or poor performance. ## Core Features & Use Cases - Light Type Reference: Covers ambientLight, hemisphereLight, directionalLight, pointLight, spotLight, and rectAreaLight with full prop configurations and shadow settings. - Drei Lighting Helpers: Documents Environment presets, Lightformer, Sky, Stars, Stage, ContactShadows, AccumulativeShadows, SoftShadows, and BakeShadows. - Ready-Made Setups: Provides three-point lighting, outdoor daylight, and studio lighting recipes plus animated lighting patterns and performance tips. - Use Case: When building a product showcase page, use the Stage and ContactShadows patterns to get professional lighting with soft shadows without manually tuning multiple lights. ## Quick Start Add lighting to my React Three Fiber scene with a directional light casting shadows and an Environment preset for ambient illumination.

Frequently Asked Questions about r3f-lighting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add shadows in React Three Fiber?

Enable shadows by setting the shadows prop on Canvas, add castShadow to the light, and set castShadow or receiveShadow on meshes. Configure shadow-mapSize and shadow camera bounds on the light for quality control.

How to set up environment lighting in React Three Fiber?

Use the Environment component from @react-three/drei with a preset like sunset or studio, or load a custom HDR file via the files prop. Environment lighting provides image-based lighting that works with MeshStandardMaterial.

Which light type should I use in Three.js scenes?

Use directionalLight for sunlight, pointLight for bulbs, spotLight for focused cones, and ambientLight or hemisphereLight for cheap fill. rectAreaLight gives soft realistic lighting but only works with standard and physical materials and casts no shadows.

Does rectAreaLight support shadows in Three.js?

No, rectAreaLight does not cast shadows natively in Three.js. Combine it with ContactShadows from Drei or a shadow-casting directional light when you need both soft area lighting and shadows.

Why are my React Three Fiber shadows blurry or pixelated?

Pixelated shadows usually come from low shadow-mapSize or an overly large shadow camera frustum. Increase map size to 2048, tighten the shadow camera bounds to the scene area, and adjust shadow-bias to remove artifacts.

How do I improve lighting performance in React Three Fiber?

Limit the number of lights, use Environment instead of many individual lights, keep shadow maps at 512-1024, and use ContactShadows with frames set to 1 for static scenes. BakeShadows can freeze shadows for static content.