27 #include "../WGETextureUtils.h"
28 #include "../shaders/WGEPropertyUniform.h"
29 #include "../shaders/WGEShaderPropertyDefine.h"
31 #include "WGEPostprocessorSSAO.h"
35 "SSAO is a special ambient occlusion technique." )
42 "SSAO is a special ambient occlusion technique." )
45 WPropInt ssaoSamples =
m_properties->addProperty(
"Samples",
"The number of samples to take in screen-space. Higher values produce better "
46 "quality but can reduce FPS dramatically.", 16 );
47 ssaoSamples->setMin( 1 );
48 ssaoSamples->setMax( 128 );
50 WPropDouble ssaoRadius =
m_properties->addProperty(
"Radius",
"The radius around the pixel to sample for occluders in pixels.", 10.0 );
51 ssaoRadius->setMin( 0.0 );
52 ssaoRadius->setMax( 500.0 );
54 WPropDouble ssaoTotalStrength =
m_properties->addProperty(
"Total Strength",
"The strength of the effect. Higher values emphasize the effect.",
56 ssaoTotalStrength->setMin( 0.0 );
57 ssaoTotalStrength->setMax( 100.0 );
59 WPropDouble ssaoStrength =
m_properties->addProperty(
"Strength",
"This defines the influence of one occluder to the overall AO effect.", 1.0 );
60 ssaoStrength->setMin( 0.0 );
61 ssaoStrength->setMax( 1.0 );
63 WPropDouble ssaoFalloff =
m_properties->addProperty(
"Falloff",
"Define the edge at which a depth difference between two pixels is assumed to "
64 "be non-zero.", 0.0 );
65 ssaoFalloff->setMin( 0.0 );
66 ssaoFalloff->setMax( 1.0 );
70 s->setDefine(
"WGE_POSTPROCESSOR_SSAO" );
79 osg::ref_ptr< WGEOffscreenTexturePass > pass = offscreen->addTextureProcessingPass( s,
"SSAO" );
86 m_resultTextures.push_back( pass->attach( WGECamera::COLOR_BUFFER0, GL_RGB ) );
89 size_t gBufUnitOffset = gbuffer.
bind( pass );
93 const size_t size = 64;
95 pass->bind( randTex, gBufUnitOffset );
This class encapsulates a G-Buffer.
size_t bind(osg::ref_ptr< WGEOffscreenRenderPass > to) const
Attaches these textures to the specified renderpass.
The base class for all custom post-processors.
WGEShaderPreprocessor::SPtr m_effectOnlyPreprocessor
For convenience, this is a shader preprocessor controlled by m_effectOnly property.
WPropGroup m_properties
All the properties of the post-processor.
std::shared_ptr< WGEPostprocessor > SPtr
Convenience typedef for an osg::ref_ptr< WGEPostprocessor >.
std::vector< osg::ref_ptr< osg::Texture2D > > m_resultTextures
The textures contain the result.
std::shared_ptr< WGEShaderPreprocessor > SPtr
Shared pointer for this class.
This class is able to provide arbitrary values as define statements in GLSL code.
Class encapsulating the OSG Program class for a more convenient way of adding and modifying shader.
osg::ref_ptr< WGEShader > RefPtr
Convenience typedef for an osg::ref_ptr.
osg::ref_ptr< WGETexture< osg::Texture1D > > genWhiteNoiseTexture(size_t sizeX, size_t channels)
This generates an 1D texture only containing white noise in its channels.