GLSL Post-Processing Effect Framework¶
Introduction¶
The SoPostEffectRenderer
module and its extensions provide 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 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 named 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. While it is not required to use this macro module, it merely provides an easier starting point for the post effect framework.
Effect extensions¶
- Background
SoPostEffectBackground
- renders 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 (e.g., 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 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, there are various modules that allow for working with buffers to, for example, copy, downsample, and blur them.
- Custom Building Blocks
SoPostEffectCustomPass
- allows for specifying an effect as GLSL shaderSoPostEffectBlendBuffer
- blends a given buffer onto anotherSoPostEffectCopyBuffer
- copies one buffer to anotherSoPostEffectBlur
- blurs a given bufferSoPostEffectDownsample
- creates a downsampled version of a buffer