agentleFS
scottsttsscottstts/Threejs-Awesome-Graphics-Agent-Skills/skills/threejs-screen-space-ambient-occlusion/SKILL.md

threejs-screen-space-ambient-occlusion

Skill1.1k starsChanged 6 days agoMITView on GitHub

Implement a production GTAO path in Three.js. Use for native WebGPU/TSL GTAONode wired through builtinAOContext, half-resolution horizon sampling, reversed-depth reconstruction, bent-normal encoding, full-resolution bilateral reconstruction, masking sky and water to prevent horizon barcodes, contact grounding, and halo diagnosis.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    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. Distinctive:

    Verify in AO-only, horizon-grazing, and moving-camera views for zero halos, zero grain, and zero horizon barcodes.

    line 18
  2. Very specific:

    Read references/tsl-gtao-and-horizon-safety.md for the native WebGPU/TSL GTAONode + builtinAOContext setup, horizon-barcode prevention, …

    line 20
  3. Distinctive:

    Read references/gtao-bent-normal-pipeline.md for the custom half-resolution horizon-sampling math, bent-normal heuristic validation, …

    line 22

≈ “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

Screen-Space Ambient Occlusion

AO estimates local ambient contact visibility. It must modulate indirect lighting only — never direct sun, practical lights, sky, water, or emissive surfaces.

Workflow

  1. Enable reversed depth (reversedDepthBuffer: true on WebGPURenderer) and verify linear depth and view-space normals.
  2. Exclude sky, water, and emissive surfaces from AO from day one, and fade AO smoothly to 1.0 before far depth quantizes.
  3. Choose the integration tier:
    • Native WebGPU/TSL (preferred): opaque depth + normalView pre-pass → GTAONode (ao()) → scenePass.contextNode = builtinAOContext(...) modulating indirect/ambient light directly.
    • Custom half-res + bent normals: custom horizon gather, bent-normal encoding, 8-neighbour bilateral upsample, and indirect-only composite.
  4. Size radius and thickness in world metres to actual contact features (0.4–2.5 m) — never crank radius to fake room-scale GI.
  5. Verify in AO-only, horizon-grazing, and moving-camera views for zero halos, zero grain, and zero horizon barcodes.

Read references/tsl-gtao-and-horizon-safety.md for the native WebGPU/TSL GTAONode + builtinAOContext setup, horizon-barcode prevention, world-scale sizing, and AO-vs-GI boundaries.

Read references/gtao-bent-normal-pipeline.md for the custom half-resolution horizon-sampling math, bent-normal heuristic validation, bilateral upsample kernel, and indirect-reconstruction composite.

Failure conditions

  • direct light, sky, water, or emissive surfaces are darkened by AO;
  • vertical dark "barcode" stripes appear near the horizon from unmasked or unfaded far depth;
  • radius is specified only in pixels, or inflated to multi-metre values to fake missing GI;
  • foreground silhouettes cast thick screen-space halos across depth discontinuities;
  • half-resolution gather is grainy during camera motion because it lacks bilateral spatial denoising;
  • bent normals are treated as ordinary geometric normals without verifying hemisphere sign;
  • the implementation claims temporal accumulation even though the path has none.

Routing boundary

This skill owns small-scale contact GTAO, bent normals, bilateral denoising, horizon-safe distance fading, and indirect-only AO application. Use $threejs-lighting-and-gi for room/alcove-scale occluded indirect light (LightProbeGrid) and reflections; $threejs-spectral-ocean for water-side horizon barcode checks; $threejs-temporal-stability for motion-grain audits; and $threejs-image-pipeline only when depth/normal buffers or pass order must be coordinated across multiple image-space systems.

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.