Night Vision 2D Filter? Possible?

Hey, I’ve been looking around for a night vision 2D filter, and can’t seem to find any. If there is a way, can someone help me make it work with 2.75 rc?

If not, can we do it via Python?

Thanks!

You could tint the screen green. I will quickly fin the filter. Wait a minute.


uniform sampler2D bgl_RenderedTexture;
void main(void)
{
    float strength = 1.5
    vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
    float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114));
    gl_FragColor = vec4(gray * vec3(0.2, strangth, 0.2), texcolor.a);
}

I guess this one is okay!:slight_smile:
Set the float strength as you need. The more you set it, the more bright it is, but remember to use floats for it(0.0 instead of 0 and 1.0 instead of 1).

Hmm, nothing seems to happen when I activate it. I can’t tell what the issue is.

EDIT: Nevermind, there were a couple typos. Works now. Thanks so much!

@exio160324, could you post the filter with patches?I tried to correct here but as as I could not. After all, I do not know much about programming filters 2d.

Didn’t the one I posted work for you? I copied it from my python editory directly after I tested it and found out that it works fine for me.

uniform sampler2D bgl_RenderedTexture;
void main(void)
{
    float strength = 1.5;
    vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
    float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114));
    gl_FragColor = vec4(gray * vec3(0.2, strength, 0.2), texcolor.a);
}

Also I made a kind of thermal vision (heat is converted to color) you can find here:

Thanks Smoking_mirror! I was asleep. The thermal doesn’t seem to work for me, though.