Overview
Completed for a Graphics 2 midterm with Scott Dagen, this is a custom implementation of a dynamically-enabled rendering pipeline in Animal3D that implements the Crysis screen-space ambient occlusion algorithm. Animal3D is a C-based rendering framework build by Professor Dan Buckstein of Champlain College, and we use that as our base for this project, simply adding our own pipeline. Here is our Github Link for the project's source code.
Responsibilities
Since this was a partner project, we did split up some of the tasks, as it included more than just SSAO. Scott handled part of the frame-buffer object setup, as well as a "cross-hatch" shader that was simply an extension of this main pipeline we developed. I took care of the SSAO shader itself, as well as the kernel, noise generation, and the actual pipeline algorithm itself.
Implementation
We followed the 2007 Crysis algorithm for SSAO, outlined here. To implement this algorithm inside of Animal3D, we had to add a brand new pipeline for rendering the scene, which uses deferred shading & lighting so that we can get access to the scene data prior to lighting, so that we can utilize the above SSAO output in our lighting calculations.
Here's our implementation of the pipeline algorithm itself:
Bind depth, position, and normal G-buffers to our deferred SSAO set of shaders
Activate & send generated vector noise texture, as well as a generated 3x3 convolution kernel
Draw raw SSAO output to a full-screen quad
Use a horizontal Gaussian blur to obscure some of the repetitive noise imprints
Use a vertical Gaussian blur to obscure the rest of noise imprints & output to a final FBO.
Apply SSAO sample during final Phong lighting calculation
Fig. 1: Frame-Buffer Objects used for SSAO pipeline (read & write), includes post-processing passes
Fig. 2: SSAO kernel generation & random vector noise texture generation
Results
Fig. 3: Final SSAO map output after both blur stages, generated in real time
Our SSAO implementation is both accurate and adjustable, as we can adjust the strength of our occlusion factor at two different points, resulting in tons of different looks.
Comments