portal-stencil-buffer-scenes

Installation
SKILL.md

Stencil Buffer Portal Scenes

What this builds

A portal system where an arbitrarily shaped surface acts as a hole into a completely separate 3D world. The portal contents render at full framebuffer resolution with correct per-pixel depth, so objects can protrude through the opening and multiple portals can be on screen simultaneously without any of them costing a texture allocation.

  • Arbitrary portal shape, defined by geometry rather than a rectangle
  • Full native resolution, no render target, no DPR mismatch
  • Correct depth interaction between the two worlds at the portal plane
  • Multiple independent portals in one frame, each with its own world
  • Objects that straddle the boundary, half in each world
  • Backface handling so the portal disappears when viewed from behind

When to use / when not to

Installs
2
First Seen
Aug 30, 2026
portal-stencil-buffer-scenes — avnehsbhatia/ultraui