Entity culling via PVS #53

Open
opened 2026-03-21 06:40:05 +00:00 by kit · 0 comments
Owner

Frustum culling was disabled on SkinnedMesh entities (#52) because Three.js computes incorrect bounding spheres with our bone setup. Rather than trying to fix Three.js's frustum culling, we should implement server-side PVS (Potentially Visible Set) culling.

The Source engine already computes PVS per leaf — entities outside the viewer's PVS could be excluded from snapshots entirely, reducing both bandwidth and client-side rendering load.

Approach

  • Server determines the spectator camera's current BSP leaf (streamed from client or derived from player position)
  • Use the engine's PVS data to filter entities before building the snapshot
  • Entities outside the PVS get the ENT_FLAG_DORMANT flag or are omitted entirely
  • This replaces client-side frustum culling for entities, which is currently broken for skinned meshes

Benefits

  • Reduces snapshot size (fewer entities serialized)
  • Reduces client render load (fewer draw calls)
  • More correct than bounding-sphere frustum culling for indoor/occluded scenes
Frustum culling was disabled on SkinnedMesh entities (#52) because Three.js computes incorrect bounding spheres with our bone setup. Rather than trying to fix Three.js's frustum culling, we should implement server-side PVS (Potentially Visible Set) culling. The Source engine already computes PVS per leaf — entities outside the viewer's PVS could be excluded from snapshots entirely, reducing both bandwidth and client-side rendering load. ### Approach - Server determines the spectator camera's current BSP leaf (streamed from client or derived from player position) - Use the engine's PVS data to filter entities before building the snapshot - Entities outside the PVS get the `ENT_FLAG_DORMANT` flag or are omitted entirely - This replaces client-side frustum culling for entities, which is currently broken for skinned meshes ### Benefits - Reduces snapshot size (fewer entities serialized) - Reduces client render load (fewer draw calls) - More correct than bounding-sphere frustum culling for indoor/occluded scenes
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kit/gmod-web-stream#53
No description provided.