WMOs can be a real drag on performance, mostly because of draw calls and object projections stemming from their (at times hefty) doodad sets. We should implement portal culling using the portal data baked in to the WMO files. This also benefits rendering performance when inside a WMO such that the overworld is no longer visible.
Progress
[ ] Create WMOPortal class
Portal culling will require some helper functions to project a frustum out of a given portal, as well as intersect that frustum with other portals. To keep the traversal function as clean as possible, we should create a class to abstract away some of this portal logic.
[ ] Extend WorldRenderer with culling functions
We'll want to start the culling operation from the camera's current location relative to culling structures. If the camera is in the overworld, culling should begin at all exterior-flagged WMOGroups, and progress from there. If the camera is inside a specific WMOGroup, culling should begin in that group, and progress through all visible portals within that group.
[ ] Locate the camera in either the overworld or specific WMOs / WMOGroups
We can probably use the BSP tree baked in to the files for this.
Details
CWorldView::s_portalMaxDepth = 12
seems to be the maximum levels of recursion allowed before portal traversal halts
WMOs can be a real drag on performance, mostly because of draw calls and object projections stemming from their (at times hefty) doodad sets. We should implement portal culling using the portal data baked in to the WMO files. This also benefits rendering performance when inside a WMO such that the overworld is no longer visible.
Progress
WMOPortal
class Portal culling will require some helper functions to project a frustum out of a given portal, as well as intersect that frustum with other portals. To keep the traversal function as clean as possible, we should create a class to abstract away some of this portal logic.WorldRenderer
with culling functions We'll want to start the culling operation from the camera's current location relative to culling structures. If the camera is in the overworld, culling should begin at all exterior-flaggedWMOGroup
s, and progress from there. If the camera is inside a specificWMOGroup
, culling should begin in that group, and progress through all visible portals within that group.WMO
s /WMOGroup
s We can probably use the BSP tree baked in to the files for this.Details
CWorldView::s_portalMaxDepth = 12