Room visibility culling

Of late I’ve been thinking about optimising the rendering of my levels, and one thing that comes to mind is region-culling. However, I’m not terribly familiar with such things, so I come here looking for advice. I have already performed a few searches–albeit no in-depth research yet–and find myself still uncertain.

For reference, I don’t intend large outdoor levels, but I do think that I have in mind some levels that are more complex than the old-fashioned room-and-corridor sort.

I’m aware that Panda3D provides portal-culling via the “PortalNode” class. However, I’ve seen some suggestions–including an old post by Josh Yellon, if I recall correctly–that portal culling might not be well-suited to scenes other than old-fashioned room-and-corridor levels. Further, I’ve seen it suggested in at least one post elsewhere that more-complex levels make the specification of portals time-consuming, tedious, and sometimes difficult. While I don’t intend large outdoor levels, I do have at least one level in mind that seems as though it might be tricky to make portals for.

I’ve considered some sort of grid-based approach: dividing my space into a 3D array of cells, with “room”-visibility being determined by which rooms have adjacent cells with the current “room”. However, I think that there are at least some cases in which this would fail–for example, imagine a level containing two rooms separated by an angled wall; if the wall isn’t sufficiently thick, one could quite easily end up with cells registered to one room being adjacent to cells registered to the other.

Another thought that I had was to compose large, simple, convex shapes and test whether objects lie within them (via the dot-product of a given shape’s face-normals with the offset vectors between the given object’s position and the centre of the face in question). These shapes would then be manually given a list of visible rooms. This might work, although I’m uncertain of the performance cost. Additionally, manually constructing these shapes and specifying their adjacency information seems likely to be time-consuming and tedious, as in portal-culling.

So, does anyone have any suggestions here?

Did you check out the two culling-related sample programs yet that were introduced in 1.9.1?

Sorry for the delay in response! ^^;;

Wow, I didn’t know that there were new samples at all in 1.9.1, let alone culling samples! Thank you for pointing them out! :slight_smile:

Hmm… So, do I take it then that you disagree with the above-mentioned criticisms of portal culling? How well does it apply to a level that’s less confined than the culling example? Think, for example, of a ruined city, its buildings often having large sections of floor or ceiling missing, producing rather large, uneven “windows” into what would presumably be other cells.

Looking at the portal-culling sample, how well does its method of finding the current cell scale to larger levels?