# Function compositing node

Performs a variety of mathematical functions on the input image.

This operation performs a mathematical function on the input image. The operations available are:

• Abs(x) - Absolute Value. Makes all negative values positive

• Sign(x) - Sign function. Returns 1 if positive, -1 if negative or 0 if zero

• -x - Negate

• 1/x - Reciprocal*

• Floor(x) - Rounds down all fractional values to the next lower integer

• Round(x) - Rounds all fractional values to the nearest integer

• Ceil(x) - Rounds down fractional values to the next higher integer

• Sqrt(x) - Square Root**

• x^E - Raises the value to an exponent, given by the exponent parameter (may produce errors if E is fractional and x is negative)

• B^x - Raises the base to the exponent 'value' (may produce errors if base is negative and value is fractional)

• e^x - Computes e^x, where e is 2.7182…

• Log(x) - Computes Log (base B) of the value. B is defined by the 'Base' parameter *

• Ln(x) - Computes the Natural Log (base e) of the value *

• Sin(x) - Computes the sine of x (x is in degrees)

• Sin(360x) - Computes the sine of (x times 360), which is easy to use with 0-1 values (x is in degrees/360)

• Cos(x) - Computes the cosine of x (x is in degrees)

• Cos(360x) - Computes the cosine of (x times 360) (x is in degrees)

• Tan(x) - Computes the tangent of x (x is in degrees). Produces a mathematical error for values of 90, -90, 270, -270

• Tan(360x) - Computes the tangent of x times 360 (x is in degrees). Produces a mathematical error for values of 0.25, -0.25, 0.75, -0.75

• ASin(x) - Computes the arcsine of x, returning the result in degrees. Produces a mathematical error if x is greater than 1 or less than -1

• ASin(x)/360 - Computes the arcsine of x, returning the result in the range -1 to 1. Produces a mathematical error if x is greater than 1 or less than -1

• ACos(x) - Computes the arccosine of x, returning the result in degrees. Produces a mathematical error if x is greater than 1 or less than -1

• ACos(x)/360 - Computes the arccosine of x, returning the result in the range -1 to 1. Produces a mathematical error if x is greater than 1 or less than -1

• ATan(x) - Computes the arctangent of x, returning the result in degrees

• ATan(x)/360 - Computes the arctangent of x, returning the result in the range -1 to 1

• Sinh(x) - Computes the hyperbolic sine of x

• Sinh(360x) - Computes the hyperbolic sine of (x times 360)

• Cosh(x) - Computes the hyperbolic cosine of x

• Cosh(360x) - Computes the hyperbolic cosine of (x times 360)

• Tanh(x) - Computes the hyperbolic tangent of x

• Tanh(360x) - Computes the hyperbolic tangent of (x times 360)

x is the input pixel value.

• - Produces a mathematical error if the value is zero. See the 'Error Handling' parameter.

• - Produces a mathematical error if the value is negative. See the 'Error Handling' parameter.

## Scoping

This operation may be restricted to certain planes, or components of planes. In addition, the operation may be applied to a subset of frames within the sequence. An image must have both its frame and plane scoped to be modified.

Images that are not modified are passed through, which does not take any memory or processing time.

This operation may be masked, which restricts the operation to an area of the image. The mask may be inverted, brightened or dimmed.

The mask input is on the side of the node. The label on the connector indicates the plane being used as a mask.

The mask input can also be scaled to fit the output image’s resolution, if they differ. If this node is changing constantly, and the mask is not, it is somewhat faster to put a Scale COP down to do the resize for the mask image. Otherwise, the scale will occur every time this node cooks.

## Collapsible Pixel Operation

This is a collapsible pixel operation. When placed in sequence with other collapsible pixel operations, the operations are combined into one operation at the final node in the pixel operation sequence. This is known as a collapsible pixel operation chain.

Image data flowing through the chain is only quantized at the end of the chain. This allows the intermediate operations to produce and carry values outside the normal range of the pixels' data format, with floating point precision. The net result of this is a reduction in quantization error and black/white clipping (especially useful for integer formats).

Collapsible pixel operations are recognizable by the light blue background color of the node’s icon. If a node of a different color is inserted between two collapsible COPs, the chain will be broken at that point and the operations will not collapse anymore.

Collapsible pixel operations are maskable and scopable. If one operation in the chain is masked, but the others are not (or do not share the same mask), the chain will be 'broken' at that point and quantization will occur at that node. Differences in scoping does not cause a break in the chain.

## Function

Function

The math function to perform.

Base

The base for LogX and B^x.

Exponent

The exponent for x^E.

Error Handling

On a math error, the value causing the error can be replaced with an error value or kept as is.

Error Value

The value to replace errors with.

## Collapsible Pixel Operation Parameters

Collapsible pixel operations can be combined with other collapsible pixel operations and have the result computed in one pass, rather than at each node. The operations must be in sequence, without other nodes between them.

Do Operation in Unpremultiplied Space

The Color plane will the divided by the input alpha, and multiplied by the output alpha so that the color operation is done in unpremultiplied space. If this operation is in a collapsible chain, all the nodes in the chain must have the same setting of this parameter to avoid breaking the chain and quantizing.

