generator-apply-artifacts

This shader applies ghosting and noise to an SVideo or Composite signal.

Noise is just that: some randomized signal offset per sample to simulate analog error in the signal (like "snow")

Ghosting basically is what happens when a copy of your signal "skips" its intended path through the cable and mixes in with your normal signal (like an EM leak of the signal) and is basically a pre-echo of the signal. So as a very rough approximation of this, we'll just blend in an offset, blurred, and scaled version of the original signal.

Index

Input Textures/Samplers

g_sourceTexture
                g_sourceTexture
              
Type
texture (platform-specific)
Description
The texture to sample.
g_sampler
                g_sampler
              
Type
sampler (platform-specific, does not exist on some platforms)
Description
The sampler to use to sample g_sourceTexture.

Uniform Buffer Values

g_ghostVisibility
                float g_ghostVisibility
              
Type
g_ghostVisibility
Description
This represents how much ghosting is visible - 0.0 is "no ghosting" and 1.0 is "the ghost is as strong as the original signal."
g_ghostDistance
                float g_ghostDistance
              
Type
float
Description
This is the distance (in colorburst cycles) before the original signal that ghosting should appear.
g_ghostSpreadScale
                float g_ghostSpreadScale
              
Type
float
Description
How far to blur the ghost, in colorburst cycles.
g_noiseStrength
                float g_noiseStrength
              
Type
float
Description
The strength of noise to add to the signal - 0.0 means no noise, 1.0 means, just, a lot of noise. So much. Probably too much.
g_noiseSeed
                uint g_noiseSeed
              
Type
uint
Description
An integer seed used to generate the per-output-texel noise. This can be a monotonically-increasing value, or random every frame, just as long as it's different every frame so that the noise changes.
g_signalTextureWidth
                uint g_signalTextureWidth
              
Type
uint
Description
The width of the input signal texture, in texels.
g_scanlineCount
                uint g_scanlineCount
              
Type
uint
Description
The number of scanlines in this field of NTSC video (i.e. the height of the signal texture).
g_samplesPerColorburstCycle
                uint g_samplesPerColorburstCycle
              
Type
uint
Description
How many samples (texels along a scanline) there are per colorburst cycle (the color wave in the composite signal)