export default AmbientOcclusionShader;
/**
 * Lightmap baker for heightfield terrain.
 *
 * Per output texel, traces `NUM_RAYS` cosine-weighted rays into the
 * hemisphere around the surface normal and counts how many are occluded by
 * the heightfield. The output channel is visibility ∈ [0, 1]:
 *   1 = fully lit (no occlusion)
 *   0 = fully occluded
 *
 * Architecture
 * ------------
 *
 *   1. Pre-pass (orchestrator side): a max-reduction mipmap pyramid is built
 *      from the heightmap — see `build_max_height_pyramid`. Each mip stores
 *      per-cell upper bounds on height. The whole pyramid is one DataTexture
 *      with `tex.mipmaps[]`, sampled by `textureLod`.
 *
 *   2. Sampling: directions are drawn from a cosine-weighted hemisphere using
 *      Shirley's concentric disk mapping. Cosine-weighting matches the
 *      Lambertian diffuse assumption — each sample's contribution to the AO
 *      integral has unit weight, and the estimator collapses to a simple
 *      hits/total ratio.
 *
 *   3. Random seeding: a PCG hash (pcg3d on the fragment coordinate) seeds an
 *      independent stream per output texel. Subsequent rays draw from `pcg`
 *      on the running state. White noise — no Halton/blue-noise sequences —
 *      keeps the implementation simple and the noise spectrum unbiased; a
 *      bilateral denoise pass downstream cleans up the speckle.
 *
 *   4. Tracing: Hi-Z traversal in world space. The ray's XZ projection walks
 *      texture-space cells; per cell, the max-height at the current mip is
 *      compared against the ray's min height across the cell. Above max:
 *      advance to the next cell and try to coarsen the mip. Below max:
 *      refine the mip; at mip 0, record a hit. Bounded by MAX_HIZ_ITER per
 *      ray as a safety net for pathological convergence.
 *
 * World space
 * -----------
 *
 *   Convention: X and Z are horizontal (UV-aligned), Y is up. The heightmap's
 *   UV maps linearly to world (x, z) ∈ [0, worldSize.x] × [0, worldSize.y],
 *   and the heightmap value at any UV is the world Y coordinate of the
 *   surface. Surface normals are recomputed in-shader by central differences
 *   on the heightmap, removing any dependency on an external normal map.
 *
 * Inputs (uniforms — plumbing, not user-facing)
 * ---------------------------------------------
 *
 *   heightMap     R32F texture with a max-reduction mipmap chain
 *   worldSize     XZ extent of the terrain in world units
 *   heightMapSize Resolution of heightMap mip 0 in texels
 *   maxMipLevel   Index of the coarsest mip in heightMap
 *
 * The single user-facing parameter is `NUM_RAYS`, configured by the factory
 * argument.
 *
 * @param {Object} [opts]
 * @param {number} [opts.numRays=64] number of rays per output texel
 */
declare function AmbientOcclusionShader({ numRays }?: {
    numRays?: number;
}): {
    uniforms: {
        heightMap: {
            value: any;
        };
        worldSize: {
            value: Vector2;
        };
        heightMapSize: {
            value: Vector2;
        };
        maxMipLevel: {
            value: number;
        };
    };
    defines: {
        NUM_RAYS: number;
    };
    glslVersion: import("three").GLSLVersion;
    vertexShader: string;
    fragmentShader: string;
};
import { Vector2 } from "three";
//# sourceMappingURL=AmbientOcclusionShader.d.ts.map