Graphics Reference
In-Depth Information
Image Postprocessing
The next example covered in this chapter involves image postprocessing.
Using a combination of framebuffer objects and shaders, it is possible to
perform a wide variety of image postprocessing techniques. The first example
presented here is the simple blur effect in the PVRShaman workspace in
Chapter_14/PVR_PostProcess , results of which are pictured in Figure 14-5.
Figure 14-5
Image Postprocessing Example
Render-to-Texture Setup
This example renders a textured knot into a framebuffer object and
then uses the color attachment as a texture in a subsequent pass. A full-
screen quad is drawn to the screen using the rendered texture as a source.
A fragment shader is run over the full-screen quad, which performs a
blur filter. In general, many types of postprocessing techniques can be
accomplished using this pattern:
1.
Render the scene into an off-screen framebuffer object (FBO).
2.
Bind the FBO texture as a source and render a full-screen quad to the
screen.
3.
Execute a fragment shader that performs filtering across the quad.
Some algorithms require performing multiple passes over an image; others
require more complicated inputs. However, the general idea is to use a
fragment shader over a full-screen quad that performs a postprocessing
algorithm.
 
 
 
Search WWH ::




Custom Search