Builtin Library
README.md
isolate
Show the subject without the other geometry drawn, then put everything back.
A prop inside a built scene is behind whatever stands in front of it. The render-layer system already expresses "draw only these" — an entity is a member of layers, a camera renders a filter over them — but it does not remember what it displaced, so every caller wanting one clean shot of one thing hand-rolls the same record, swap and restore. This is that, once, with the restore guaranteed.
What it changes
Exactly one thing: the other geometry is not drawn.
Sky, post-process and UI are left exactly as the capture's own render-layer spec
stated them, so a final frame stays a final frame. A caller who wants the
geometry read flat — no lighting, no atmosphere — asks for a pass
(pass = "albedo", pass = "normal"), which is what passes are for.
What it does not change
Excluded geometry still casts shadows onto the subject and still bounces light into it. Lights are not filtered by render layer at all, and the layer mask drives object culling and the geometry passes rather than the shadow passes. This is the render-layer system's deliberate behaviour — a wall stays out of the shot while it still exists for lighting, shadows and physics — so a shadow with no visible caster in an isolated capture is the system working, not a bug.
The layer
One reserved layer name, captureIsolate, reused by every isolated capture.
Membership is a 32-bit mask with six reserved bits. A layer minted per call would
exhaust the namespace in twenty-six captures and leave a trail of empty layers
that renderLayer.list would show forever.
Restoring
begin records each affected entity's membership before moving anything, so the
token describes the whole subtree even if the move fails part-way. restore
puts every entity back to the layers it carried — and an entity that carried
no explicit membership ends with none, rather than an explicit default that
looks identical in a picture and different in the data.
restore is safe to call twice and safe on a token whose subjects have since
despawned, which is what lets a caller restore unconditionally on every exit
path: success, failure, and once around a whole collage grid rather than between
its cells.