Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
SSAO Class Reference

Computes screen space ambient occlusion from a depth and view-space normal buffer (brought to [0,1]). More...

#include <SSAO.hpp>

Public Types

enum class  Quality : int { LOW = 0 , MEDIUM = 1 , HIGH = 2 }
 

Public Member Functions

 SSAO (uint width, uint height, uint downscale, float radius, const std::string &name)
 
void process (const glm::mat4 &projection, const Texture &depthTex, const Texture &normalTex)
 
void resize (uint width, uint height)
 
void clear () const
 
const Texturetexture () const
 
float & radius ()
 
Qualityquality ()
 

Private Attributes

Texture _ssaoTexture
 SSAO texture.
 
Texture _finalTexture
 SSAO texture.
 
BilateralBlur _highBlur
 High quality blur.
 
BoxBlur _mediumBlur
 Medium quality blur.
 
Program_programSSAO
 The SSAO program.
 
UniformBuffer< glm::vec4 > _samples
 The 3D directional samples.
 
Texture _noisetexture = Texture("SSAO noise")
 Random noise texture.
 
float _radius = 0.5f
 SSAO intersection test radius.
 
uint _downscale = 1
 SSAO internal resolution downscaling.
 
Quality _quality = Quality::MEDIUM
 Quality of the upscaling/blurring.
 

Detailed Description

Computes screen space ambient occlusion from a depth and view-space normal buffer (brought to [0,1]).

See also
GPU::Frag::SSAO

Member Enumeration Documentation

◆ Quality

enum class SSAO::Quality : int
strong

SSAO upscaling/blurring algorithm.

Enumerator
LOW 

Bilinear upscaling.

MEDIUM 

Approximate box blur and bilinear upscaling.

HIGH 

Bilateral blur.

Constructor & Destructor Documentation

◆ SSAO()

SSAO::SSAO ( uint  width,
uint  height,
uint  downscale,
float  radius,
const std::string &  name 
)

Constructor.

Parameters
widththe internal resolution width
heightthe internal resolution height
downscalethe downscaling factor for the resolution when computing AO
radiusthe SSAO intersection test radius
namethe debug name for internal buffers

Member Function Documentation

◆ clear()

void SSAO::clear ( ) const

Clear the final texture.

◆ process()

void SSAO::process ( const glm::mat4 &  projection,
const Texture depthTex,
const Texture normalTex 
)

Compute SSAO using the input depth and normal buffers.

Parameters
projectionthe camera projection matrix
depthTexthe depth texture
normalTexthe view-space normal texture

◆ quality()

SSAO::Quality & SSAO::quality ( )

Quality of the blur applied to the SSAO result.

Returns
a reference to the option

◆ radius()

float & SSAO::radius ( )

Query the SSAO radius (should be larger for larger scene with large planar surfaces).

Returns
a reference to the radius parameter

◆ resize()

void SSAO::resize ( uint  width,
uint  height 
)

Resize the internal buffers.

Parameters
widththe new width
heightthe new height

◆ texture()

const Texture * SSAO::texture ( ) const

Query the texture containing the result of the SSAO+blur pass.

Returns
the texture

The documentation for this class was generated from the following files: