# Rendering Chains

The ALE incremental renderer is configured using rendering chains. Rendering chains are constructed hierarchically from: invariants, SSFEs (scaled sampling filters with exclusion), SSFs (scaled sampling filters), and sampling filters. Each of these components is described in a section below. Defaults are outlined in the final section.

Chains

The chain is the top level of the rendering chain hierarchy, and is composed of a sequence of invariants. Syntactically, a chain is specified as a number of invariants separated by commas:

`invariant1,invariant2,invariant3,...,invariantn`

Each rendered pixel is assigned a value at the first invariant whose weight exceeds the weight threshold, or otherwise at the last invariant in the sequence.

Chain Options

    --wt <w>          Set weight threshold for defined pixels [default is 0.8 in v0.8.0; 0.1 in v0.8.1 and later]
    --dchain <g>      Use chain <g> to render the default output.
    --ochain <g> <o>  Use chain <g> to render output file <o>.
    --achain <g>      Use chain <g> to render the alignment reference image.
    --3d-chain <g>    Use chain <g> by default to render 3d output.  [0.8.4 and later]

Chain Examples

                 triangle:2                           ALE 0.6.0 merging (roughly)
                 fine:box:1                           Drizzling (roughly)
                 fine:sinc*lanc:8                     High-frequency preservation
                 last:nex:sinc*lanc:8                 Useful for video stabilization
                 fine:box:1,triangle:2                Multi-resolution rendering
                 fine:sinc*lanc:8,sinc*lanc:8         Multi-resolution rendering

Invariants

Invariants determine whether the rendered pixel value should be taken from a single frame, or from an average of all frames. If from a single frame, it can be the first, last, minimal, or maximal pixel value. Averages include mean and, in versions 0.8.1 and later, the median. By default, the mean is used. (Note that using the median value may require allocation of a quantity of memory linear in the number of frames.) The syntax is as follows:

Invariant types
Syntax | Description
--- | ---
avg:<SSFE> | Mean value
median:<SSFE> | Median value
max:<SSFE> | Maximum value
min:<SSFE> | Minimum value
first:<SSFE> | First value
last:<SSFE> | Last value
<SSFE> | Same as avg:<SSFE>

Scaled Sampling Filter with Exclusion (SSFE)

SSFEs qualify SSFs, indicating whether exclusion regions should be honored.

Scaled sampling filter with exclusion (SSFE) types
Syntax | Description
--- | ---
ex:<SSF> | Honor exclusion regions
nex:<SSF> | Don't honor exclusion regions
<SSF> | Same as ex:<SSF>

Scaled Sampling Filter (SSF)

SSFs indicate whether filtering should occur at the resolution of the output image, or at the minimum of input and output image resolutions. The former prevents loss of details; the latter prevents aliasing.

Scaled sampling filter (SSF) types
Syntax | Description
--- | ---
fine:<SF> | Filter at full output image resolution
coarse:<SF> | Filter at minimum resolution
<SF> | Same as coarse:<SF>

SSF Options

    --afilter <s>     Use SSF <s> to interpolate points in alignment.

Sampling Filter (SF)

SFs are used to limit bandwidth. Primitive functions and pointwise multiplication of these functions (windowing) are available.

Sampling filter (SF) types
Syntax | Description
--- | ---
sinc | sinc filter
lanc:<x> | Lanczos, diameter x.
triangle:<x> | Triangle, diameter x.
box:<x> | Box, diameter x.
zero | Zero function
<f>*<f> | Pointwise multiplication (windowing)

Defaults

ALE defaults are as follows:

                         dchain         Varies by default setting
                         achain         Varies by default setting
                         afilter        internal (approximates triangle:2)