To kick off my question: Is Foliage/HISM broken when it comes to occlusion culling?
I’m running into performance issues inside my game which I’m almost certain boils down to the foliage we’re playing in our maps. After doing some digging I was noticing that when we were in subsections of our map, if I were to FreezeRendering
and leave what is essentially a closed off area, I would notice that any foliage that was not frustum culled was being shown; no occlusion culling was affecting it.
Note: It’s worth mentioning that using distance culling would not be an optimal solution here because the issue isn’t that the items are too far, it’s that they’re supposed to be occluded but still being rendered, and it may be possible to see a few of the foliage items.
I ended up creating a test scene to try to figure out perhaps what may be happening under the hood (without digging deep into UE source). I created a little bubble that I can toggle on and off to test occlusion; works 100% as expected with static meshes, and single instanced HISMs, but once I start introducing multiple instances of a HISM, occlusion culling seems to break under several circumstances.
I have a test where I am using two different barrels in the foliage system.
-
Instances on multiple landscape sections:
In this test I have one barrel each in a different section of the landscape. If I’m looking at both sections, the occlusion culling seems to work just fine.
If I rotate my camera to where we no longer see the section the occlusion culling stops working for all instances and only frustum culling seems to work.
At this time (I assume) since the section is currently not being displayed, the entire HISM stops occlusion culling. If I were toFreezeRendering
and hide my sphere, we will see that barrel there, however the other barrel would still be invisible (since it was frustum culled) -
If the camera is inside of the bounds of an HISM, it will never utilize occlusion culling.
In this test I have a barrel in front and a barrel behind the player, thus the camera is inside of the bounds.
When I turn on my sphere to block the visibility of the barrels, I notice that no occlusion culling is happening, and I assume that’s because of the camera’s location to the HISM bounds.
If I were to nowFreezeRendering
and hide the sphere, that barrel would still be visible.
At this point I’m unsure how to address this without having to go into the C++ even deeper and understand the whys behind these. I have to imagine there’s a reason to occlusion culling may not be supported, but I cannot believe that a foliage system would essentially be showing all your trees even if it were being blocked by say a wall, a mountain, etc. Our world is fairly large, which means if we look in certain areas we are rendering a large chunk of our foliage, because it spans the map in all directions (thus we’re always inside the bounds, which AFAIK will only utilize frustum culling, and no occlusion culling.
Does anyone have any solutions and/or even workarounds? One workaround I thought was creating foliage in little groups all over the map so their bounds don’t extend the whole map, but as far as I can see there’s not really a way to separate out foliage, unless I’m missing something?
Thank you very much in advance.