View Full Version : Stencil buffer for visibility

wis mak
08-09-2002, 02:57 AM

I'm coding a indoor rendering engine that uses portals to determine which sectors are visible from one sector.
I've come up with two approches:

Clip each sector and its objects to a narrowed view volume constructed from the viewer position and the portals inside the previous view volume, and send them in back-to-front order.

In the second approch I don't clip sectors and their objects to generated view volumes. Instead, I use them to only determine which sector is visible. Then I send each visible sector in front to back order to be clipped by the same view frustum, with stenciling enabled.

Which one seems to be faster assuming stenciling is done in hardware?


08-11-2002, 04:28 PM
I may be missing something here, but for option number 2, why would you need a stencil test at all? Wouldn't a depth buffer test be more natural and faster (hierarchical z-buffering and all)?

-- Zeno

wis mak
08-12-2002, 01:58 AM
Yeah, Z buffer is faster; but I have my sector details pre-sorted in a BSP, so enabling Z buffer while rendering each sector will make BSP an unnecessary overhead.