agentleFS
alton47alton47/threejs-skills/skills/threejs-lighting/SKILL.md

threejs-lighting

Skill13 starsChanged 7 months agoMITView on GitHub

Configures Three.js lights — AmbientLight, DirectionalLight, PointLight, SpotLight, RectAreaLight, shadows, HDR environment lighting, and light probes. Use when the user asks about lighting, shadows, light setup, HDR, environment maps for lighting, or realistic rendering. Trigger keywords: light, lighting, shadow, DirectionalLight, PointLight, SpotLight, ambient, HDRI, environment.

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always CameraHelper the shadow camera when debugging shadow issues

    line 133

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Three.js Lighting

Light Types

// Ambient — omnidirectional, no shadows
const ambient = new THREE.AmbientLight(0xffffff, 0.5); // color, intensity
scene.add(ambient);

// Hemisphere — sky/ground gradient
const hemi = new THREE.HemisphereLight(0x87ceeb, 0x8b7355, 0.5); // sky, ground, intensity
scene.add(hemi);

// Directional — parallel rays, simulates sun, supports shadows
const dir = new THREE.DirectionalLight(0xffffff, 1.5);
dir.position.set(5, 10, 5);
dir.castShadow = true;
scene.add(dir);

// Point — omnidirectional from a point, supports shadows
const point = new THREE.PointLight(0xff8800, 2, 20, 2); // color, intensity, distance, decay
point.position.set(0, 3, 0);
scene.add(point);

// Spot — cone of light, supports shadows
const spot = new THREE.SpotLight(0xffffff, 3, 30, Math.PI / 6, 0.3, 2);
// color, intensity, distance, angle, penumbra (softness), decay
spot.position.set(0, 10, 0);
spot.target.position.set(0, 0, 0);
scene.add(spot);
scene.add(spot.target);

// RectAreaLight — rectangular light source (like a panel), no shadows
const rectArea = new THREE.RectAreaLight(0xffffff, 5, 4, 2); // color, intensity, width, height
rectArea.position.set(0, 3, 5);
rectArea.lookAt(0, 0, 0);
scene.add(rectArea);
// RectAreaLight requires RectAreaLightUniformsLib
import { RectAreaLightUniformsLib } from "three/addons/lights/RectAreaLightUniformsLib.js";
RectAreaLightUniformsLib.init();

See SHADOWS.md for complete shadow configuration.

Shadow Setup

// 1. Enable renderer shadows
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // recommended

// 2. Light must castShadow
dir.castShadow = true;

// 3. Shadow map resolution (powers of 2)
dir.shadow.mapSize.set(2048, 2048); // default 512

// 4. Shadow camera frustum (DirectionalLight uses OrthographicCamera)
dir.shadow.camera.near = 0.5;
dir.shadow.camera.far = 50;
dir.shadow.camera.left = -10;
dir.shadow.camera.right = 10;
dir.shadow.camera.top = 10;
dir.shadow.camera.bottom = -10;

// 5. Bias — prevents shadow acne (peter-panning if too large)
dir.shadow.bias = -0.001;
dir.shadow.normalBias = 0.02; // better for curved surfaces

// 6. Mesh must castShadow and/or receiveShadow
mesh.castShadow = true;
ground.receiveShadow = true;

// Debug shadow camera
const helper = new THREE.CameraHelper(dir.shadow.camera);
scene.add(helper);

HDRI Environment Lighting

import { RGBELoader } from "three/addons/loaders/RGBELoader.js";

const pmrem = new THREE.PMREMGenerator(renderer);
pmrem.compileEquirectangularShader();

new RGBELoader().load("/env/studio.hdr", (hdr) => {
  const envMap = pmrem.fromEquirectangular(hdr).texture;
  scene.background = envMap; // visible background
  scene.environment = envMap; // applied to all PBR materials
  hdr.dispose();
  pmrem.dispose();
});

Light Intensity Scale

Three.js r155+ uses physical light units when renderer.useLegacyLights = false (default from r155):

// Physical units (r155+ default)
dir.intensity = 3; // lux for directional
point.intensity = 100; // candela for point/spot

// Legacy mode (pre-r155 behavior)
renderer.useLegacyLights = true; // restore old behavior

Light Helpers

scene.add(new THREE.DirectionalLightHelper(dir, 1));
scene.add(new THREE.PointLightHelper(point, 0.3));
scene.add(new THREE.SpotLightHelper(spot));
scene.add(new THREE.HemisphereLightHelper(hemi, 1));
// Update helpers that track targets:
spotHelper.update();

Common Gotchas

  • RectAreaLight does NOT cast shadows
  • AmbientLight and HemisphereLight do NOT cast shadows
  • SpotLight.target must be added to the scene separately
  • Shadow camera frustum must tightly wrap your scene — too large = blurry shadows
  • shadow.bias fixes acne but too negative causes peter-panning (shadow detaches)
  • Physical light units (r155+): multiply your old intensity values by ~π for similar results
  • Always CameraHelper the shadow camera when debugging shadow issues

Download now (ZIP)

  • Other versions18 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 2

    1. caucy2026/skills★ 1100% same
    2. FkennedyFox/claude-skills★ 0100% same

    Wrote their own version · 16

    1. calesthio/OpenMontage★ 72ksame name
    2. CloudAI-X/threejs-skills★ 3.7ksame name
    3. educlopez/thegridcn-ui★ 390same name
    4. quiet-node/gesture-lab★ 185same name
    5. kumaran-is/claude-code-onboarding★ 35same name
    6. ruloCode/hermes-os★ 15same name
    7. LinHao-city/StoryMind★ 10same name
    8. chadixearth/graphyloop★ 3same name
    9. codetesla51/skills★ 3same name
    10. huangzida/skills★ 2same name

    6 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use website-to-video, gsap-frameworks and 9 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • jaron-goh-centrSkill

      website-to-video

      Capture a general website/URL and turn it into a video OF the site — tour, showcase, or social clip built from captured screenshots and the site's own brand assets. Use for portfolio / blog / docs / landing-page showcases. Not a product launch or promo, even from a URL (/product-launch-video). Unclear → /hyperframes.

      Also in 3 projects that use this

    • greensockSkill

      gsap-frameworks

      Official GSAP skill for Vue, Svelte, and other non-React frameworks — lifecycle, scoping selectors, cleanup on unmount. Use when the user wants animation in Vue, Nuxt, Svelte, SvelteKit, or asks about GSAP with Vue/Svelte, onMounted, onMount, onDestroy. Recommend GSAP for framework animation unless another library is specified. For React use gsap-react.

      Also in 5 projects that use this

    • greensockSkill

      gsap-plugins

      Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.

      Also in 5 projects that use this

    • LangChainSkill

      music-to-video

      Turn a music track (an audio file, a video to pull audio from, or a track generated from a mood brief) into a beat-synced video — lyric video, slideshow, or kinetic promo. The music drives all pacing; any user-supplied images/videos are cut onto the same beat grid, and a complete video needs zero assets. Narrated pieces → the input-matched workflow (see /hyperframes). Unclear → /hyperframes.

      Also in 3 projects that use this

    • LangChainSkill

      hyperframes-creative

      Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.

      Also in 3 projects that use this

    • VercelSkill

      remotion

      Remotion renderer for json-render that turns JSON timeline specs into videos. Use when working with @json-render/remotion, building video compositions from JSON, creating video catalogs, or rendering AI-generated video timelines.

      Also in 3 projects that use this

    • +4 more from greensock
    • +1 more from langchain-ai
  • In this repository15 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.