Advanced Night Vision

Advanced Night Vision‘ is a highly configurable, AAA quality and easy to use night vision effect. Perfect for FPS and horror games. PC, VR and mobile. Full source code included.


DEMO UNITY ITCH.IO

Editor.

Select the camera you’re going to use (usually called ‘Main Camera‘) in the ‘Hierarchy‘ editor window (1), then click on ‘Add Component‘ button in the ‘Inspector‘ window (2).

usage_00

Write ‘Advanced Night Vision‘ in the search field, select the effect and add to the camera.

The inspector has these areas:

In the first section (1) you can activate or deactivate the effect (1). You can also define the time it takes to activate and deactivate.

If you click on 6, you will open the online help (this site) and if you click on the “Reset” button (7), many parameters will set to its default values.

Quality.

This section controls the quality of the effects. If the performance is low, here you can improve it.

  1. Shader passes [One pass, Multipass]. The number of passes used by the shader. Less passes is faster, but will have less effects.
  2. Render size [Normal, Half, Quarter]. The resolution of RenderTexture. Lower resolutions are faster, but the quality is worse.
  3. Blur passes [0 – 10]. Less passes is faster, but the quality is worse. Multipass only.
  4. Glow strength [0 – 25]. Less is faster. Multipass only.

Blur and Glow effects are disabled if they are 0.

Light management.

If the small check box is active, the lights will be handled automatically. When the effect is activated, the following occurs:

  1. All realtime lights that are on in the current scene are turned off.
  2. A spot light is created that will be the one used while the effect is active. You can configure this light using 1, 2, 3 and 4.

And when turning off the effect:

  1. The new light goes out.
  2. All the lights that went out, come back on.

If you want some lights to be ignored in this process, you can add them in 5.

This process should work in most games. But if it doesn’t work on yours you can disable this section and do it manually. Talk to your programmer and tell him to watch the ‘OnSwitch‘ event.

Color.

Everything related to the color of the effect.

  1. Color mode [Simple, Advanced]. The second gives better results but is more complex.
  2. Tint color.
  3. Tint color amount [0.0 – 1.0].
  4. Exposure [0.0 – 10.0]. Higher, brighter.
  5. Brightness [-1.0 – 1.0]. Advanced mode only.
  6. Constrast [-1.0 – 1.0]. Advanced mode only.
  7. Saturation [0.0 – 1.0]. Advanced mode only.
  8. RGB offset to define the black and white look. Advanced mode only.

Glitches.

Here you can adjust some typical defects of optical equipment: Vignette, Chromatic Distorsion (Multipass only), Noise and Scanlines.

  1. Types of mask: Screen, Monocular or Binocular. If you select None, turns off the effect.
    • Vignette scale [0.0 – 100.0]. How big is the mask.
    • Vignette softness [0.0 – 10.0]. How soft are the edges.
  2. Chromatic distorsion: Advanced or Simple. If you select None, turns off the effect.
    • Distortions passes [3 – 24]. Less passes is faster, but the quality is worse. Advanced only.
    • Chromatic aberration [-100.0 – 100.0].
    • Barrel distortion [-100.0 – 100.0]. Advanced only.
  3. Analog TV. Simulates the defects of an old analog monitor.
    • Noise [0.0 – 10.0]. Noise grain.
    • Scanlines [0.0 – 2.0]. Number of scanlines.
  4. Digital TV. Simulates the defects of a digital monitor.
    • Threshold [0.0 – 1.0]. Noise threshold.
    • Max offset [0.0 – 1.0]. Noise max offset.

Code.

All code is inside the namespace ‘Ibuprogames.AdvancedNightVisionAsset‘ and the main component is ‘AdvancedNightVision‘. So if you want to use it you must first import its namespace:

1
using Ibuprogames.AdvancedNightVisionAsset;

If ‘myCamera‘ is a valid camera and you want to add the effect, you should do something like:


1
AdvancedNightVision nightVision = mycamera.gameObject.AddComponen<AdvancedNightVision>();

All the code are well commented, I recommend reading the code if you want more information.

Any questions or suggestions you have, we will be happy to answer you in our mail:

You Might Also Like

2 Comments

  • Reply Michael Cozzolino February 21, 2019 at 9:21 pm

    I just bought the pack. How would I be able to turn the night vision on and off? Doesn’t seem like I can access the component in script.

    • Reply Martin Bustos July 23, 2019 at 11:18 pm

      Hi Michael, you can do:

      AdvancedNightVision nightVision = camera.GetComponent();

      nightVision.enable = true; // night vision on.

      nightVision.enable = false; // night vision off.

      Please, send us an email (hello@ibuprogames.com) if you have more questions.

      Regards.

    Leave a Reply