From TouchDesigner 099 Wiki


The TOP to CHOP converts pixels in a TOP image to CHOP channels. It generates one CHOP channel per scanline (row) in the image and per pixel color element (RGBA).

A single pixel, rows of pixels, columns of pixels or rectangular regions can be extracted from the image. It is therefore important to be aware of how many pixels your source image is composed of.

There is an optional input which supplies UV coordinates to sample the image. The input CHOP must contain 2 channels, for U and V. The first channel is always assumed to be U. The channels produced (red, green, blue and alpha) will be exactly as long as the input channel's length, with a value for each UV coordinate.

If you are grabbing pixels from a Depth TOP, you will only get a single channel (the depth). This will be placed in the R channel.

PythonIcon.png toptoCHOP_Class

Parameters - Image Page

TOP - Specify the TOP operator whose image will be sampled.

Download Type - Gives the option for a delayed data download from the GPU, which is much faster and does not stall the render.

Red / Green / Blue / Alpha - Creates a CHOP channel per scanline with the prefix specified here, starting at 0. For example, the default is "r" in the Red field. If the specified TOP is a horizontal ramp that is 5 lines high, it creates five CHOP channels (r0 - r4) using the values of the red pixels in those scanlines.

RGBA Units - Scales the output to lie in the range 0-1, 0-255 or 0-65535.

Parameters - Crop Page

Crop - Specifies what to extract from the image.

UV Units - Specifies the units for the following 4 parameters. The parameters can use the local variables $NR and $NC for the number of rows and columns.

U Start /ustart - Starting point for sampling in U. Values outside the range of the image are determined by the image's extend conditions, in the extend page.

U End /uend - Ending point for sampling in U.

V Start /vstart - Starting point for sampling in V.

V End /vend - Ending point for sampling in V.

Interpolate - Determines the interpolation method when UV sampling with an input CHOP.

Parameters - Extend Page

Image Left - The image extend conditions when sampling the image with U less than 0.

Image Right - The image extend conditions for U greater than 1.

Image Bottom - The image extend conditions for V less than 0.

Image Top - The image extend conditions for V greater than 1.

The extend conditions are:

  • Hold - Use the first or last pixel value.
  • Cycle - Loop back to the other side of the image.
  • Mirror - Zig-zag back into the image.
  • Default Color - Use a default color specified below.

Default Color - The color to use when outside the bounds of the image, and the Default Color extend condition is set.

Parameters - Channel Page

Start /start - The start position of the channel, expressed in units set by the units menu to the right (samples, frames or seconds). The channel length is determined by the number of pixels in each scanline that is converted into a channel.

Sample Rate /rate - The sample rate of the channels, in samples per second.

Extend Left / Extend Right /left /right - The left and right extend conditions (before/after range).

Default Value /defval - The default value for extend conditions.

Parameters - Common Page