Welcome back! This is part two of my series detailing the step-by-step creation of a night-vision-style fragment shader. You can check out part one here if you haven’t yet. We’ll be building on the code from previous article, but it’s not very complicated at this point.
Let’s add some code to crank up the contrast. As an added bonus, we’ll add a flag to pick green or grayscale rendering, to give us some options when defining the look of our games.
Lately, I’ve been intrigued by shaders that emulate other visual effects and certain camera technologies. I’ve been considering doing a night vision kinda thing for my current project for quite some time, but I’ve been feeling kinda ambivalent about the whole thing. Recently, I got Zombie Gunship from the Humble Mobile Bundle, and they do the effect very impressively.
This got me thinking, what would it take to implement something like this? The primary requirement, other than looking badass, would be that I don’t have to re-author any graphics assets. I’d want all my geometry and textures to just work. Because I am lazy. The secondary requirement would be that the shader code should be as simple as I can make it, again because I am lazy (but also for efficiency’s sake).