Hi everyone,
I've written a simple PVS (potential visibility set) system for a game I'm working on. It works fine but I'm concerned about efficiency so I'd like to run past you what I've done and see if there are better ways of doing it..
The way it works is pretty standard for a PVS...
1) The game world is divided into a 2D grid of cells
2) I have an offline tool which for each cell works out which objects in the scene are potentially visible (by ray casting many rays to evey object which takes quite a long time but because it's an offline tool it doesn't impact game play)
3) when the game runs it calculates which cell the player camera is currently in and thus knows which objects are visible and which are not.
4) Then what I do (and this is where I'm not sure about efficiency) is to disable all objects which are not visible and enable all objects which are). I only do this when the player changes cells.
The system works fine but I'm concerned that disabling and enabling the objects might not be the best way to do things. It seems to me that each PVS cell contains a list of all objects which I want to render so theoretically I could remove all objects which are in the PVS from the standard Unity rendering system and instead itterate through the PVS list rendering only those objects. I'm not sure this is possible though. Anyone know if it is or how best to do this? The game runs in a web browser so plug ins are not an option.
regards,
Tony Oakden