Hacker News new | ask | show | jobs
by immibis 763 days ago
I wrote a little engine with this capability a long time ago. I didn't know about the Build engine at the time. I divided the world into convex sectors and allowed arbitrary links (portals) instead of following a BSP tree. Rendering is front-to-back and clips at the portal boundary.

If you can rasterize the inside of a convex shape, you can rasterize a sector-portal-world by marking certain faces as portals, and when rendering one, setting the clipping region (or stencil buffer) to where the face would be, then rendering the sector behind it with an appropriate transformation (which is part of the portal's data, alongside the ID of the other sector).

Collisions through portals are much harder than rendering through portals.