As part of the Danfoss-experience project we have been working for the last couple of months on many interesting effects for illustrating the application of Danfoss products digitally. One of the more successful effects that we have produced is a heat shimmer effect made entirely as a shader.
To make this effect work we have applied an interesting texture advection shader technique used by Valve for water flow in Left for Dead 2. A presentation of the technique and its improvements for portal 2 was given at Siggraph 2010.
The method combines a few neat shader tricks. Lets say we have a surface texture T and velocities V for the surface. If we advect the texture by the velocities in V, we can make the texture flow according to the velocity field. But rather quickly the displacement of the texture makes it look stretched and wrong. We can remove the distortion by reverting to the original texture after every S seconds, but at the cost of a massive sudden change. We can hide the sudden revert back to the original texture by linearly interpolating between a second texture advection of the same texture. If we offset the advection by half the advection interval we can always show a not too distorted texture advection while reverting the advection of the hidden texture.
What we have added to the method is a layer on top of the advection method. With the Valve texture advection method we create a directional flow of a distortion texture (we use a velocity field with the same speed in the entire domain). The distortion is then used when doing texture lookup in the texture-rendered scene. In this way we can add time-dependent distortion with a directional flow to any surface. A video of the effect on a static background image is shown below.
It would be fairly easy to add depth dependent distortion to the method by using a depth buffer, but for better directability we chose to add a scaling mask instead.