How to implement occlusion culling in OpenGL ES?

How to implement occlusion culling in OpenGL ES?

This sample will show you how to efficiently implement occlusion culling using compute shaders in OpenGL ES 3.1. The sample tests visibility for a large number of instances in parallel and only draws the instances which are assumed to be visible. Using this technique can in certain scenes give a tremendous performance increase.

When to use MDI for OpenGL culling?

The MDI technique works well with a simplified scene setup where all geometry is stored in one big VBO/IBO pairing and no shader changes are done in between. This approach can be enhanced with GL_ARB_indirect_parameters, which allows to source the number of drawcalls from the GPU as well.

When to copy the GL Occlusion Culling results?

The occlusion culling results should be copied after doing the occlusion-tests and ideally before doing any post-processing, this way we can reduce the wait time on the client. MultiDrawIndirect GPU: This technique leverages the GL_ARB_multi_draw_indirect and is free of synchronization.

How is the culling done in OpenGL nvpro?

The culling itself is implemented in the cullingsystem.cpp/hpp files. It uses SSBO to store the results. The results are always packed into bit-arrays to minimize traffic in the read-back case and maximize cache hits. Frustum: Just a simple frustum culling approach, this could probably done efficiently on the CPU using SIMD as well.

How to calculate depth in OpenGL ES 3.1?

In OpenGL ES 3.1, we can use the new textureGather () function to obtain all four depth values in a quad in one texture lookup. For reference, there are some sample depth maps below which are mipmapped using this approach. By rendering scene depth to a lower resolution than the actual scene we do risk falsely culling instances.

What is the hierarchical-Z visibility test in OpenGL?

Hierarchical-Z Visibility Test The Hierarchical-Z visibility test is implemented here as a single compute shader. It will read a buffer of bounding volumes represented as bounding spheres or bounding boxes and output a tightly packed instance buffer as well as a counter for the number of elements in the buffer.

How is occlusion culling used in Compute Shaders?

Occlusion culling is essentially a filtering operation. From a set of data, we include elements in the filtered set based on a condition. Before going into the particular occlusion culling technique, it’s useful to look at filtering data with compute shaders in general.