Screen-Space Ambient Occlusion in VTK 9.0

When rendering geometries in VTK, we can now achieve great results with the newly introduced PBR shading. We just have to configure properly lights, HDRI and materials. However, with complex surfaces like CAD models, something is clearly missing and the rendered image looks fake as illustrated in Figure 1.

Figure 1 – VTK rendering of a complex geometry using PBR shading


Our depth perception is highly sensitive to ambient occlusion. Holes, creases, concave surfaces are occluded by the surrounding geometry. This has to be taken into account when computing illumination. In VTK 9.0, we have added a new render pass called Screen-Space Ambient Occlusion (SSAO). This technique, introduced in 2007 by Crytek, is an efficient alternative to raytracing to approximate ambient occlusion. While only an approximation, it produces very plausible result in real-time. The Figure 2 shows a complex geometry (~3M cells) rendered at 150fps on a RTX 2060 GPU.

Figure 2 – The same geometry with SSAO enabled

In order to compute the ambient occlusion, the render pass modify the PolyDataMapper to save pixels positions and normals in new GPU textures. These textures are used by the SSAO algorithm in order to generate a new occlusion texture that can be combined to the color buffer. The algorithm is illustrated in Figure 3.

Figure 3 – Overview of the SSAO algorithm


In order to enable SSAO in VTK, it is necessary to create a custom render pass pipeline. Several parameters can be used to configure this render pass:

  • Radius: neighbor pixels considered when computing the occlusion
  • Bias: tolerance factor used when comparing pixel depth
  • KernelSize: number of samples used (controls the quality)
  • Blur: controls if occlusion buffer should be blurred before combining it with the color buffer.

An example of a simple render pass pipeline can be found below.

One Response to Screen-Space Ambient Occlusion in VTK 9.0

  1. Pingback: Jean M. Favre

Questions or comments are always welcome!