Here’s the night vision filter I’m using for my current project, since some people asked about it.
It works by pixelating the image (thanks to solar Lune for that!) then adding noise to the pixelated version (an old script by martinsh). Then it mixes that with an enhanced light version of the image (thanks to adriansnetlis for posting that!).
The result is not that much of a drag on resources since the individual parts are not complex.
The result is an amplification of available light, so you need a dark scene to start with. “Strength” sets how much it amplifies, so adjust this figure until it fits well with your project. You can also set the size of the pixels if you want them smaller or bigger, they are just to add “grain” to the image, a usual result of cheap night vision gear (or so the movies tell me ).
It should work out OK, if not please post the error report from your console so I can see which lines are not being processed properly. I use an Nvidia card, so ATI cards might not work straight away, it may need some fixes.
Here’s a simple demo:
night_vision_2.blend (515 KB)
Please notice that you need a timer property on the object holding the filter. This is used to generate the noise. I don’t know exactly how martish worked out the noise figures, only that messing with them gives strange results. If you get strange results anyway, please tell me about it.
Good! I regret to not be able to add it to my game. I wonder me what looks a night vision in TRON ^^.
I really like this - it looks so awesome!
@jimy byerley Well, in tron it wouldn’t be grainy and noisy as it is moder/futuric style game where it should have clear image. It also shouldn’t be such green - it can be also a bit colored. I may try to make a modern version right now.
My version on how modernised night vision may look:
Modernised Night Vision
I couldnt check adrian’s file yet but I think a modernized version would probably be “bloomy” rather than grainy combining bloom and a colorization filter would give a good effect I think.
You can make this shader adjustable by the player by switching strength to a uniform rather than const value and adding strength as a property on your controller object. You can also animate the strength value in a seperate script to give a “flare” effect as night vision is turned on.
I updated it with bloom that Thatimster gave me and here is the result:
Updated Modern Night Vision v0.01
cool. I was doing the same thing today, here’s a version using a bloom I got from Solar Lune, I wanted something different from green so I used gold.
night_vision_5.blend (516 KB)
I don’t know which is faster though, v4 or v5.
Solar Lune’s bloom filter is a bit longer than the one Thatimster posted but I don’t think it runs any slower.
EDIT: After some testing, setting sample_num_x and sample_num_y to 2 and KERNEL_SIZE to 2, the two shaders are pretty much the same speed on my GPU.
Yes - your version looks even better. However, I think that moder night vision captures would have a bit of color too:) Where can I find Solar Lunes bloom filters? They look pretty fancy.
Oh this is gonna look good in a horror game
Glad you liked it.
It looks great in that game.
you may use it when the players health is down. might be an interesting effect