Culling and a sphere
I have a large sphere and alot of objects moving around it. When theese objects are behind the sphere they obviously don't need to be rendered. When I was making maps with Radiant there were theese things called portals, but since there now is a game called f-ing PORTAL I couldn't find anything when searching with that word. A day later I found out about "Occlusion Culling" and I played around a bit with that after reading some stuff.
This is how far i got with it: http://gfycat.com/DeepWindyLark
now the objects behind the sphere are still rendered until I get reeeeally close to my sphere. That's a start, but not my goal. I thought maybe it could work if I add a circular plane inside my sphere but that had no effect.
I really don't understand this topic that well and I'm out of ideas in how to search for some answers. I don't know if occlusion culling is the right way here, or if I am doing it wrong.
Answer by Statement · Nov 02, 2015 at 02:17 PM
First off, don't expect occlusion culling to be 100% perfect. Occlusion culling subdivides your scene into PVS and it could be useful to visualize the volumes to get a sense of how it works.
Secondly, moving objects need Occlusion Areas.
Try placing an Occlusion Area around your sphere.
If you haven't already, reading everything in the manual about occlusion culling is a start. If there are phrases or topics that you don't understand, figure out what those mean, and then read it over again.
If you want to make your own occlusion culling, you could also project the sphere into 2d viewspace together with the bounds of objects in the scene and turn off renderers if they are inside the 2d "flattened sphere". Note that it will not be a simple circle test because viewing from an angle will shear the shape. But I haven't thought long and hard on it, it's just what popped up in my head.
Occlusion Areas make it work, kind of. It's pretty hard to place theese areas around a sphere.
Is it bad to have a 'moving' and maybe even 'changing' Occlusion Area? I attached a single OA to my camera and it seems to be working. But I would also need to change the sizes of the OA, while moving the camera, to make it work completly (since a OA can't rotate).
I was under the impression that you'd put the OA to cover the sphere and generate cells, or possibly put several OAs around the surface of the sphere. I don't think OAs are supposed to be moved around, but I also don't know if it's ok to move them around. Generally when it comes to baked/cached/structures I assume that data has to be rebaked if parameters change. Try out what works and what not. Run the profiler and see if you get any performance warnings. (See profiler)
You can see the warning triangle on the right side in this screenshot from the manual. In that example, Crowd$$anonymous$$anager.Update does 12 things that are flagged as warning. Drilling down the tree would reveal which calls Unity flags warnings for.
I was under the impression that you'd put the OA to cover the sphere and generate cells
When I was looking at the pictures in the manual I thought that OAs don't work like that. I didn't even think of doing just one OA around the scene. Just tried that and it does the job perfectly. Now, as long as my camera is also inside the OA, objects behind the sphere disappear like they should.
http://gfycat.com/SkinnyEuphoricIslandcanary
Thank you very much, for the help!
ps: Unity Tech. please update that $$anonymous$$anual!
Your answer
Follow this Question
Related Questions
Light.layerShadowCullDistances not working 0 Answers
Occlusion culling rendersing through walls and objects (everything is static) 1 Answer
Is using multiple cameras, culling masks, and layers expensive on mobile? 1 Answer
How do you use "UnityEngine.Rendering.CullMode.Off"? 1 Answer
Is there a way for a camera to cull an object that doesn't have a MeshRenderer? 1 Answer