Phaser AE

Ambient Occlusion

Free packv3.0.0-33DPost

Screen-space ambient occlusion: the contact darkening that grounds 3D objects in one another, so a box beside a wall has a seam and a torus has depth in its own hole. It is the cheapest thing that stops a scene reading as separate shapes floating in the same room.

This is a Free pack. Every phaser.io account can use it in their games.

Released October 14, 2026 · updated October 19, 2026

Ambient Occlusion: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

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.