generator-rgb-to-svideo-or-composite

This shader takes an RGB image and turns it into either an S-Video or Composite signal (Based on whether g_compositeBlend is 0 or 1). We might also be generating a PAIR of these, using two different sets of phase inputs (if g_scanlinePhases is a two-component input), for purposes of temporal aliasing reduction.

See Generating a Fake NTSC Signal for more information.

Index

Input Textures/Samplers

g_sourceTexture
                g_sourceTexture
              
Type
texture (platform-specific)
Description
The RGB input texture. It is expected to be g_inputWidth by g_scanlineCount in size.
g_sourceSampler
                g_sampler
              
Type
sampler (platform-specific, does not exist on some platforms)
Description

The sampler to use to sample g_sourceTexture.

This sampler should be set up with linear filtering, and either clamp or border addressing.

g_scanlinePhases
                g_scanlinePhases
              
Type
texture (platform-specific)
Description
This is the scanline phases texture (the output of gen-phase). It is g_scanlineCount x 1 in size, and each texel component in it represents the phase offset of the NTSC colorburst for the corresponding scanline, in multiples of the colorburst wavelength.
g_scanlinePhasesSampler
                g_scanlinePhasesSampler
              
Type
sampler (platform-specific, does not exist on some platforms)
Description

The sampler to use to sample g_scanlinePhases.

This sampler should be set up with linear filtering, and either clamp or border addressing.

Uniform Buffer Values

g_outputTexelsPerColorburstCycle
                uint g_outputTexelsPerColorburstCycle
              
Type
uint
Description
The number of texels that the output texture will contain for each color cycle wave (i.e. the wavelength in output samples of the color carrier wave).
g_inputWidth
                uint g_inputWidth
              
Type
uint
Description
The width of the input texture.
g_outputWidth
                uint g_outputWidth
              
Type
uint
Description
The width of the output render target.
g_scanlineCount
                uint g_scanlineCount
              
Type
uint
Description
The number of scanlines in the current field of video (the height of the input texture).
g_compositeBlend
                float g_compositeBlend
              
Type
float
Description
Whether we're blending the generated luma/chroma into a single output channel or not. It is expected to be 0 or 1 (no intermediate values), where "0" means "keep luma and chroma separate, like an S-Video signal" and "1" means "add the two together, like a composite signal".
g_instabilityScale
                float g_instabilityScale
              
Type
float
Description
The scale of any picture instability (horizontal scanline-by-scanline tracking issues). This is used to offset our texture sampling when generating the output so the picture tracking is imperfect. Must match the similarly-named value in gen-phase.
g_noiseSeed
                uint g_noiseSeed
              
Type
uint
Description
A seed for the noise used to generate the scanline-by-scanline picture instability. Must match the simiarly-named value in gen-phase.
g_sidePaddingTexelCount
                uint g_sidePaddingTexelCount
              
Type
uint
Description
The number of output texels to pad on either side of the signal texture (so that filtering won't have visible artifacts on the left and right sides).