Taos API Reference
    Preparing search index...

    Class SSAOPass

    Screen-space ambient occlusion pass (render-graph version).

    Algorithm: classic Crytek-style view-space hemisphere SSAO. Not HBAO or GTAO — no horizon traversal, no analytical integral, no temporal accumulation. Just the standard four-step pipeline:

    1. Per-frame setup (built once in create(), uploaded as uniforms):

      • A 16-sample kernel of cosine-weighted-ish points in the unit hemisphere (z >= 0), scaled by 0.1 + 0.9 * (i/N)² so samples cluster near the origin. See generateKernel.
      • A 4×4 tile of random 2D rotation vectors ((cos θ, sin θ, 0, 1)) used to break up the banding from a fixed kernel. See generateNoise.
    2. AO pass at half resolution (ssao.wgsl, fs_ssao):

      • Reconstruct view-space position from GBuffer depth + inv_proj; transform the GBuffer world-space normal into view space.
      • Build a TBN frame using Gram-Schmidt from the tiled noise vector and the surface normal, re-orienting the hemisphere kernel per pixel.
      • For each of the 16 samples: project the kernel sample to screen UV, read the depth there, reconstruct that point's view-space Z, and count it as occluded when ref_z > sample_vs.z + bias (the real surface is closer to the camera than the kernel sample — i.e. the sample is inside geometry). Comparing against the sample's Z rather than the pixel's Z makes the bias slope-invariant on flat surfaces.
      • Multiply each occlusion vote by 1 - smoothstep(0, radius, |ΔZ|) so hits on geometry far from the surface don't haunt the result.
      • Write clamp(1 - (occlusion/N) * strength, 0, 1) to a half-res r8unorm target.
    3. Blur (ssao_blur.wgsl):

      • 'quality' (default): two-pass separable bilateral Gaussian (7-tap, weights 0.196, 0.175, 0.122, 0.067), with a depth-aware term exp(-|Δdepth| * 1000) that zeroes contributions across depth discontinuities (no AO bleeding across silhouettes).
      • 'performance': single-pass 4×4 unweighted box average.
    4. Output: half-res r8unorm AO factor, consumed by the deferred lighting pass (ambient term) and by composite (fog blending).

    Both intermediate (raw) and final (blurred) AO targets are transient per-frame resources; the persistent uniform buffer and noise texture live on the pass instance.

    Hierarchy (View Summary)

    • Pass<SSAODeps, SSAOOutputs>
      • SSAOPass
    Index

    Properties

    name: "SSAOPass" = 'SSAOPass'

    Human-readable identifier used in graph node labels and error messages.

    Methods

    • Insert the pass into graph for one frame. Implementations call graph.addPass(name, type, b => { ... }) exactly once and use the supplied PassBuilder to declare reads, writes, transient resources, and the execute callback.

      Parameters

      • graph: RenderGraph

        Graph being built this frame.

      • deps: SSAODeps

        Pass-specific dependency record (handles, scene data, etc.).

      Returns SSAOOutputs

      Pass-specific output record (typically a set of handles downstream passes will consume).

    • Release every long-lived GPU resource owned by the pass (pipelines, persistent uniform buffers, samplers, BGLs). Called by the factory or application during teardown. Default implementation is a no-op.

      Returns void