Heat 2D Vision

From the author Smoking_mirror in BlenderArtist:

“It’s not real heat vision, you have to add a lamp to illuminate the scene when you turn it on if the scene is dark, but it simulates the heat map style coloration of thermographic vision. You can combine it with other filters such as noise or blur to get a more interesting effect. I tried using depthTexture to get a true “seeing in the dark” type filter but the depth texture doesn’t pick up textures, transparent objects etc… so it wasn’t a good effect.”

Predatos Style View

here’s the GLSL code:

uniform sampler2D bgl_RenderedTexture;

const float vignette_size = 0.4;
const float tolerance = 0.2;


void main(void)
{           
    vec4 col_value = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
    
    float col_avg = (col_value[0] + col_value[1] + col_value[2]) * 0.333;
                            
    float ratio = 2.0 * col_avg;
    float b = max(0.0, (1.0 - ratio));
    float r = max(0.0, (ratio - 1.0));
    float g = 1.0 - r - b;
 
    vec4 color_vision = vec4(r,g,b,1.0);
 
    vec2 deltaTexCoord = gl_TexCoord[0].st - vec2(0.5);
    vec2 powers = pow(deltaTexCoord,2.0);   
        
    float radiusSqrd = pow(vignette_size,2.0);    
    float gradient = smoothstep(radiusSqrd-tolerance, radiusSqrd+tolerance, powers.x+powers.y*0.3);

    gl_FragColor = mix(color_vision, vec4(1.0,0.0,0.0,1.0), gradient);
    gl_FragColor.a = 1.0;
    

}