Quantize

If this node is in the middle of a collapsible pixel chain, you can force this node to quantize and store the images at this node.

A mask can be chosen to limit the effect of the operator to areas defined by the mask. The mask can be taken from the mask input (side input) or from the first input itself.

Effect Amount

If no mask is present, this blends the output with the input by a constant amount (0 = all input, 1 = all output).

A mask can be a component of a plane or an entire plane. If a vector plane is supplied as a mask, its components are multiplied by the images' components.

```C.r = I.r * M
C.g = I.g * M
C.b = I.b * M

```

```C.r = I.r * M.r
C.g = I.g * M.g
C.b = I.b * M.b

```

First Input

Useful for masking the operation to the image’s own alpha plane.

Off

If the mask image is a different resolution than the output image, turning on this parameter will scale the mask to the output image’s resolution.

If this node is changing constantly, and the mask is not, it is somewhat faster to put a Scale COP down to do the resize for the mask image. Otherwise, the scale will occur every time this node cooks.

Inverts the mask so that all fully 'masked' portions become unmasked. This saves you from inserting an Invert COP after the node with the mask.

## Scope

Plane Scope

Specifies the scope for both the RGB components of Color, Alpha, and other planes. The (C)RGBA mask only affects Color components and Alpha. 'C' will toggle all the RGB components.

For planes other than Color and Alpha, the plane name (plus component, if applicable) should be specified in the string field. The pulldown menu can be used to select planes or components present in this node.

A plane is specified by its name. A component is specified by both its plane and component name. The '*' wildcard may be used to scope all extra planes. Any number of planes or components can be specified, separated by spaces.

Examples:

```P
N.x N.y
P N Pz
```

## Frame Scope

Frame Scope

Allows scoping of specific frames in the frame range. This is in addition to the plane scope (so a plane at a certain frame must be both plane scoped and frame scoped to be modified).

All Frames

All frames are scoped.

Inside Range

All frames inside a subrange are scoped.

Outside Range

All frames outside a subrange are scoped.

Even Frames

Even numbered frames are scoped.

Odd Frames

Odd numbered frames are scoped.

Specific Frames

A user-defined list of frames are scoped.

Frame Range

For Inside/Outside range, this parameter specifies the subrange of the sequence to scope (or unscope). This can be edited in Timeline viewer mode (⌃ Ctrl + 2 in viewer).

Frame Dropoff

For Inside/Outside Range, this parameter specifies certain number of frames before and after to slowly ramp up to scoped. The operation will be blended with its input to 'ease in' or 'ease out' the scoping effect over a number of frames. This can be edited in Timeline viewer mode (⌃ Ctrl + 2 in viewer).

Non-scoped Effect

For unscoped frames, this sets the blend factor between the input and modified images. Normally this is zero (use the input image). By setting this to a non-zero value, you can make unscoped frames be 'slightly' unscoped. The value can vary between 0 (unscoped) and 1 (scoped).

Frame List

The frame list for 'Specific Frames'. Frame numbers should be separated by spaces.

If the sequence range changes, enabling this parameter will adjust the subrange and frame dropoff lengths to fit the new range.

## Locals

L

Sequence length

S

Start of sequence

E

End of sequence

IL

Input sequence length

SR

Sequence frame rate

NP

Number of planes in sequence

W,H

Width and height of image

I

Image index (0 at start frame)

IT

Image time (0 at start frame)

AI

Current plane array index

PI

Current plane index

PC

Num of channels in current plane

CXRES

Composite Project X resolution

CYRES

Composite Project Y resolution

CPIXA

Composite Project pixel aspect ratio

CDEPTH

Composite Project raster depth

CBP

Composite Project black point

CWP

Composite Project white point

# Compositing nodes

• Creates an anaglyph from a pair of input images.

• Composites the first input (Foreground) over the second (background), but only where the background alpha exists.

• Averages the foreground image and the background image.

• Blends frames from two sequences together using a simple linear blend.

• Blurs an image.

• Adds a border to the image.

• Applies a brightness factor and bright shift to the first input.

• Builds a bump map from a plane.

• Copy channels from any of inputs into the output image.

• Mask or "key" an image based on its color.

• Creates a constant color image.

• Applies a variety of color corrections to the image

• Adjusts the R,G,B and/or A channels based on a user-defined curve.

• Maps a range of color to a new range.

• Replace a color region in an image with another region.

• Generates a simple HSV color wheel.

• Does a composite (over, under, inside, add, etc) between two images.

• Composite nodes create, filter, and manipulate image data.

• Increases or decreases the contrast of an image.

• Changes the data format of a plane.

• Performs a generic convolve on the source image.

• Fits an image into an arbitrary quadrilateral.

• Generates a four corner ramp.

• Crops an image and changes its resolution.

• Extracts matte from Cryptomatte image.

• Flattens a Deep Shadow/Camera Map into a flat 2D raster.

• Defocuses an image similar to a real camera defocus.

• Deforms an image by moving the underlying UV coordinates.

• Removes film grain from an image.

• De-interlaces a frame of video by either averaging scanlines or copying a scanline.

