Houdini 19.0 Nodes Channel nodes Math

Math channel node

Perform a variety of arithmetic operations on and between channels.

On this page

This CHOP allows you to perform a variety of arithmetic operations on and between channels. Channels of a CHOP can be combined, and several CHOPs can be combined.

Unary Operations

Unary operations are performed on individual channels. Unary operations are:

Off

Don’t do anything to the channel.

Negate

Take the negative value of each sample of the channel.

Positive

Make negative values of the channel positive (absolute).

Root

Take the square root of all values in the channel.

Square

Square all the values in the channel.

Inverse

Take the inverse (1/x) of all values in the channel.

Combine Channels

Operations between channels can be done within an input or between inputs. The operations are done on a sample by sample basis:

Off

Don’t combine the channels.

Add

Sum all the channels.

Subtract

Subtract all the channels from the first.

Multiply

Take the product of all the channels.

Divide

Divide the first channel by all the rest.

Average

Take the average of all the channels.

Maximum

Take the maximum value of all the channels.

Minimum

Take the minimum value of all the channels.

Length

Assume the channels are a vector and compute its length.

Parameters

OP

Channel Pre OP

A menu of unary operations that are performed on single channels as they come in to the Math CHOP.

Combine Channels

A menu of operations that is performed between the channels of a single input CHOP, for each input.

Combine CHOPs

A menu of operations that is performed between the input CHOPs, combining several CHOPs into one.

Channel Post OP

A menu of more unary operations that is performed on the channels resulting from the above operations.

Match By

Match channels between inputs by name or number.

When matching by name, the number of output channels is the number of channels from the first input. For each channel of the first input, the channel of the same name is taken from the other inputs. If a channel name cannot be found, then it is omitted. Only the channels whose names occur in the first input will be used to generate the output channels. Channels whose names do not occur in the first input will not affect the output channels.

When matching by number, the number of output channels is the maximum number of channels out of all the inputs. Then for each input, the original sequence of channels is repeated to match the number of output channels.

Match Failure

It is sometimes desirable to produce a warning or an error when channels in the first input fail to be correctly matched to channels in the other inputs. A failure may occur when matching by Channel Number if an input has fewer channels than input 1, or when matching by Channel Name if a channel name cannot be found in input 1.

Align

The alignment to use when aligning channels from different inputs. See the help for the Merge CHOP.

Mult-Add

Pre-Add

First, add value to each new channel.

Multiply

Then multiply by this value.

Post-Add

Then add this value.

Range

From/To Range

Another way to multiply/add. Converts from one low-high range to another range.

Common

Some of these parameters may not be available on all CHOP nodes.

Scope

To determine which channels get affected, some CHOPs have a scope string. Patterns can be used in the scope, for example * (match all), and ? (match single character).

The following are examples of possible channel name matching options:

chan2

Matches a single channel name.

chan3 tx ty tz

Matches four channel names, separated by spaces.

chan*

Matches each channel that starts with chan.

t?

The ? matches a single character. t? matches two-character channels starting with t.

r[xyz]

Matches channels rx, ry and rz.

blend[3-7:2]

Matches number ranges giving blend3, blend5, and blend7.

blend[2-3,5,13]

Matches channels blend2, blend3, blend5, blend13.

t[xyz]

[xyz]matches three characters, giving channels tx, ty and tz.

Sample Rate Match

The Sample Rate Match Options handle cases where multiple input CHOPs’ sample rates are different.

Resample At First Input’s Rate

Use rate of first input to resample others.

Resample At Maximum Rate

Resample to highest sample rate.

Resample At Minimum Rate

Resample to the lowest sample rate.

Error if Rates Differ

Does not accept conflicting sample rates.

Units

The units for which time parameters are specified.

For example, you can specify the amount of time a lag should last for in seconds (default), frames (at the Houdini FPS), or samples (in the CHOP’s sample rate).

Note

When you change the Units parameter, it does not convert the existing parameters to the new units.

Time Slice

Time Slicing is a feature which boosts cooking performance and reduces memory usage. Traditionally, CHOPs calculate the channel over its entire frame range. If the channel does need to be evaluated every frame, then cooking the entire range of the channel is unnecessary. It is more efficient to calculate only the fraction of the channel that is needed. This fraction is known as a Time Slice.

Unload

Causes the memory consumed by a CHOP to be released after it is cooked and the data passed to the next CHOP.

Export Prefix

The Export prefix is prepended to CHOP channel names to determine where to export to.

For example, if the CHOP channel was named geo1:tx, and the prefix was /obj, the channel would be exported to /obj/geo1/tx.

Note

You can leave the Export Prefix blank, but then your CHOP track names need to be absolute paths, such as obj:geo1:tx.

Graph Color

Every CHOP has this option. Each CHOP gets a default color assigned for display in the Graph port, but you can override the color in the Common page under Graph Color. There are 36 RGB color combinations in the Palette.

Graph Color Step

When the graph displays the animation curves and a CHOP has two or more channels, this defines the difference in color from one channel to the next, giving a rainbow spectrum of colors.

Locals

I

The current index.

V

The current value.

C

Current channel index (0 to NC-1).

NC

Total number of channels.

Examples

MathBasic Example for Math channel node

These examples demonstrate the ability of the Math CHOP to combine multiple channels together.

The first example shows two different methods of controlling the amplitude of a sine wave. The second example shows three different channels combined into one.

See also

Math