Game Development Reference
In-Depth Information
Combining it all together
We talked about the
RenderTexture
class and we talked about shaders. It is no coincid-
ence that these two classes are covered in the same chapter—the reason is that they work
very well together. Instead of drawing everything directly on
RenderWindow
, we can
draw the scene on
RenderTexture
and then render that texture on
RenderWindow
with a post-processing shader. That will let us create different effects, which is harder to
achieve when applying shaders to each object separately. Some post-processing effects in-
clude:
tinting
(applying a color to the whole texture),
blurring
,
Fast Approximate An-
tialiasing
(
FXAA
),
pixelation
(reducing the number of pixels, while increasing their size),
and many more.
In this section, we will talk about how to set up
RenderTexture
and give a simple ex-
ample of a post-processing pixelation shader which can be used as a scene transition.