Builtin Library
README.md
EdgeAntiAliasing
The scene's edge antialiasing. Add it to an entity and the staircase along a high-contrast silhouette becomes a gradient, while the flat regions on either side of it are left as they were.
local id = entity.spawn("antialiasing").id
entity(id).component.add("EdgeAntiAliasing", { edgeThreshold = 0.125 })
Every field is live — editing one in the inspector changes the result on the next
frame, and the values persist with the scene. Removing the last one in the scene
clears the pass. antiAliasing.disable() turns the pass off where no component
states it; while one stands in the scene, it brings the pass back.
| field | effect |
|---|---|
edgeThreshold | How much a pixel's luminance must differ from its neighbours', as a fraction of the brightest of them, before it counts as an edge. |
edgeThresholdMin | The absolute floor under that test, which keeps the pass off dark areas. |
subpixel | How strongly features finer than one pixel are corrected. |
searchSteps | How far the pass walks along an edge looking for its end. |
Lowering edgeThreshold catches fainter edges and costs more; raising it leaves
softer edges alone. searchSteps is the other cost knob — it bounds how long an
edge the pass can resolve.
One pass covers the whole frame, so one of these per scene is enough — the last one to push wins.
The work runs in fxaa.renderFeature; the settings live in
@builtin::systems.antiAliasing.antiAliasing, which is also how to drive them
from a script.