Experimental:Math Mix POP
Summary
The Math Mix POP can do a series of math operations in one node. It is a simpler version of the Math Combine POP. Each sequential block on Math Mix's Combine page is an operation that can combine one, two or three attributes. There are over 70 different operations to choose from, such as A + B, sin(A), or clamp(A, B, C) (clamp A to be be between B and C). A, B and C are attribute names of the incoming POPs.
It allows multiple inputs, but all inputs' attributes are auto-named. The first input's attributes have their names unchanged, but the second input's attributes are prefixed with in1_
, such as in1_Tex
. Attribute names are prefixed with in2_
etc for the other inputs. These attribute names appear in the menus to the right of each Scope A B and C on the Combine page.
On the Inputs page, Math Mix lets you choose whether you are operating on point, vertex or primitive attributes. Its architecture for handling multiple inputs to POPs is similar to the Attribute Combine POP.
Where you specify the attribute name, you can put constant numbers, or constant vectors like .3 .4 .5
.
It gives you choices, when the input sizes don’t match, of erroring, warning or ignoring, and how to make them align.
The inputs can include POPs that are a single point and are treated as constant values when combined with multi-point POPs.
On the Uniforms page you can also specify temporary attributes that have a constant value or values, that also can be used on the Combine page.
You can specify groups of points/vertices to operate on, others being untouched or left at default values.
Combine page:
Each sequential block lets you operate on one, two or three attributes, depending on what you choose in the Operation menu.
- Operation (about 60 possible operations) . It handles combining floats with floats, floats with vectors, and vectors with vectors.
- Scope A - an attribute
- Scope B - an attribute (if applicable)
- Scope C - an attribute (if applicable)
- Result Scope (an existing attribute name, components, or a new attribute name)
Since we can put in the Scope A, B or C things like P(0) P(2) N(0)
, you can actually mix and reorder components and put the results in any (other) component combination of one attribute.
It does math on combinations of individual components (a “component” here is one number of a float2 float3 or float4 attribute type).
NOTE: From the Scopes' menu on the right you can choose from the auto-named attributes, the new attributes you created, and also via the > at the bottom of the menu the set of very useful built-in attributes (they all start with a _
. They include the point index, normalized indexes, the time slice step time, Pi, dimensions, num points, etc
The Result Scope directs results to the output attributes. You specify the name of the attribute you want to create or over-write, and it will do its best to figure out its properties - type and size. It visually shows in italics what attribute that a block would be writing to, without you explicitly specifying.
NOTE: You can use constant values in place of attributes - Where you specify an attribute name to combine, you can instead type a constant value for a float, float2, float3 float4. like .2 .3 .4
- Output page - lets you keep or delete temporary attributes:
- Delete Attributes - which ones to delete from the output
- Delete New Attributes toggle
The info popup contains pseudocode of what the operations are doing, for easy reading.
Attaching an Info DAT will show you raw GLSL code that is generated.
NOTE: angles are in degrees
inputs do not copy the attributes - they remain as all references to attribute arrays in the incoming POPs.
Parameters - Inputs Page
attribclass
- ⊞ -
- Point
point
-
- Vertex
vertex
-
- Primitive
primitive
-
lengthmismatchnotif
- ⊞ -
- Ignore
ignore
-
- Warning
warning
-
- Error
error
-
lengthmismatchaction
- ⊞ -
- Hold
hold
-
- Repeat
repeat
-
- Zero
zero
-
- One
one
-
- None
none
-
group
-
input
-
input0pop
-
Parameters - Uniforms Page
vec
-
vec0name
-
vec0type
- ⊞ -
- float
float
-
- float2
float2
-
- float3
float3
-
- float4
float4
-
- double
double
-
- double2
double2
-
- double3
double3
-
- double4
double4
-
- int
int
-
- int2
int2
-
- int3
int3
-
- int4
int4
-
- uint
uint
-
- uint2
uint2
-
- uint3
uint3
-
- uint4
uint4
-
vec0value
- ⊞ -
- Value
vec0value0
-
- Value
vec0value1
-
- Value
vec0value2
-
- Value
vec0value3
-
Parameters - Combine Page
comb
-
comb0oper
- ⊞ -
- None
none
-
- A
copya
-
- abs(A)
abs
-
- sign(A)
sign
-
- sqrt(A)
sqrt
-
- A * A
square
-
- 1 / A
inverse
-
- round(A)
round
-
- floor(A)
floor
-
- ceil(A)
ceil
-
- int(A)
int
-
- fract(A)
fract
-
- normalize(A)
normalize
-
- exp10(A)
exp10
-
- exp2(A)
exp2
-
- exp(A)
exp
-
- log10(A)
log10
-
- log2(A)
log2
-
- ln(A)
ln
-
- sin(A)
sin
-
- cos(A)
cos
-
- tan(A)
tan
-
- asin(A)
asin
-
- acos(A)
acos
-
- atan(A)
atan
-
- degrees(A)
degrees
-
- radians(A)
radians
-
- length(A)
length
-
- compadd(A)
compadd
-
- compsub(A)
compsub
-
- compmult(A)
compmult
-
- compdiv(A)
compdiv
-
- compavg(A)
compavg
-
- compmin(A)
compmin
-
- compmax(A)
compmax
-
- A + B
add
-
- A - B
asubb
-
- B - A
bsuba
-
- A * B
mult
-
- A / B
adivb
-
- B / A
bdiva
-
- A ** B
apowerb
-
- logB(A)
logba
-
- avg(A, B)
avg
-
- min(A, B)
min
-
- max(A, B)
max
-
- mod(A, B)
mod
-
- int(A / B)
intadivb
-
- A > B
gt
-
- A >= B
gte
-
- A < B
lt
-
- A <= B
lte
-
- A == B
eq
-
- A != B
ne
-
- atan2(A, B)
atan2
-
- dot(A, B)
dot
-
- angle(A, B)
angle
-
- cross(A, B)
cross
-
- A + B * C
aaddbmultc
-
- A * B + C
amultbaddc
-
- mix(A, B, C)
mix
-
- A if C else B
ifelse
-
- loop(A, B, C)
loop
-
- zigzag(A, B, C)
zigzag
-
- clamp(A, B, C)
clamp
-
- smoothstep(A, B, C)
smoothstep
-
- B <= A < C
bltealtc
-
- B < A <= C
bltaltec
-
- B < A < C
bltaltec
-
- B <= A <= C
bltaltec
-
- A + B + C
aaddbaddc
-
- A * B * C
amultbmultc
-
- rangefrom(A, B, C)
rangefrom
-
- rangeto(A, B, C)
rangeto
-
- reflect(A, B)
reflect
-
- refract(A, B, C)
refract
-
comb0scopea
-
comb0scopeb
-
comb0scopec
-
comb0result
- ⊞ -
- Color
Color
-
- Color(0) Color(1) Color(2)
Color(0) Color(1) Color(2)
-
- N
N
-
- Tex
Tex
-
- Color.i012
Color.i012
-
Parameters - Output Page
delattrs
-
delnewattribs
-
Parameters - Common Page
bypass
-
delinputattrs
-
Operator Inputs
- Input 0: -
Info CHOP Channels
Extra Information for the Math Mix POP can be accessed via an Info CHOP.
Common POP Info Channels
Common Operator Info Channels
- total_cooks - Number of times the operator has cooked since the process started.
- cook_time - Duration of the last cook in milliseconds.
- cook_frame - Frame number when this operator was last cooked relative to the component timeline.
- cook_abs_frame - Frame number when this operator was last cooked relative to the absolute time.
- cook_start_time - Time in milliseconds at which the operator started cooking in the frame it was cooked.
- cook_end_time - Time in milliseconds at which the operator finished cooking in the frame it was cooked.
- cooked_this_frame - 1 if operator was cooked this frame.
- warnings - Number of warnings in this operator if any.
- errors - Number of errors in this operator if any.
TouchDesigner Build: