agentleFS
scottsttsscottstts/Threejs-Awesome-Graphics-Agent-Skills/skills/threejs-shadow-systems/SKILL.md

threejs-shadow-systems

Skill1.1k starsChanged 4 days agoMITView on GitHub

Implement stable, scalable directional-shadow systems for Three.js. Use for large procedural worlds, city scenes, terrain, moving cameras, WebGPU/TSL shadow nodes, CSMShadowNode cascades, cached clipmaps, texel stabilization, tight depth-range bias and peter-panning fixes, static versus dynamic update budgets, matte test-plane isolation, and targeted invalidation.

2 other projects use a version of this, 2 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use a single tightly fitted shadow map only when its receiver region is genuinely bounded.

    line 8
  2. Very specific:

    Start bias at 0, raise normalBias scaled by world texel width to clear grazing acne, and confirm thin-post contacts and small-relief …

    line 15
  3. Distinctive:

    Verify with a matte test plane, grazing stick shadows, slow pans, and near-to-far camera dollies.

    line 17
  4. Very specific:

    Read references/shadow-cascades-bias-and-updates.md for tier selection, WebGPU CSMShadowNode setup, depth-range bias calibration, …

    line 19
  5. Distinctive:

    Read references/cached-clipmap-shadows.md for custom concentric light-space cached clipmaps, committed-center state, update budgets, and …

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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

Shadow Systems

Use a single tightly fitted shadow map only when its receiver region is genuinely bounded. For open scenes and large moving views, choose an explicit cascade or cached-clipmap hierarchy with tight depth ranges, world-texel-scaled bias, and per-frame dynamic caster updates.

Coverage and build workflow

  1. Choose the coverage tier: single tightly fitted map (compact bounded scene), built-in CSMShadowNode (3–4 cascades for open worlds), or custom cached clipmaps + long-range/baked terrain shadows (multi-kilometre streamed worlds).
  2. Fit shadow-camera near/far tightly to actual casters so normalized depth bias never produces decimetres of peter-panning.
  3. Snap cascade/clipmap centers to each level's world-space texel grid and cross-fade adjacent levels cleanly.
  4. Start bias at 0, raise normalBias scaled by world texel width to clear grazing acne, and confirm thin-post contacts and small-relief casting (reliefDepth > texelWidth + bias).
  5. Separate update policies: bake static architecture/terrain (autoUpdate = false), update moving casters (wind-blown vegetation, characters, vehicles) every frame, and invalidate cached coarse levels spatially.
  6. Verify with a matte test plane, grazing stick shadows, slow pans, and near-to-far camera dollies.

Read references/shadow-cascades-bias-and-updates.md for tier selection, WebGPU CSMShadowNode setup, depth-range bias calibration, small-relief casting thresholds, static vs dynamic update policies, and matte test-plane isolation.

Read references/cached-clipmap-shadows.md for custom concentric light-space cached clipmaps, committed-center state, update budgets, and targeted invalidation.

Read the cached shadow clipmaps for three light-space square levels, per-level texel snapping, containment cross-fades, cached coarse updates, scaled bias, and unshadowed outside weight.

Failure conditions

  • projection centers move by fractions of a texel, causing swimming edges;
  • shadow-camera depth range is left overly wide, turning small depth bias into peter-panning;
  • small architectural or rock relief casts nothing because texel width plus bias exceeds relief depth;
  • shader containment does not match the map's committed center;
  • moving foliage, characters, or vehicles cast stepped every-N-frame or static proxy shadows;
  • coarse levels freeze moving casters indefinitely without invalidation;
  • depth texture samples occur in divergent fragment control flow;
  • the same normal bias is used across radically different texel sizes;
  • level boundaries become visible or shadows clip abruptly at mid-distance under camera motion;
  • a fill light casts conflicting shadows alongside the primary sun.

Routing boundary

This skill owns light-space directional shadow coverage, cascades, clipmaps, bias, and caster update policies. Use $threejs-lighting-and-gi for sun direction coherence, sun-to-sky ratios, irradiance-probe GI, and reflections; $threejs-screen-space-ambient-occlusion for view-dependent contact AO (AO never replaces cast shadows); and $threejs-temporal-stability for general frame-to-frame motion audits.

Download now (ZIP)

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.