Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
SSAO.hpp
1#pragma once
2
3#include "processing/BilateralBlur.hpp"
4#include "processing/BoxBlur.hpp"
5#include "resources/Texture.hpp"
6#include "resources/Buffer.hpp"
7#include "Common.hpp"
8
14class SSAO {
15
16public:
17
19 enum class Quality : int {
20 LOW = 0,
21 MEDIUM = 1,
22 HIGH = 2
23 };
24
33 SSAO(uint width, uint height, uint downscale, float radius, const std::string & name);
34
41 void process(const glm::mat4 & projection, const Texture& depthTex, const Texture& normalTex);
42
48 void resize(uint width, uint height);
49
53 void clear() const;
54
59 const Texture * texture() const;
60
64 float & radius();
65
69 Quality & quality();
70
71private:
78 Texture _noisetexture = Texture("SSAO noise");
79 float _radius = 0.5f;
80 uint _downscale = 1;
82};
Apply an approximate bilateral blur to a texture. This can be used to blur while preserving edges,...
Definition: BilateralBlur.hpp:13
Applies a box blur of fixed radius 2. Correspond to uniformly averaging values over a 5x5 square wind...
Definition: BoxBlur.hpp:12
Represents a group of shaders used for rendering.
Definition: Program.hpp:31
Computes screen space ambient occlusion from a depth and view-space normal buffer (brought to [0,...
Definition: SSAO.hpp:14
Program * _programSSAO
The SSAO program.
Definition: SSAO.hpp:76
void process(const glm::mat4 &projection, const Texture &depthTex, const Texture &normalTex)
Definition: SSAO.cpp:62
BoxBlur _mediumBlur
Medium quality blur.
Definition: SSAO.hpp:75
Texture _finalTexture
SSAO texture.
Definition: SSAO.hpp:73
Quality
Definition: SSAO.hpp:19
@ LOW
Bilinear upscaling.
@ HIGH
Bilateral blur.
@ MEDIUM
Approximate box blur and bilinear upscaling.
Texture _noisetexture
Random noise texture.
Definition: SSAO.hpp:78
BilateralBlur _highBlur
High quality blur.
Definition: SSAO.hpp:74
float _radius
SSAO intersection test radius.
Definition: SSAO.hpp:79
Quality & quality()
Definition: SSAO.cpp:117
Quality _quality
Quality of the upscaling/blurring.
Definition: SSAO.hpp:81
float & radius()
Definition: SSAO.cpp:113
void clear() const
Definition: SSAO.cpp:98
UniformBuffer< glm::vec4 > _samples
The 3D directional samples.
Definition: SSAO.hpp:77
Texture _ssaoTexture
SSAO texture.
Definition: SSAO.hpp:72
const Texture * texture() const
Definition: SSAO.cpp:109
void resize(uint width, uint height)
Definition: SSAO.cpp:103
uint _downscale
SSAO internal resolution downscaling.
Definition: SSAO.hpp:80
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
Represents a buffer containing uniform data, stored on the CPU and GPU. Depending on the update frequ...
Definition: Buffer.hpp:164