Last week I’ve been trying to improve on the occlusion culling in our game, since this not being setup correctly seems to be the heaviest in our game. After trying everything I could think of and readying almost every topic on occlusion culling I could find I’m now asking my question here, since I just can’t seem to be able to get it working as I expected.
The problem here is that It’s still trying to render almost all the object that are in that part of the scene, even though they’re not visible from the camera. Yes I’ve obviously made sure everything is static etc.
I wanted to ask again if someone could help with this problem. We’ve completely rebuild our level, including tools to make sure that all the settings for every object are setup correctly.
The problem still remains that a lot of object that are impossible to see are not being culled by the OC. Some stuff is but it’s mostly just acting as frustum culling right now…
It’s very hard to tell from the screnshots what the issue is.
Try going to the occlusion window and making sure the “Default parameters” button is clicked.
Your scene is layed out in a manner that makes OC useless. OC only works for large items that can block like walls and floors and ceilings. In your screenshots, there doesnt look like there’s anything that should be being culled.
You have 10,000 draw calls. Even if the OC was working, from the looks of it the game would still be unplayable. Im not an expert with optimizations, but I think the OC is least of your concerns right now.
I think you need LODs and simplified meshes and a reduction in materials.
I would focus on that first then focus on OC, even though I dont think OC will do much for your scene given the layout of the scene.
The first thing I would do is go into the 3d modeling software and agressively elimminate excess triangles with the expactation that OC cant be used in your particular scene. In Blender, it is called the Decimate modifier.
Another thing you can do, which wouldnt be that much work is to add a wall with a door through the middle of the greenhouse to act as the main occluder in the middle of the greenhouse. This would help guarantee that in the view you show, the last half of the greenhouse and meshes are culled.
Currently, (with the rebuild) we got the batches down to 3500 and the triangle count to 2-2.5 million, this probably could be lower but I’m working on that I must note that there are even more objects in the scene then before so we’re on the right track.
The thing with even these number is that probably more than half of it could (and should) be culled by the OC.
The rocks still have mesh colliders at this point, but do the objects really need colliders for the OC? All plants for example don’t have colliders but are culled correctly (in some areas).
I’ve tried multiple settings for the OC, including the standard settings but I just can’t seem to be able to get the desired results. There are unfortunately not many settings to play with…
Edit:
I did just test what happens if I disable everything I can’t see by hand and just noticed something strange: The lighting on the other side of the level changes when I disable these objects… I have no clue why but might this have something to do with it?
You don’t need colliders for the OC. (I deleted that part from my original post).
2M triangles is not that bad. The Unity manuals says the typical high-range triangle count is a few million for PC. So it should no longer be a problem for a PC.
IF your using GI, if you disable parts of the scene it might affect the lighting in other areas of the map because the light bouncing will change in the scene. That could explain why the lighting changes.
You could keep increasing the height of the rocks in the middle of the greenhouse until the OC does what you want it to do. I found that sometimes the visibility lines are not 100% accurate sometimes. You could have the OC system passing through a small hole even though the line is not visible in the editor (this has happened to me a few times)
We do have realtime GI enabled, but I had the feeling it was mainly the reflection that changed (look at the reflections in the glass on the right side, which should only reflect the skybox).
Anyway, I tried a couple of different settings again and keep getting the same result. The OC just seems to ignore most of my rocks. I hope these screenshots will give a better image of what it’s doing.
And to show you, these walls are solid rocks going from the floor to the top of our level. (although they are made up of different rock peaces). There’s just 2 tunnels to go through.
I had this probolem in my game,finally I fixed it
The problem is that I didnt creat OC area in my scenc(I use default),this leads to my main camera is not in the OC back Area(the yellow cube).
so I create one OC area and include the main camera…
this is actually true, i have this problem too i just tried to figured it out for 3 hours, I fount my problem which is I dont actually bake my object instead only the scene, so what i have to do is I select all the object (the object which is static ocluded, etc) and baked them while all are selected. I tried it but it still doesnt work until I reduce the amount of "smallest occluder and the amount of smallest hole until it get smaller (I reduce those numbers) and re-baked my object back and it finally works
Same problem here, OC has always worked but when I look through my glass I can see things behind it. So I can see through to other parts of the level , very weird. Any ideas? Ive never needed an OC area before.
edit: actually it does work if I put a large cube behind the window and turn off mesh renderer. I wasnt making it large enough before.