optimized screen-space ambient occlusion, cache-aware hbao
This sample implements screen space ambient occlusion (SSAO) using horizon-based ambient occlusion (HBAO). You can find some details about HBAO here. It provides two alternative implementations the original hbao as well as an enhanced version that is more efficient in improved leveraging of the hardware's texture sampling cache, using de-interleaved texturing.
Note: This sample provides an improved HBAO algorithm, however it is not same as HBAO+ which is part of NVIDIA ShadowWorks and improves the quality and performance of the algorithm further.
HBAO - Classic:
HBAO - Cache-Aware:
MSAA support:
Blur:
The cache-aware technique pays off on larger AO radii or higher resolutions (full HD).
Timings in microseconds via GL timer query taken on a Quadro M6000, no MSAA, 1080p (sample default is 720p, which may give less difference between the two).
Classic
Timer ssao; GL 2434;
Timer linearize; GL 54;
Timer ssaocalc; GL 2177;
Timer ssaoblur; GL 198;
Cache-Aware
Timer ssao; GL 1264;
Timer linearize; GL 55;
Timer viewnormal; GL 76;
Timer deinterleave; GL 93;
Timer ssaocalc; GL 762;
Timer reinterleave; GL 100;
Timer ssaoblur; GL 167;
The user can change MSAA settings, blur settings and other parameters.
Key functionality is found in
As well as in helper functions
The sample contains alternate codepaths for two additional optimizations, which are enabled by default.
USE_AO_SPECIALBLUR
: Depth is stored with the ssao calculation, so that the blur can use a single instead of two texture fetches, which improves performance.USE_AO_LAYERED_SINGLEPASS
: In the cache-aware technique we update the layers of the ssao calculation all at once using image stores and attachment-les fbo or a geometry shader with layers, instead of rendering to each layer individually.Ideally, clone this and other interesting nvpro-samples repositories into a common subdirectory. You will always need nvpro_core. The nvpro_core is searched either as a subdirectory of the sample, or one directory up.
If you are interested in multiple samples, you can use build_all CMAKE as entry point, it will also give you options to enable/disable individual samples when creating the solutions.
NVIDIA is happy to review and consider pull requests for merging into the main tree of the nvpro-samples for bug fixes and features. Before providing a pull request to NVIDIA, please note the following: