GLSL Post-Processing Effect Framework¶
Introduction¶
The SoPostEffectRenderer
module and its extensions provides a framework
for screen-space post-processing effects using GLSL shaders.
It offers:
- Configurable super-sampling anti-aliasing
- Anti-aliasing as a post-processing step (instead of MSAA)
- Rendering of various effects (e.g. glow, edges, screen space ambient occlusion, …)
- Custom shaders/buffers to build own effects
How to use¶
The SoPostEffectRenderer
module collects all extensions that are in front of it
and renders all effects in the order in which they have been placed into the scene.
After applying all effects, it renders the buffers name “colorBuffer” and “depthBuffer”
to the default Open Inventor framebuffer.
The order of the effects is important, for instance it only makes sense to do anti-aliasing as one of the last effects, otherwise you will get aliased effects on top of the anti-aliased color buffer.
The same applies to SoPostEffectAmbientOcclusion
, it should be applied after the
main geometry pass and not after any transparent geometry that is rendered on top.
PostEffectRenderer Macro Module¶
The PostEffectRenderer
macro module combines the typically used extensions into
a default post effect renderer, which can be extended with additional effects.
It is not required to use this macro module, it merely provides an easier starting point
to the post effect framework.
Effect Extensions¶
- Background
SoPostEffectBackground
- draws a background gradient
- Geometry
SoPostEffectMainGeometry
- renders the main geometry sceneSoPostEffectAdditionalGeometry
- renders additional geometry on top, e.g. for transparent geometry or volume rendering
- Effects
SoPostEffectAmbientOcclusion
- provides a screen space approximation to ambient occlusionSoPostEffectAntiAliasing
- provides morphological anti-aliasing (FXAA, …)SoPostEffectDepthHalo
- uses unsharp-masking of the depth buffer to render depth halosSoPostEffectEdges
- renders edges based on depth, normals or emissive colorSoPostEffectGlow
- renders a glow effect on emissive colors or bright spots
Building custom effects¶
The main module for building of custom effects is the SoPostEffectCustomPass
module. It can have an arbitrary number of input buffers and writes/blends the results to an output buffer. In addition to that, there are various modules that allow to work with buffers to e.g. copy, downsample and blur them.
- Custom Building Blocks
SoPostEffectCustomPass
- allows to specify an effect as GLSL shaderSoPostEffectBlendBuffer
- blends a given buffer onto anotherSoPostEffectCopyBuffer
- copied one buffer to anotherSoPostEffectBlur
- blurs a given bufferSoPostEffectDownsample
- creates a downsampled version of a buffer