Combining Forward Render, HZBO and Masked materials

Hi all,

I’ve been optimizing our VR project for the last couple weeks, but today I thought I got a breakthrough when I tried running it on DX12 with HZBO, as that got us into the land of comfortably below 10 ms a frame. Now, the question isn’t DX12 relevant, DX11 has exactly the same behavior.

Unfortunately, seems like HZBO doesn’t work properly with masked materials (at least with the forward renderer, I’ll try changing to deffered just to see what happens, but we will definitely be staying in forward render).

Below is a video with the occluded elements visualized. As you can see, if when one disables HZBO, the occlusion culling works as it should, but as long as HZBO is enabled, half-transparent masked objects occlude stuff behind them. Unfortunately, hardware dynamic occlusion is a total performance killer with our draw call count.

The reason for trying to get it to work properly is that HZBO gets us roughly ~0.5ms on the GPU and ~2ms on the CPU in the heaviest cases, which is a lot when we’re hovering around ~10.5ms at GPU and ~9ms and aiming for the holy grail of stable 11.1ms.

We have a very specific scene, with the whole body composed of ~6k meshes, so we’re 100% draw-call bound. So when HZBO manages to eliminate ~20% of the draw calls at a cost of 0.3ms for building the HZB hierarchy, I’m very happy about that. But because of the weird interaction with masked materials, I’m back to using no occlusion culling at all.

I tried setting the meshes bUseAsOccluder to false, which had no effect. Also Tried setting the mesh bounds scale to 0.0f, also to no avail.

If anybody has any experience combining Forward Render, HZBO and Masked materials, any tips would be greatly appreciated!

Cheers, Tommy.