27 #include "../shaders/WGEPropertyUniform.h"
28 #include "../shaders/WGEShaderPropertyDefine.h"
29 #include "WGEPostprocessorGauss.h"
30 #include "WGEPostprocessorMergeOp.h"
32 #include "WGEPostprocessorLineAO.h"
36 "LineAO is a special ambient occlusion technique optimized for dense line and tube rendering." )
43 "LineAO is a special ambient occlusion technique optimized for dense line and tube rendering." )
46 WPropInt lineaoSamples =
m_properties->addProperty(
"Samples",
"The number of samples to take in screen-space. Higher values produce better "
47 "quality but can reduce FPS dramatically.", 32 );
48 lineaoSamples->setMin( 1 );
49 lineaoSamples->setMax( 128 );
51 WPropInt lineaoScalers =
m_properties->addProperty(
"Hemispheres",
"The number of hemispheres to sample around each pixel. Higher values "
52 "produce better quality but can reduce FPS dramatically.", 3 );
53 lineaoScalers->setMin( 1 );
54 lineaoScalers->setMax( 8 );
56 WPropDouble lineaoRadiusSS =
m_properties->addProperty(
"Radius",
"The radius around the pixel to sample for occluders in pixels.", 2.0 );
57 lineaoRadiusSS->setMin( 0.0 );
58 lineaoRadiusSS->setMax( 100.0 );
60 WPropDouble lineaoTotalStrength =
m_properties->addProperty(
"Total Strength",
"The strength of the effect. Higher values emphasize the effect.",
62 lineaoTotalStrength->setMin( 0.0 );
63 lineaoTotalStrength->setMax( 5.0 );
65 WPropDouble lineaoDensityWeight =
m_properties->addProperty(
"Density Weight",
"The strength of the occluder influence in relation to the "
66 "geometry density. The higher the value, the larger the "
67 "influence. Low values remove the drop-shadow effect. "
68 "This defines the influence of one occluder to the overall "
70 lineaoDensityWeight->setMin( 0.001 );
71 lineaoDensityWeight->setMax( 2.0 );
73 WPropBool lineaoUseGaussedNDMap =
m_properties->addProperty(
"Use Gaussed ND-Map",
"When enabling, the LineAO algorithm uses a scale-base "
74 "pyramid for sampling the depth and normal maps. Unlike "
75 "described in the paper, this is turned off by default to "
76 "ensure that details of far occluders are retained (the "
77 "images look crispier).",
false );
78 WPropBool lineaoUseOccluderLight =
m_properties->addProperty(
"Use Occluder Light",
"When enabling, the LineAO algorithm uses the light "
79 "reflected by the occluder as contribution to ambient "
80 "light energy of the pixel. This creates a more realistic "
81 "rendering but might brighten areas you might want to stay "
89 s->setDefine(
"WGE_POSTPROCESSOR_LINEAO" );
102 "WGE_POSTPROCESSOR_LINEAO_USEGAUSSPYRAMID" ) )
107 "WGE_POSTPROCESSOR_LINEAO_OCCLUDERLIGHT" ) )
111 osg::ref_ptr< WGEOffscreenTexturePass > lineAOPass = offscreen->addTextureProcessingPass( s,
"LineAO" );
117 m_resultTextures.push_back( lineAOPass->attach( WGECamera::COLOR_BUFFER0, GL_RGB ) );
120 gbuffer.
m_depthTexture->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR );
121 gbuffer.
m_normalTexture->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR );
122 gbuffer.
m_tangentTexture->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR );
124 size_t gBufUnitOffset = gbuffer.
bind( lineAOPass );
127 const size_t size = 64;
129 lineAOPass->bind( randTex, gBufUnitOffset );