Shaders - MOARdV/AvionicsSystems GitHub Wiki

The MASMonitor CAMERA node can use post-processing shaders to apply various effects to camera views prior to displaying them on the monitor. All shaders support config-controlled properties that may change in-flight. For instance, the basic monochrome shader could have the color channels tied to a variable that switched them between grayscale (1, 1, 1) and night vision (0, 1, 0).

The shader is selected in the CAMERA config node using the shader field. The properties are set using the property field in the config file. A property consists of a name and value, separated by a colon (eg, _Gain:1.2). The value may be any valid variable (eg, _ChannelR:fc.GetThrottle() ties the red channel to the current throttle setting). If multiple properties need to be set, each name/value pair should be listed in the same property field separated by a semi-colon thus _Gain:1.2;_ChannelR:fc.GetThrottle().

The following shaders are available.

Monochrome

Converts the image to a monochrome image (black & white or grayscale). Properties allow adjustments to the gain (to brighten or darken the image), opacity (for use on a HUD), and the color channels (to make it a monochrome green image, for instance, to simulate night vision or other low-light technologies).

Shader: MOARdV/Monochrome

Properties: with defaults listed in parentheses.

  • _Gain: (1.0) Brightens / darkens the overall image.
  • _ChannelR: (1.0) Sets the red channel of the displayed image.
  • _ChannelG: (1.0) Sets the green channel of the displayed image.
  • _ChannelB: (1.0) Sets the blue channel of the displayed image.
  • _Opacity: (1.0) Sets the alpha channel of the displayed image.

Color Noise

Blends a config-supplied noise texture with the color output. The noise texture is intended to represent analog television signal noise effects, but it could be any image (color or monochrome). The noise texture may be displaced vertically (in the y direction) with a property.

Shader: MOARdV/ColorNoise

Properties: with defaults listed in parentheses.

  • _Gain: (1.0) Brightens / darkens the overall image.
  • _Blend: (1.0) Controls the blending between the camera output and the noise texture. 1.0 means no noise, only image; 0.0 means all noise, no image.
  • _NoiseOffset: (0.0) Offsets the noise texture in the y-direction, simulating vertical hold errors. This is a normalized (texture UV) displacement, so 1.0 is the same as 0.0. 0.5 would mean "displace the image by 1/2 its height".
  • _Opacity: (1.0) Sets the alpha channel of the displayed image.

Monochrome Noise

Combines the monochrome effect of the monochrome shader with the noise effect of the color noise shader.

Shader: MOARdV/MonochromeNoise

Properties: with defaults listed in parentheses.

  • _Gain: (1.0) Brightens / darkens the overall image.
  • _Blend: (1.0) Controls the blending between the camera output and the noise texture. 1.0 means no noise, only image; 0.0 means all noise, no image.
  • _NoiseOffset: (0.0) Offsets the noise texture in the y-direction, simulating vertical hold errors. This is a normalized (texture UV) displacement, so 1.0 is the same as 0.0. 0.5 would mean "displace the image by 1/2 its height".
  • _ChannelR: (1.0) Sets the red channel of the displayed image.
  • _ChannelG: (1.0) Sets the green channel of the displayed image.
  • _ChannelB: (1.0) Sets the blue channel of the displayed image.
  • _Opacity: (1.0) Sets the alpha channel of the displayed image.