All Projects → nvpro-samples → Gl_ssao

nvpro-samples / Gl_ssao

Licence: other
optimized screen-space ambient occlusion, cache-aware hbao

Projects that are alternatives of or similar to Gl ssao

Pyopencl
OpenCL integration for Python, plus shiny features
Stars: ✭ 790 (+259.09%)
Mutual labels:  nvidia, opengl
Gl cadscene rendertechniques
OpenGL sample on various rendering approaches for typical CAD scenes
Stars: ✭ 116 (-47.27%)
Mutual labels:  nvidia, opengl
Awesome Vulkan
Awesome Vulkan ecosystem
Stars: ✭ 2,322 (+955.45%)
Mutual labels:  nvidia, opengl
Engine
A basic cross-platform 3D game engine
Stars: ✭ 208 (-5.45%)
Mutual labels:  opengl
Libagar
Cross-Platform GUI Toolkit (stable)
Stars: ✭ 212 (-3.64%)
Mutual labels:  opengl
Ios Gpuimage Plus
GPU accelerated image filters for iOS, based on OpenGL.
Stars: ✭ 217 (-1.36%)
Mutual labels:  opengl
Jetson easy
🔩 Automatically script to setup and configure your NVIDIA Jetson [Nano, Xavier, TX2i, TX2, TX1, TK1] . This script run different modules to update, fix and patch the kernel, install ROS and other...
Stars: ✭ 219 (-0.45%)
Mutual labels:  nvidia
Aveditor
这是一款短视频编辑 SDK,仿 DouYin 音视频处理。功能包含有美颜、滤镜、贴纸、特效、录制、分段录制、速率录制、变声、配乐、rtmp 直播推流、图片转视频、剪辑,mp4/flv 格式封装等功能。动态库用的我另一个项目编译好的 https://github.com/yangkun19921001/AVFFmpegLib
Stars: ✭ 209 (-5%)
Mutual labels:  opengl
Raspberry Pi
My public Baremetal Raspberry Pi code
Stars: ✭ 218 (-0.91%)
Mutual labels:  opengl
Etlegacy
ET: Legacy is an open source project based on the code of Wolfenstein: Enemy Territory which was released in 2010 under the terms of the GPLv3 license.
Stars: ✭ 212 (-3.64%)
Mutual labels:  opengl
Glrippleview
Custom GLSurfaceView for Android to show image with ripple effect using OpenGL.
Stars: ✭ 216 (-1.82%)
Mutual labels:  opengl
Csfml
Official binding of SFML for C
Stars: ✭ 211 (-4.09%)
Mutual labels:  opengl
Skui
Skia-based C++ UI framework
Stars: ✭ 218 (-0.91%)
Mutual labels:  opengl
Saba
OpenGL Viewer (OBJ PMD PMX)
Stars: ✭ 208 (-5.45%)
Mutual labels:  opengl
Relion
Image-processing software for cryo-electron microscopy
Stars: ✭ 219 (-0.45%)
Mutual labels:  nvidia
Jetson Nano Baseboard
Antmicro's open hardware baseboard for the NVIDIA Jetson Nano and Jetson Xavier NX
Stars: ✭ 209 (-5%)
Mutual labels:  nvidia
Nicehashquickminer
Super simple & easy Windows 10 cryptocurrency miner made by NiceHash.
Stars: ✭ 211 (-4.09%)
Mutual labels:  nvidia
Genomeworks
SDK for GPU accelerated genome assembly and analysis
Stars: ✭ 215 (-2.27%)
Mutual labels:  nvidia
Nvidia Clerk
A cross-platform go bot that tracks for availability of stock from Nvidia's store and adds a cart to your checkout.
Stars: ✭ 214 (-2.73%)
Mutual labels:  nvidia
Glhf
openGL Have Fun - A Go package that makes life with OpenGL enjoyable.
Stars: ✭ 217 (-1.36%)
Mutual labels:  opengl

gl ssao

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.

sample screenshot

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:

  • To achieve the effect a 4x4 texture that contains random directions is tiled across the screen and used to sample the neighborhood of a pixel's depth values.
  • The distance of the sampling depends on a customize-able world-size radius, for which the depth-buffer values are typically linearized first.
  • As the sampling radius depends on the pixel's depth, a big variability in the texture lookups can exist from one pixel to another.
  • To reduce the costs the effect can be computed at lower-resolution and up-scaled for final display. As AO is typically a low-frequency effect this often can be sufficient.
  • Dithering artifacts can occur due to the 4x4 texture tiling. The image is blurred using cross-bilateral filtering that takes the depth values into account, to further improve quality.

HBAO - Cache-Aware:

  • The performance is vastly improved by grouping all pixels that share the same direction values. This means the screen-space linear depth buffer is stored in 16 layers each representing one direction of the 4x4 texture. Each layer has a quarter of the original resolution. The total amount of pixels is not reduced, but the sampling is performed in equal directions for the entire layer, yielding better texture cache utilization.
  • Linearizing the depth-buffer now stores into 16 texture layers.
  • The actual HBAO effect is performed in each layer individually, however all layers are independent of each other, allowing them to be processed in parallel.
  • Finally the results are stored scattered to their original locations in screen-space.
  • Compared to the regular HBAO approach, the efficiency gains allow using the effect on full-resolution, improving the image quality.

MSAA support:

  • The effect is run on a per-sample level N times (N matching the MSAA level).
  • For each pass glSampleMask( 1 << sample); is used to update only the relevant samples in the target framebuffer.

Blur:

  • A cross-bilteral blur is used to eliminate the typical dithering artifacts. It makes use of the depth buffer to avoid smoothing over geometric discontinuities.

sample screenshot

Performance

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;

Sample Highlights

The user can change MSAA settings, blur settings and other parameters.

Key functionality is found in

  • Sample::drawHbaoClassic()
  • Sample::drawHbaoCacheAware()

As well as in helper functions

  • Sample::drawLinearDepth()
  • Sample::drawHbaoBlur()

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.

Building

Ideally clone this and other interesting nvpro-samples repositories into a common subdirectory. You will always need shared_sources and on Windows shared_external. The shared directories are searched either as 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.

Providing Pull Requests

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:

  • A pull request provided to this repo by a developer constitutes permission from the developer for NVIDIA to merge the provided changes or any NVIDIA modified version of these changes to the repo. NVIDIA may remove or change the code at any time and in any way deemed appropriate.
  • Not all pull requests can be or will be accepted. NVIDIA will close pull requests that it does not intend to merge. The modified files and any new files must include the unmodified NVIDIA copyright header seen at the top of all shipping files.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].