marian42/wavefunctioncollapse

Help: Occlusion Culling for multiple cameras

jackwallace42 opened this issue · 1 comments

This is really cool, I've been tinkering with the map generation to use it in a multiplayer (splitscreen) game - wondering if you could provide any insights on how I might be able to get the occlusion culling to work with multiple cameras (players) in the game world? I'm pretty new to unity so even a nudge in the right direction would be helpful! Cheers.

The first thing to try would be to disable occlusion culling. It trades a small amount of rendering time for a small amount of CPU time. So you might be just fine without it. You can do this by disabling the "Occlusion Culling" behaviour on the Map object.

If you want to adapt the system to work with multiple cameras, you'll need to change how it applies visibility. Currently it does so by disabling the renderers and by changing renderer.shadowCastingMode (in Chunk.SetExteriorVisibility and Chunk.SetInteriorVisibility. As far as I know, this doesn't work with mulitple cameras because you can't change it in between the first and second camera render. You could instead use layers for objects that are visible to one camera, the other, both or none. Maybe there is a way to interface with Unity's built in occlusion culling system, if so, that would be a better way to do it, but I don't know how that works.
You also need to modify the OcclusionCulling.Update so that it does what it currently does with this.Camera for multiple cameras.