• Removes planes or components from an input sequence.

• Removes white noise from an image.

• Darkens depth boundaries in an image.

• Creates a depth-of-field mask, which describes how out of focus parts of the image are.

• Computes the difference between the foreground image and the background image.

• Expands and shrinks mattes.

• Creates a blurred shadow offset of an image.

• Blurs the edges of an image.

• Detects edges in the input image.

• Adds a lighting effect to the image by using a bump map.

• Applies an environment map to an image.

• Equalizes colors by stretching or shifting the image histogram.

• Creates an image containing precomputed error function terms for hair albedo computation

• Expands and shrinks mattes.

• Extends the length of a sequence so that it can be animated beyond its frame range.

• Fetches a sequence of images from another COP, even in another network.

• Merges two fields into one Interlaced Frame.

• Splits an interlaced frame into two fields per frame (odd and even fields).

• Swaps the two fields containing the even and odd scanlines of the frame.

• Loads image files into Houdini.

• Flips the image horizontally and/or vertically.

• Adds a variety of atmospheric effects to an image, including fog, haze and heat waves.

• Renders anti-aliased text.

• Cleans up flipped normals by making them face the camera.

• Performs a variety of mathematical functions on the input image.

• Applies gamma correction to the image.

• Keys out parts of the image based on pixel position or normal direction.

• Renders geometry from a SOP as a single color image.

• Computes the gradient of an image.

• Adds grain to an image.

• Converts between RGB and HSV color spaces, or applies hue and saturation modifications.

• Adjusts the saturation or luminance of the image based on hue.

• Detects illegal pixels, like NAN and INF, in images.

• Restricts the foreground color to the area of the background’s alpha matte.

• Interleaves image sequences.

• Applies a photographic pixel inversion to the image.

• Layers a series of inputs together by compositing them one by one on the background image (input 1).

• Adjusts black point, white point, and midrange to increase, balance, or decrease contrast.

• Adds a light to the image.

• Limits the pixel range at the high end, low end or both.

• Applies a lookup table to the input.

• Sets the alpha to the luminance of the color.

• Keys the image based on luminance (or similar function).

• Masks out an area of an image.

• Outputs the maximum value of the foreground and background images for each pixel, which tends to lighten the image.

• Applies a 3 x 3 or 5 x 5 median filter to the input image.

• Merges the planes of several inputs together.

• Applies metadata to an image sequence.

• Outputs the minimum value of the foreground and background images for each pixel, which tends to darken the image.

• Converts a color or vector into a scalar quantity, like luminance or length.

• Takes a sequence of images and combines them into 1 image by tiling them.

• Multiplies the foreground image with the background image.

• Generates continuous noise patterns.

• Does nothing.

• Restricts the foreground color to the area outside of the background’s alpha matte.

• Composites the first input (Foreground) over the second (background).

• Modifies an image’s pixels using expressions.

• Allows colour to be converted to or from a premultiplied form.

• Performs a pulldown (cine-expand) on the input sequence.

• Performs a pushup (cine-expand) on the input sequence.

• Quantizes input data into discrete steps.

• Renders frames out to disk.

• Does a radial or angular blur.

• Generates a variety of linear and radial ramps, which are fully keyframable.

• Copies the sequence information from its input.

• Change the name a plane.

• Renders a mantra output driver directly into a composite network.

• Simply reverses the frames in the sequence.

• Draws one or more curves or shapes.

• Imports a 2d Volume from SOPs as planes into a composite network.

• Changes the resolution of the image.

• Sequences two or more inputs end to end.

• Generates simple shapes, such as circles, stars and regular N-sided polygons.

• Sharpens an image by enhancing the contrast of edges.

• Shifts an image sequence in time.

• Shuffle frames around to do out-of-order editing.

• Creates sky and ground images for use as environment maps.

• Either removes frames from a sequence or allows you to order them in a user-defined order.

• Streaks an image, adding a motion blur effect.

• Contains networks of other COPs.

• Subtracts the foreground image from the background image.

• Passes the input of one of its connected inputs through, acting like an exclusive switch.

• Replaces input 1's alpha with input 2's alpha.

• Generate noise suitable for terrain height maps.

• Tiles the image sequence with multiple copies of the input image.

• Blurs a pixel through several frames.

• Uses a second input to time warp the first input on a per pixel basis.

• Stretches or compresses a sequence in time.

• Warps time by slowing or speeding it up throughout the sequence.

• Translates, rotates and/or scales the input image without changing the image resolution.

• Trims an input sequence in time by adjusting the beginning or the end of the sequence.

• Creates a UV map.

• Composites the first input (Foreground) under the second (background).

• Extracts an arbitrary quadrilateral area out of the input image.

• Runs a VEX script on its input planes.

• Runs a VEX script on the planes it generates.

• Contains a VOP network that filters input image data.

• Contains a VOP network that generates image data.

• Performs vector operations on the input.

• Blurs an image by using pixel velocity to produce a motion blur effect.

• Cuts a small window out of a larger image.

• Does a wipe between two input sequences.

• Makes two elements mutually exclusive; if their alpha mattes overlap, the overlap is removed.

• Does a Z composite of two images.