occlusion only rendering?

is there an out-of-the-box technique to render some geometry only in the Hi-Z pass. or otherwise write to the depth buffer to cut down on overdraw when there are lots of opacity masked pixels flying around?

We’re wrestling with large amounts of foliage draw, and the cost driver – on XB1, anyway, which is our min spec – is quad overdraw. Conventionally authored trees (eg, speedtree) are murder on perf because they use opacity masked cards in great profusion – thus, tons of overdraw…

One idea which I’ve been considering is doing an offline analysis of the contents of those masked quad and creating geometry which renders into the depth buffer as if solid, sitting at or just ‘behind’ the entirely opaque portions of the leaf cards.We’d still be rendering a lot redundant pixels up close, but more distant views should benefit from real opaque geometry. Plus i could selectively enlarge the occluders farther from the camera, increasing the effective opacity of the whole tree in lower LODs and cutting down on overdraw even more

How would one go about creating an occlusion only-shader? It doesn’t seem to be possible using the shader graph alone, unless I’m missing something. Would this be doable via a USF?

Hi Steve, you can take a look at the depth prepass (FDeferredShadingSceneRenderer::RenderPrePass) and see how it works if you want to add your own custom rendering pass, but it’s not for the faint of heart; it’s all on DepthRendering.h/.cpp. You’ll need to add your own drawing policy (which includes shaders), etc, but still has to work with the Material system, vertex factories, etc.

We don’t have a lot of documentation for that, you can read Pablo Zurita’s blog post as he describes a little how the policies work Optimizing sorting of base passes in Unreal Engine 4. | Pablo Zurita's blog