Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdf78e4f826

README.md

AmbientOcclusion

The scene's contact shading, as a component. Add it to an entity and corners, creases and the places where objects meet darken the way they do in life.

local id = entity.spawn("ambient_occlusion").id
entity(id).component.add("AmbientOcclusion", {
    technique = "gtao",
    intensity = 0.9,
    radius = 1.5,
    quality = "high",
})

Every field is live — editing one in the inspector moves the shading on the next frame, and the values persist with the scene. Setting intensity to 0 turns occlusion off while keeping the rest authored; removing the last one in the scene clears it.

fieldeffect
techniquessao | hbao | gtao. The three cost the same taps and are scaled to agree on a right-angle corner.
intensityHow far the darkening goes, in [0, 1]. 0 is off.
radiusWorld-space reach of the occlusion.
powerContrast curve on the visibility term. Above 1 deepens the dark end.
thicknessWorld-space thickness assumed for an occluder.
biasHow far a neighbour must rise above the surface before it counts as an occluder, in [0, 1].
qualitylow | medium | high | ultra. The lower two compute occlusion on a half-resolution grid.

A technique or quality outside those sets is reported as a warning and the last good setting stays live, so a typo in the inspector does not stop the component.

Code that changes occlusion at runtime can drive the same settings through @builtin::systems.ambientOcclusion.ao.