The pack
ssao3d
function ssao3d(opts: Ssao3dOptions = {}): Pack<{ ssao: Ssao3dApi }>
The ssao-3d pack: half-resolution ambient occlusion, bilaterally blurred and multiplied into the scene.
Requires a 3D world and render-3d, whose depth it reads and whose camera it shares.
Functions
buildSsaoBlurWGSL
function buildSsaoBlurWGSL(): string
A BILATERAL five-tap cross blur, one horizontal and vertical pass at half resolution. The taps are weighted by depth similarity, using the linear depth the estimate wrote into green, so occlusion never bleeds across a silhouette — a plain blur draws a HALO around every object.
buildSsaoCompositeWGSL
function buildSsaoCompositeWGSL(): string
The composite: a full-screen multiply-darken. The fragment writes the occlusion as a grey and the pipeline blends zero-by-source, so the scene is multiplied by it. The linear sampler does the half-to-full upscale for free, which smooths the result a little further at no cost.
buildSsaoWGSL
function buildSsaoWGSL(): string
The AO estimate, at half resolution.
ssaoKernel
function ssaoKernel(n: number = SAMPLES): Array<[number, number]>
The spiral sample offsets baked into the AO shader: a golden-angle spiral with radii √(i/n), so the taps spread evenly over the unit disc instead of clustering at the centre the way uniform angles do.
Types
Ssao3dApi
interface Ssao3dApi
game.ssao.
radius: number— Sample radius in world units, live.strength: number— Darkening strength, live.power: number— Power curve, live.enabled: boolean— Turn it off entirely; the cost then is zero.
Ssao3dOptions
interface Ssao3dOptions
How the occlusion looks. Every field is live.
radius?: number— Sample radius in world units. Default 0.8.strength?: number— Darkening strength, 0..2. Default 1.power?: number— Power curve; higher tightens the darkening into the creases. Default 1.5.enabled?: boolean— Whether the pass runs at all. Default true.


