Commit ea41fc32 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - extended list of postprocessors

parent 589f22c3
......@@ -58,8 +58,8 @@ WGEPostprocessingNode::WGEPostprocessingNode( osg::ref_ptr< osg::Camera > refere
// some info text:
m_infoText = m_properties->addProperty( "Hint", "This is for advanced users.",
std::string( "The post-processing has to be seen as facility to create appealing images. The here offered options are not all "
"possibilities. The most powerful effects can be achieved by using custom combinations of post-processors and recommended "
"for <b>advanced users</b> only." )
"possibilities. The most powerful effects can be achieved by using custom combinations (using custom GLSL code) of "
"post-processors and is recommended for <b>advanced users</b> only." )
);
m_infoText->setPurpose( PV_PURPOSE_INFORMATION );
......@@ -72,12 +72,13 @@ WGEPostprocessingNode::WGEPostprocessingNode( osg::ref_ptr< osg::Camera > refere
typedef WGEShaderPropertyDefineOptionsTools::NameDescriptionDefineTuple Tuple;
std::vector< Tuple > namesAndDefs;
namesAndDefs.push_back( Tuple( "Color Only", "No Post-Processing.", "WGE_POSTPROCESSOR_COLOR" ) );
namesAndDefs.push_back( Tuple( "Gaussed Color", "Smoothed Color Image using Gauss Filter.", "WGE_POSTPROCESSOR_GAUSSEDCOLOR" ) );
namesAndDefs.push_back( Tuple( "Smoothed Color", "Smoothed Color Image using Gauss Filter.", "WGE_POSTPROCESSOR_GAUSSEDCOLOR" ) );
namesAndDefs.push_back( Tuple( "PPL - Phong", "Per-Pixel-Lighting using Phong.", "WGE_POSTPROCESSOR_PPLPHONG" ) );
namesAndDefs.push_back( Tuple( "SSAO", "Screen-Space Ambient Occlusion.", "WGE_POSTPROCESSOR_SSAO" ) );
namesAndDefs.push_back( Tuple( "Cel Shading", "Under-sampling of the color for cartoon-like shading.", "WGE_POSTPROCESSOR_CELSHADING" ) );
namesAndDefs.push_back( Tuple( "Edge", "Edge of Rendered Geometry.", "WGE_POSTPROCESSOR_EDGE" ) );
namesAndDefs.push_back( Tuple( "Depth", "Depth Value only.", "WGE_POSTPROCESSOR_DEPTH" ) );
namesAndDefs.push_back( Tuple( "Smoothed Depth", "Gauss-Smoothed Depth Value only.", "WGE_POSTPROCESSOR_GAUSSEDDEPTH" ) );
namesAndDefs.push_back( Tuple( "Normal", "Geometry Normal.", "WGE_POSTPROCESSOR_NORMAL" ) );
namesAndDefs.push_back( Tuple( "Custom", "Provide Your Own Post-processing-Code.", "WGE_POSTPROCESSOR_CUSTOM" ) );
......
......@@ -311,11 +311,13 @@ float getEdge()
}
/**
* Returns the gauss-smoothed color of the pixel from the input color texture.
* Returns the gauss-smoothed color of the specified pixel from the input color texture.
*
* \param where the pixel to grab
*
* \return the color
*/
vec4 getGaussedColor()
vec4 getGaussedColor( vec2 where )
{
// TODO(ebaum): provide properties/uniforms for the scaling factors here
......@@ -338,6 +340,56 @@ vec4 getGaussedColor()
return gaussed;
}
/**
* Returns the gauss-smoothed color of the current pixel from the input color texture.
*
* \return the color
*/
vec4 getGaussedColor()
{
return getGaussedColor( pixelCoord );
}
/**
* Returns the gauss-smoothed depth of the specified ixel from the input color texture.
*
* \param where the point to grab
*
* \return the gaussed depth
*/
float getGaussedDepth( vec2 where )
{
// TODO(ebaum): provide properties/uniforms for the scaling factors here
// get the 8-neighbourhood
float gaussedDepthc = getDepth( where );
float gaussedDepthbl = getDepth( where + vec2( -offsetX, -offsetY ) );
float gaussedDepthl = getDepth( where + vec2( -offsetX, 0.0 ) );
float gaussedDepthtl = getDepth( where + vec2( -offsetX, offsetY ) );
float gaussedDeptht = getDepth( where + vec2( 0.0, offsetY ) );
float gaussedDepthtr = getDepth( where + vec2( offsetX, offsetY ) );
float gaussedDepthr = getDepth( where + vec2( offsetX, 0.0 ) );
float gaussedDepthbr = getDepth( where + vec2( offsetX, offsetY ) );
float gaussedDepthb = getDepth( where + vec2( 0.0, -offsetY ) );
// apply gauss filter
float gaussed = ( 1.0 / 16.0 ) * (
1.0 * gaussedDepthtl + 2.0 * gaussedDeptht + 1.0 * gaussedDepthtr +
2.0 * gaussedDepthl + 4.0 * gaussedDepthc + 2.0 * gaussedDepthr +
1.0 * gaussedDepthbl + 2.0 * gaussedDepthb + 1.0 * gaussedDepthbr );
return gaussed;
}
/**
* Returns the gauss-smoothed depth of the current pixel from the input depth texture.
*
* \return the gaussed depth
*/
float getGaussedDepth()
{
return getGaussedDepth( pixelCoord );
}
/**
* Calculate the screen-space ambient occlusion from normal and depth map.
*
......@@ -509,6 +561,10 @@ void main()
blendScale( depth );
#endif
#ifdef WGE_POSTPROCESSOR_GAUSSEDDEPTH
blendScale( getGaussedDepth() );
#endif
#ifdef WGE_POSTPROCESSOR_NORMAL
blend( getNormal() );
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment