#include <ssao.hpp>
|
| SSAO (float rad=1.0) |
| Default constructor. More...
|
|
virtual void | initialize (void) |
| Initializes the SSAO effects,. More...
|
|
void | createViewSpaceBuffer (Tucano::Mesh &mesh, const Tucano::Camera &camera_trackball, const Tucano::Camera &light_trackball) |
| First pass of the SSAO, writes coords, normals and colors to a buffer. More...
|
|
void | computeSSAO (const Tucano::Camera &camera) |
| Compute the Ambient Occlusion factor for each pixel. More...
|
|
void | applySSAO (const Tucano::Camera &light_trackball) |
| Blur SSAO result and mix with original render. More...
|
|
virtual void | render (Tucano::Mesh &mesh, const Tucano::Camera &camera_trackball, const Tucano::Camera &light_trackball) |
| Renders the mesh with the desired effect. More...
|
|
int | getIntensity (void) |
| Get intensity value. More...
|
|
void | setIntensity (int value) |
| Set intensity value. More...
|
|
int | getRadius (void) |
| Get radius value. More...
|
|
void | setRadius (int value) |
| Set radius value. More...
|
|
void | setScale (int value) |
| Set global scale value. More...
|
|
void | setBlurRange (int value) |
|
void | toggleAmbientPass (void) |
| Toggles the displayAmbientPass flag. More...
|
|
| Effect (string shadersDir="shaders/") |
| Default constructor. More...
|
|
virtual Shader * | loadShader (string shader_name) |
| Loads a shader by filename, initializes it, and inserts in shaders list. More...
|
|
virtual void | loadShader (Shader &shader, string shader_name) |
|
virtual Shader * | loadShader (string shader_name, string vertex_name, string frag_name, string geom_name) |
| Loads a shader by complete filenames (with extensions), initializes it, and inserts in shaders list. More...
|
|
void | setShadersDir (string dir) |
|
virtual void | reloadShaders (void) |
| Reloads all shaders needed for effect usage. More...
|
|
Screen Space Ambient Occlusion effect class. Handles the pre-computations needed in order to use this effect, as well as handles the rendering with this effect.
Based on http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-simple-and-practical-approach-to-ssao-r2753
Tucano::Effects::SSAO::SSAO |
( |
float |
rad = 1.0 | ) |
|
|
inline |
Default constructor.
- Parameters
-
rad | The kernel radius. This is used to define the max distance between the current point and the samples that will be considered for occlusion computation. |
void Tucano::Effects::SSAO::applySSAO |
( |
const Tucano::Camera & |
light_trackball | ) |
|
|
inline |
Blur SSAO result and mix with original render.
- Parameters
-
light_trackball | A pointer to the light trackball object. |
void Tucano::Effects::SSAO::computeSSAO |
( |
const Tucano::Camera & |
camera | ) |
|
|
inline |
Compute the Ambient Occlusion factor for each pixel.
First pass of the SSAO, writes coords, normals and colors to a buffer.
- Parameters
-
mesh | Mesh to be rendered. |
camera_trackball | A pointer to the camera trackball object. |
light_trackball | A pointer to the light trackball object. |
int Tucano::Effects::SSAO::getIntensity |
( |
void |
| ) |
|
|
inline |
Get intensity value.
- Returns
- Intensity value.
int Tucano::Effects::SSAO::getRadius |
( |
void |
| ) |
|
|
inline |
Get radius value.
- Returns
- Radius value.
virtual void Tucano::Effects::SSAO::initialize |
( |
void |
| ) |
|
|
inlinevirtual |
Initializes the SSAO effects,.
generating the sample kernel, creating and loading the shaders and generating the noise texture.
Implements Tucano::Effect.
void Tucano::Effects::SSAO::initializeShaders |
( |
void |
| ) |
|
|
inlineprivate |
Creates and loads all shaders.
Renders the mesh with the desired effect.
The algorithm has three passes:
- compute buffer with coords, normals and color per pixel
- compute AO per pixel
- blur the final result An option to pass an output buffer is available in case of offline rendering. For example, when taking snapshots of the current result.
- Parameters
-
mesh | Mesh to be rendered. |
camera_trackball | A pointer to the camera trackball object. |
light_trackball | A pointer to the light trackball object. |
void Tucano::Effects::SSAO::setBlurRange |
( |
int |
value | ) |
|
|
inline |
void Tucano::Effects::SSAO::setIntensity |
( |
int |
value | ) |
|
|
inline |
Set intensity value.
- Parameters
-
value | New intensity value. |
void Tucano::Effects::SSAO::setRadius |
( |
int |
value | ) |
|
|
inline |
Set radius value.
- Parameters
-
void Tucano::Effects::SSAO::setScale |
( |
int |
value | ) |
|
|
inline |
Set global scale value.
- Parameters
-
void Tucano::Effects::SSAO::toggleAmbientPass |
( |
void |
| ) |
|
|
inline |
Toggles the displayAmbientPass flag.
bool Tucano::Effects::SSAO::apply_blur = true |
|
protected |
Flag indicating wether blur shall be applied or not.
int Tucano::Effects::SSAO::blurRange = 3 |
|
protected |
Number of neighbour pixels used in blurring. The blur will be applied to a blurRange x blurRange square around the current pixel. It's important to notice that blurRange must be an odd number.
int Tucano::Effects::SSAO::blurTextureID = 4 |
|
protected |
The ID defining the color attachment to which the blur texture is bound in the framebuffer.
int Tucano::Effects::SSAO::colorTextureID = 2 |
|
protected |
The ID defining the color attachment to which the color texture is bound in the framebuffer.
Save coord, normal and color to FBO.
int Tucano::Effects::SSAO::depthTextureID = 0 |
|
protected |
The ID defining the color attachment to which the depth texture is bound in the framebuffer.
bool Tucano::Effects::SSAO::displayAmbientPass = false |
|
protected |
Flag indicating if the mesh should be rendered only with ambient occlusion pass or with full illumination. If True, mesh will be rendered only with the ambient occlusion pass.
float Tucano::Effects::SSAO::global_scale = 1.0 |
|
protected |
int Tucano::Effects::SSAO::intensity = 1 |
|
protected |
int Tucano::Effects::SSAO::normalTextureID = 1 |
|
protected |
The ID defining the color attachment to which the normal texture is bound in the framebuffer.
A quad mesh for framebuffer rendering.
float Tucano::Effects::SSAO::radius |
|
protected |
Kernel radius. If the distance between a sample point and the point for which the occlusion is being computed is larger than radius, the occlusion for this sample will be neglected.
Join original render with SSAO (blur it first)
The per pixel AO computation shader.
int Tucano::Effects::SSAO::ssaoTextureID = 3 |
|
protected |
The ID of the color attachment holding the SSAO result.
The documentation for this class was generated from the following file: