SuzanneIsland: An island of Real-time rendering effects!
|
The SSAOEffect class facilitates Screen Space Ambient Occlusion using a two pass rendering pipeline, where in the first pass the screen colors and other information are rendered to textures to allow for postprocessing, and in the second pass the postprocessed texture is rendered to a screen filling quad. More...
#include <ssao_effect.h>
Public Member Functions | |
SSAOEffect (int windowWidth, int windowHeight, int samples_) | |
void | setupFramebuffers (int windowWidth, int windowHeight) |
setup framebuffers and their screen filling texture or renderbuffer attachments More... | |
void | bindScreenDataFramebuffer () |
bind framebuffer in which screen colors and view space vertex positions should be stored for ssao postprocessing. More... | |
void | calulateSSAOValues (const glm::mat4 &projMat) |
calulate the resulting ssao factors for each fragment and store it in a texture attached to the fboSSAO More... | |
void | bindSSAOResultTexture (GLint ssaoTexShaderLocation, GLuint textureUnit) |
bind the texture which stores the ssao results after calulateSSAOValues to given shader locaton and texture unit More... | |
void | blurSSAOResultTexture () |
The SSAOEffect class facilitates Screen Space Ambient Occlusion using a two pass rendering pipeline, where in the first pass the screen colors and other information are rendered to textures to allow for postprocessing, and in the second pass the postprocessed texture is rendered to a screen filling quad.
SSAOEffect::SSAOEffect | ( | int | windowWidth, |
int | windowHeight, | ||
int | samples_ | ||
) |
SETUP SCREEN FILLING QUAD setup vao for the screen quad onto which the screen texture will be mapped.
SETUP FRAMEBUFFERS setup framebuffers with texture or renderbuffer objects as attachments
SETUP SSAO SHADER compile shader programs and pass random vectors to ssao shader used for depth sampling. other uniforms are passed to ssao shader each frame and are not included here.
void SSAOEffect::bindScreenDataFramebuffer | ( | ) |
bind framebuffer in which screen colors and view space vertex positions should be stored for ssao postprocessing.
after binding this, execute the required draw calls using appropriate shaders.
void SSAOEffect::bindSSAOResultTexture | ( | GLint | ssaoTexShaderLocation, |
GLuint | textureUnit | ||
) |
bind the texture which stores the ssao results after calulateSSAOValues to given shader locaton and texture unit
ssaoTexShaderLocation | the shader location |
textureUnit | the texture unit |
void SSAOEffect::calulateSSAOValues | ( | const glm::mat4 & | projMat | ) |
calulate the resulting ssao factors for each fragment and store it in a texture attached to the fboSSAO
projMat | the projection matrix to use in the render pipeline this needs certain information rendered to textures after binding via the bindScreenDataFramebuffer. |
void SSAOEffect::setupFramebuffers | ( | int | windowWidth, |
int | windowHeight | ||
) |
setup framebuffers and their screen filling texture or renderbuffer attachments
windowWidth | buffer width |
windowHeight | buffer height |