Introduction
This is an NVG mod I reworked for DCS World 1.5 and 2.0 to generate a realistic NVG effect instead of the stock effect. It is based on the work created Nrgized with the help of PeterP and few others from the eagle dynamic forums on this thread (in future I will refer to this as Version 1). The rework was required since DCS 1.5 and above uses the new Eagle Dynamics Graphics Engine (EDGE) which is based on DirextX11 (DX11). Version 1 was coded using DX9 and was not compatible at all due to the significant changes, for the better, in the Higher Level Shading Language (HLSL).
A quote of mine from the initial thread I started on the Online 1st Cav Div forums (online handle is Frenchy) can give some perspective on where I started skill wise in this endeavor. I want to emphasis I have no background in shader coding at all but all my maths studies at uni (some in writing code to calculate numerical solutions for 2nd order non linear differential equations for example) have given me a nice advantage.
Hey guys, Uni is finished for the year and this is number 1 on my to do list. Spent all day breaking down the standard DCS NVG implementation and learning some basics of HLSL. Im now confident in how I need to go about making basic color and intensity changes. Ive just started looking into what this actual mod did and how. Will take me a little bit (next few days around work etc) to figure it all out but I think I will be able to achieve something similar π if not it will at least be stepping stones to getting close. My plan of attack is first and easiest (i think) should be the color/intensities. Next will be the noise (or lack thereof if the scene is bright) and then finally the zoom and ring. PS. I dont have the black shark so the A10 is my primary concern but once done i might get the blackshark and try to do that one as well.
Now that βfew daysβ turned into a few weeks banging my head against a wall learning the intricacies of HLSL and decomposing the version 1 mod with no comments which overall wasnβt very clear or efficient.
Current Status
Version 2.0.6
β NATO and Russian NVGβs simulated with user controllable gain, noise/grain, size and ring thickness.
β Third iteration of my code development to simplify understanding and make more efficient.
β JSGME ready, just extract to your JSGME mod folder and then install with JSGME
β Download Here
Instructions
- Extract from .rar to JSGME mod folder
- Adjust variables in βJSGME MOD FOLDER\Frenchys NVG Mod 2.0.6\Bazar\shaders\common\MOD_nvg.hlslβ to change shape etc. You MUST change the variables before applying the mod in JSGME
- Apply Mod in JSGME
Variables Guide
Render Mode:
0 = full screen,
1 = NVG with no ring,
2 = NVG with Ring,
3 = NVG with ring and slight zoom (not functional)
Eye Size and position:
EYE_CENTER = sets center point of NVG effect on screen as percentage of X and Y starting at bottom left corner. eg (0.5f, 0.655f) = 50% across and 65.5% up.
EYE_SIZE = Sets X and Y diameter of NVG as percentage of screen size. eg (0.47f, 0.75f) = 47% of width of screen and 75% of screen height. Since most monitors arenβt square the y value will have to be larger than the x value to make a perfect circle; the ratio between the two numbers will be the same as your monitor aspect ratio
Gain/Noise controls:
NVG_LIFT = gain multiplication value (.10 for A10 and .08 for KA50 are good starting points)
NVG_NOISE = noise division value, larger value means less noise (3 for A10 and 4 for KA50 are good starting points)
Ring Thickness
Note β if using render mode 1 nvg will only be size of RInner. ie size = RInner(percentage) * Eye_Size = actual size.
ROFade = % radius of circle where black ring starts to fade out to regular view
RMerge = % radius of circle where black ring becomes 100% black on inside edge
RInner = % radius of circle where green NVG lens start to transition to black ring
I personally prefer a thin ring and this mod is released as such but some real world users (thank you Giaco) recommend the following ring sizes (that you need to set yourself):
static const float ROFade = 0.90f;
static const float RMerge = 0.65f;
static const float RInner = 0.63f;
Release History
Version 2.0.6
β Download Here
β Re coded noise and gain code to something I understand and a little simpler
β Added user controllable gain and noise settings
NVG_LIFT = gain multiplication value (.10 for A10 and .08 for KA50 are good starting points)
NVG_NOISE = noise division value, larger value means less noise (3 for A10 and 4 for KA50 are good starting points)
β Ring thickness now user controlled by adjustable parameters. (SAME AS 2.0.5)
ROFade = % radius of circle where black ring starts to fade out to regular view
RMerge = % radius of circle where black ring becomes 100% black on inside edge
RInner = % radius of circle where green NVG lens start to transition to black ring
NOTE1: if using render mode 1 nvg will only be size of RInner. ie size = RInner(percentage) * Eye_Size = actual size
NOTE2: I personally prefer a thin ring and this mod is released as such but some real world users (thankyou Giaco) recommend ring sizes as follows (that you need to set yourself):
static const float ROFade = 0.90f;
static const float RMerge = 0.65f;
static const float RInner = 0.63f;
β As per 2.0.4 DONT USE render mode 3, not implemented yet (possibly never, personally not very interested in the effect since mouse clicking buttons donβt line up)
β Adjust variables in β\Frenchys NVG Mod 2.0.6\Bazar\shaders\common\MOD_nvg.hlslβ to change shape etc.
Version 2.0.5
β Download Here
β Re coded lens, ring and overall mask equations. Neater code in my opinion
β Fixed laser mask issue (possibly discovered bug in DCS with regards to laser rendering β see black line on laser path outside NVG ring in picture below)
β Ring thickness now user controlled by adjustable parameters.
ROFade = % radius of circle where black ring starts to fade out to regular view
RMerge = % radius of circle where black ring becomes 100% black on inside edge
RInner = % radius of circle where green NVG lens start to transition to black ring
NOTE: if using render mode 1 nvg will only be size of RInner. ie size = RInner(percentage) * Eye_Size = actual size
β As per 2.0.4 DONT USE render mode 3, not implemented yet
β Adjust variables in β\Frenchys NVG Mod 2.0.5\Bazar\shaders\common\MOD_nvg.hlslβ to change shape etc.
Version 2.0.4
β Download Here
β Included render mode setting, sets which NVG type to use. 0 = full screen, 1 = NVG with no ring, 2 = NVG with Ring, 3 = NVG with ring and slight zoom (not functional)
β Render mode 2 is default.
β As above DONT USE mode 3, not implemented yet
β Adjust variables in β\Frenchys NVG Mod 2.0.4\Bazar\shaders\common\MOD_nvg.hlslβ to change shape etc.
Version 2.0.3
β Download Here
β Include fade and ring at edge of lens, this is based off my own code and not Nrgizers. I understood what his code did but not how so I wrote my own version. It may not be the most efficient code??? but it works and I know how to troubleshoot it
β Adjust variables in β\Frenchys NVG Mod 2.0.3\Bazar\shaders\common\MOD_nvg.hlslβ to change shape etc.
β Minimal comments/instructions in code at the moment. Implementation is extremely similar to V1.0β¦
Version 2.0.2
β Download Here
β Added user controlled parametric mask for shape, size and center point of NVG lens.
β Removes reliance on mask.png
β Doesnβt include fade or ring at edge of lens, this will be the focus of the next release.
β Adjust variables in β\Frenchys NVG Mod 2.0.2\Bazar\shaders\common\MOD_nvg.hlslβ to change shape etc.
β Minimal comments/instructions in code at the moment. Implementation is extremely similar to V1.0β¦
Version 2.0.1
β Download Here
β Updated Nrgizers mod here to DX11 standard
β JSMGE ready, just extract to your JSMGE folder.
β Achieves same color, intensity and noise effects as Nrgizers for BOTH NATO AND RUSSIAN NVG.
β Shape still relies on the focus.png file for mask, ring and size (main priority for next release is to have procedural mask user controls)
β Lots of excess code, comments user variable parameters that currently have no effect.
β Mod includes a large wide view focus.png If you dont like it UNAPPLY the mod and delete β\Frenchys NVG Mod 2.0.1\Bazar\Effects\PostEffects\focus.pngβ or rename to anything else and mod will use stock NVG field of view native to DCS 1.5