Builtin Library
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.
| field | effect |
|---|---|
technique | ssao | hbao | gtao. The three cost the same taps and are scaled to agree on a right-angle corner. |
intensity | How far the darkening goes, in [0, 1]. 0 is off. |
radius | World-space reach of the occlusion. |
power | Contrast curve on the visibility term. Above 1 deepens the dark end. |
thickness | World-space thickness assumed for an occluder. |
bias | How far a neighbour must rise above the surface before it counts as an occluder, in [0, 1]. |
quality | low | 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.