Docs Visual

ColorGenPro

A cosine palette generator in GLSL: the full coefficient set per channel, an RGB and D mode, blackout and soft regions, and a lookup ramp as a second output.

◧ Visual ◆ Patreon · Pro

Why use it

The cosine palette, pow(a + b*cos(2PI*(c*t+d)), e) per channel, gives smooth gradients that loop cleanly and animate with a single phase. Using it in a project means writing a GLSL TOP, wiring fifteen values into its uniforms, and adding a Lookup TOP to put the result on an image.

ColorGenPro has the formula with every coefficient open, an RGB and D mode that collapses them to one offset, amplitude and exponent when you want fewer knobs, and a blackout region that keeps the start of the palette black. The palette comes out as a colour strip and colours your image through a lookup in the same node.

Features

  • Cosine palette with every coefficientOffset, amplitude, period, phase and exponent for red, green and blue, for smooth gradients that loop cleanly.
  • RGB and D modeDrives the three phases from one Offset, Amplitude and Exponent, so a single value scrolls the whole palette.
  • Blackout regionKeeps the start of the palette black, added to the length or taken from the colours, with a soft edge you shape.
  • Palette strip outputout_col is the palette as a colour strip, and Length sets how many colours it holds.
  • Colour an image through the paletteout_lookup colours the input image through the palette; with nothing wired a built-in 0 to 1 ramp shows the palette.
  • Reset to the shipped coefficientsDefault restores the shipped coefficients and leaves any parameter driven by an expression alone.

How to use it

  1. Create it from the FNS tab of the OP Create dialog. On a bare drop both outputs show the palette, because a built-in 0 to 1 ramp stands in for the missing input.
  2. Shape the palette with the coefficients under the formula header, each set for red, green and blue. a (Offset) is the base brightness, b (Amplitude) how far each channel swings around it, and c (Period) how many colour cycles fit along the palette. The hues come from d (Phase): offsetting the three channels from each other is what makes colour. e (Exponent) deepens a channel above 1 and lifts it below 1.
  3. For fewer knobs, switch on RGBD Mode. The three d values then follow Offset, Amplitude and Exponent: Offset sets the phase of red, and green and blue follow from it, so animating Offset alone scrolls the whole palette. Amplitude at 0 puts all three channels in phase, which gives greys. Switching RGBD Mode on restores the shipped coefficients first, so note any values you want to keep.
  4. Colour an image: wire it into the input and take out_lookup. A greyscale source, such as a Noise TOP or a depth image, maps cleanly: dark values take the start of the palette, bright values its end. Input Smoothness on Nearest picks exact palette entries, which with a short Length gives distinct bands; Linear blends between neighbours.
  5. To keep the darkest values black, raise Blackout. That share at the start of the palette fades to black. Reductive at 0 adds the black on top of Length, at 1 it takes it from the colours. Soften Black, Soften Exponent and Soften Extend shape the fade into the palette.
  6. To start over, pulse Default. It restores the shipped coefficients and the RGBD values, and leaves any parameter driven by an expression as it is.

ColorGenPro is the Pro sibling of ColorGen, which shapes its palette with a phase step and exponents.

Palette behavior

Each channel is clamped at zero before the exponent is applied, so no pixel goes invalid. When b (Amplitude) is larger than a (Offset), the troughs of that channel's swing therefore clip to black. Keep a at or above b and nothing clips.

Inputs and outputs

  • in1 (TOP): the image to colour through the palette; with nothing wired, a built-in 0 to 1 ramp is used, so both outputs show the palette on a bare drop.
  • out_col (TOP): the palette strip.
  • out_lookup (TOP): the input coloured through the palette.

Get it

This tool unlocks with Patreon. It installs through the same picker as everything else and unlocks with the Patreon Pro tier or higher, connected from inside TouchDesigner. Everything else in the toolkit stays free and MIT, and the membership is what keeps that work moving.

Join on Patreon → How unlocking works →

Parameters

Custom

ControlType / defaultWhat it does
LengthLength number256 Number of colours in the palette (the width of out_col). Blackout with Reductive at 0 adds its share on top of this.
Input SmoothnessInputfiltertype menuInterpolate Pixels Sampling filter the lookup uses on the input image: Nearest picks exact palette entries, Linear blends between neighbours.
Options: Nearest Pixel, Interpolate Pixels, Mipmap Pixels
BlackoutBlackout number0 Share of the palette (0 to 1) that fades to black at its start. Reductive decides whether that share is added to the length or taken from the colours; above 0 it enables the Soften parameters.
ReductiveLensubtract number0 How Blackout makes room: 0 extends the palette by the blackout share, 1 keeps Length and takes the blackout from the colours.
Soften BlackBlacksoften number0.5 Width of the fade from black into the palette, as a share of the blackout region. 0 is a hard edge, 1 fades across the whole region.
Soften ExponentSoftenexponent number1 Curve of the black fade: 1 is linear, higher values stay dark longer, below 1 brighten early.
Soften ExtendSoftenextend menuZero/Hold What the palette does inside the blackout region under the fade: Mirror reflects it, Zero/Hold holds the first colour, Repeat continues the cycle backwards.
Options: Mirror, Zero/Hold, Repeat
pow(a + b*cos( 2PI * (c*t+d) ), e)
a (Offset)A number0.5 a (Offset) for red, green, blue: the base brightness the cosine swings around.
b (Amplitude)B number0.5 b (Amplitude) for red, green, blue: how far the cosine swings above and below a. Values above a clip to black at the troughs.
c (Period)C number1 c (Period) for red, green, blue: how many colour cycles fit along the palette.
d (Phase)D number0 d (Phase) for red, green, blue: shifts each channel's cycle; offsetting the three is what makes hues. Driven by Offset, Amplitude and Exponent while RGBD Mode is on.
e (Exponent)E number1 e (Exponent) for red, green, blue: gamma on each channel; above 1 deepens, below 1 lifts.
RGBD ModeRgbdmode on / offoff Drive the three d (Phase) values from Offset, Amplitude and Exponent instead of setting them by hand. Switching it on restores the shipped coefficients first.
OffsetOffset number0 RGBD Mode: phase of the red channel; green and blue follow from it.
AmplitudeAmplitude number0.2 RGBD Mode: phase spread from red to blue. 0 puts all three channels in phase (greys).
ExponentExponent number1 RGBD Mode: where green sits between red and blue in the spread: 1 halfway, higher values toward red.
DefaultDefault button Restore the shipped coefficients (a, b, c, d, e) and the RGBD Offset, Amplitude and Exponent. Parameters driven by an expression are left alone.