I was thinking about how to implement heat distortion as
seen in many first person shooters, for example on flames
above ghetto barrels.
I already have an idea for the distortion shader:
Always render the scene into a FBO x that has the
same dimensions as the application window
When rendering a flame effect that comes with heat
distortion copy FBO x to FBO y. Keep FBO x active and
attach FBO y as texture sampler to a distortion shader.
Render a quad at the flame position while the distortion
shader is activated.
In this shader read some distortion normal from a normal
map (using a uniform timer to offset in the normal map
over time) and use the returned normal to lookup the pixels
from the attached FBO y in a distorted manner.
What is still not clear to me is how to integrate this into
my scene graph. Currently my scene graph works like this that
I always render solid objects first (sorted front to back to
exploit the depth buffer) and then all transparent objects
(sorted back to front) and blending effects like flames.
I guess it is not possible to do a simple post processing
step since the distortion should not affect any objects
(solid or transparent) between the eye and the flame.
So how does it work?
Help is really appreciated!