Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
14c6ed89
Commit
14c6ed89
authored
Jun 07, 2013
by
Sebastian Eichelbaum
Browse files
[ADD] added pre-blend scaling to postprocessing pipeline
parent
5d45355d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
src/core/graphicsEngine/postprocessing/WGEPostprocessor.cpp
src/core/graphicsEngine/postprocessing/WGEPostprocessor.cpp
+5
-0
src/core/graphicsEngine/postprocessing/WGEPostprocessor.h
src/core/graphicsEngine/postprocessing/WGEPostprocessor.h
+5
-2
src/core/graphicsEngine/postprocessing/WGEPostprocessorLineAO.cpp
.../graphicsEngine/postprocessing/WGEPostprocessorLineAO.cpp
+4
-0
src/core/graphicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
...hicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
+9
-7
No files found.
src/core/graphicsEngine/postprocessing/WGEPostprocessor.cpp
View file @
14c6ed89
...
...
@@ -46,6 +46,11 @@ WGEPostprocessor::WGEPostprocessor( std::string name, std::string description ):
// there is always one property:
m_effectOnly
=
m_properties
->
addProperty
(
"Effect Only"
,
"If active, the plain effect will be shown instead a combination of effect "
"and color. This settings does not affect all postprocessors."
,
false
);
m_effectScale
=
m_properties
->
addProperty
(
"Effect Scaling"
,
"Use this to overemphasize an effect or to weaken it. Technically spoken, this "
"factor determines the pre-multiplication done prior to blending with the input color."
,
1.0
,
true
);
m_effectScale
->
setMin
(
0.0
);
m_effectScale
->
setMax
(
10.0
);
// for convenience, also create a preprocessor for this property
m_effectOnlyPreprocessor
=
WGEShaderPreprocessor
::
SPtr
(
new
WGEShaderPropertyDefineOptions
<
WPropBool
>
(
m_effectOnly
,
...
...
src/core/graphicsEngine/postprocessing/WGEPostprocessor.h
View file @
14c6ed89
...
...
@@ -44,8 +44,6 @@
#include "../../common/WProperties.h"
#include "../../common/WPrototyped.h"
/**
* The base class for all custom post-processors. It allows building an own texture processing pipeline for special processings.
*/
...
...
@@ -264,6 +262,11 @@ protected:
*/
WPropBool
m_effectOnly
;
/**
* Scale the effect prior to blending it.
*/
WPropDouble
m_effectScale
;
/**
* For convenience, this is a shader preprocessor controlled by m_effectOnly property.
*/
...
...
src/core/graphicsEngine/postprocessing/WGEPostprocessorLineAO.cpp
View file @
14c6ed89
...
...
@@ -127,6 +127,10 @@ WGEPostprocessorLineAO::WGEPostprocessorLineAO( osg::ref_ptr< WGEOffscreenRender
const
size_t
size
=
64
;
osg
::
ref_ptr
<
WGETexture2D
>
randTex
=
wge
::
genWhiteNoiseTexture
(
size
,
size
,
3
);
lineAOPass
->
bind
(
randTex
,
gBufUnitOffset
);
// also utilize the pre-blend scale
m_effectScale
->
setHidden
(
false
);
lineAOPass
->
getOrCreateStateSet
()
->
addUniform
(
new
WGEPropertyUniform
<
WPropDouble
>
(
"u_effectPreBlendScale"
,
m_effectScale
)
);
}
WGEPostprocessorLineAO
::~
WGEPostprocessorLineAO
()
...
...
src/core/graphicsEngine/shaders/shaders/WGEPostprocessor-fragment.glsl
View file @
14c6ed89
...
...
@@ -37,6 +37,8 @@
// These are NOT specific to any postprocessor
uniform
float
u_effectPreBlendScale
=
1
.
0
;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Varying
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -516,10 +518,10 @@ void main()
// for black borders, multiply edge with color
#ifdef WGE_POSTPROCESSOR_EDGE_BLACKEDGE
#define EDGEOP * ( 1.0 - getEdge() )
#define EDGEOP *
u_effectPreBlendScale *
( 1.0 - getEdge() )
#else
// for white borders, add
#define EDGEOP + vec3( getEdge() )
#define EDGEOP + vec3(
u_effectPreBlendScale *
getEdge() )
#endif
// apply operation and output color
...
...
@@ -538,7 +540,7 @@ void main()
#ifdef WGE_POSTPROCESSOR_CEL
// output the depth and final color.
gl_FragData
[
0
]
=
getCelShading
();
gl_FragData
[
0
]
=
u_effectPreBlendScale
*
getCelShading
();
#endif
#ifdef WGE_POSTPROCESSOR_GAUSS
...
...
@@ -607,18 +609,18 @@ void main()
#ifdef WGE_POSTPROCESSOR_SSAO
// output color AND SSAO?
#ifdef WGE_POSTPROCESSOR_OUTPUT_COMBINE
gl_FragData
[
0
]
=
vec4
(
getColor
().
rgb
*
getSSAO
(),
1
.
0
);
gl_FragData
[
0
]
=
vec4
(
getColor
().
rgb
*
u_effectPreBlendScale
*
getSSAO
(),
1
.
0
);
#else
gl_FragData
[
0
]
=
vec4
(
vec3
(
getSSAO
()
),
1
.
0
);
gl_FragData
[
0
]
=
vec4
(
vec3
(
u_effectPreBlendScale
*
getSSAO
()
),
1
.
0
);
#endif
#endif
#ifdef WGE_POSTPROCESSOR_LINEAO
// output color AND SSAO?
#ifdef WGE_POSTPROCESSOR_OUTPUT_COMBINE
gl_FragData
[
0
]
=
vec4
(
getColor
().
rgb
*
getLineAO
(),
1
.
0
);
gl_FragData
[
0
]
=
vec4
(
getColor
().
rgb
*
u_effectPreBlendScale
*
getLineAO
(),
1
.
0
);
#else
gl_FragData
[
0
]
=
vec4
(
vec3
(
getLineAO
()
),
1
.
0
);
gl_FragData
[
0
]
=
vec4
(
vec3
(
u_effectPreBlendScale
*
getLineAO
()
),
1
.
0
);
#endif
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment