Experimental:Math Mix POP

From Derivative
Jump to navigation Jump to search

Summary
[edit]

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.

PythonIcon.pngmathmixPOP_Class


Parameters - Inputs Page

Attribute Class attribclass - -
  • Point point -
  • Vertex vertex -
  • Primitive primitive -

Length Mismatch lengthmismatchnotif - -
  • Ignore ignore -
  • Warning warning -
  • Error error -

Length Mismatch Action lengthmismatchaction - -
  • Hold hold -
  • Repeat repeat -
  • Zero zero -
  • One one -
  • None none -

Group group -

Input input -
In POP input0pop -


Parameters - Uniforms Page

Vector vec -
Name vec0name -

Type 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 -

Value vec0value - -
  • Value vec0value0 -
  • Value vec0value1 -
  • Value vec0value2 -
  • Value vec0value3 -


Parameters - Combine Page

Combine comb -
Operation 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 -

Scope A comb0scopea -

Scope B comb0scopeb -

Scope C comb0scopec -

Result Scope 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

Delete Attributes delattrs -

Delete New Attributes delnewattribs -


Parameters - Common Page

Bypass bypass -

Delete Input Attributes delinputattrs -

Parameter Color Space parmcolorspace - - Controls how all color parameters on this node are interpreted. The color values as treated as being in the selected color space, and are converted to the Working Color Space before they are used as part of the node's operation. Note that this does not change the color space of the node itself, as that is always in the Working Color Space.
  • sRGB srgb - sRGB color space, with sRGB transfer function. Considered an SDR color space with respect to Reference White.


  • sRGB - Linear srgblinear - sRGB color space, with linear transfer function. Considered an SDR color space with respect to Reference White.


  • Rec.601 (NTSC) rec601ntsc - Rec.601 with NTSC primaries color space, with Rec.601 transfer function. Considered an SDR color space with respect to Reference White.


  • Rec.709 rec709 - Rec.709 color space, with Rec.709 (same as Rec.2020) transfer function. Considered an SDR color space with respect to Reference White.


  • Rec.2020 rec2020 - Rec.2020 color space, with Rec.2020 (same as Rec.709) transfer function. Considered an HDR color space with respect to Reference White.


  • DCI-P3 dcip3 - DCI-P3 color space, with D65 white point and 2.6 gamma transfer function. Considered an HDR color space with respect to Reference White.


  • DCI-P3 (D60) dcip3d60 - DCI-P3 "D60 sim" color space, with D60 white point, and 2.6 gamma transfer function. Considered an HDR color space with respect to Reference White.


  • Display-P3 (D65) displayp3d65 - Display-P3 color space, with D65 white point, and sRGB gamma transfer function. Considered an HDR color space with respect to Reference White.


  • ACES2065-1 aces2065-1 - ACES 2065-1 (also known as ACES AP0) color space, with a linear gamma transfer function. Considered an HDR color space with respect to Reference White.


  • ACEScg acescg - ACEScg (also known as ACES AP1) color space, with a linear gamma transfer function. Considered an HDR color space with respect to Reference White.


  • Passthrough passthrough - When selected, the color values will be used as-is in the operation, without any modification or attempt to convert them into the Working Color Space.

Parameter Reference White parmreferencewhite - - When converting a parameter color value to the Working Color Space, this controls how it should be treated with respect to Reference White. If the Working Color Space is the same Reference White, then no adjustment is done. If they are different, then the Reference White level (brightness) of this color will be adjusted to the range expected by the Working Color Space. For example if the project is set to have a SDR Reference White of 120 nits, and the HDR Reference White is 80 nits, then a color of (1, 1, 1), which is 120 nits in the SDR color space, will be converted to be (1.5, 1.5, 1.5), which is 120 nits still in the HDR Working Color Space.
  • Default For Color Space default - Will use either the SDR or the HDR Reference White, based on the color space selected.


  • Standard (SDR) sdr - Will treat the Parameter Color Space as SDR for it's reference white value.


  • High (HDR) hdr - Will treat the Parameter Color Space as HDR for it's reference white value.

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:

POPs
Experimental:Accumulate • Experimental:Analyze • Experimental:Attribute Combine • Experimental:Attribute Convert • Experimental:Attribute • Experimental:Blend • Experimental:Box • Experimental:Cache Blend • Experimental:Cache • Experimental:Cache Select • Experimental:CHOP to • Experimental:Circle • Experimental:Convert • Experimental:Copy • Experimental:CPlusPlus • Experimental:Curve • Experimental:DAT to • Experimental:Delete • Experimental:Dimension • Experimental:DMX Fixture • Experimental:DMX Out • Experimental:Extrude • Experimental:Facet • Experimental:Feedback • Experimental:Field • Experimental:File In • Experimental:Force • Experimental:GLSL Advanced • Experimental:GLSL Copy • Experimental:GLSL Create • Experimental:GLSL • Experimental:GLSL Select • Experimental:Grid • Experimental:Group • Experimental:Histogram • Experimental:Import Select • Experimental:In • Experimental:Limit • Experimental:Line Break • Experimental:Line Divide • Experimental:Line Metrics • Experimental:Line • Experimental:Line Smooth • Experimental:Line Thick • Experimental:Lookup Attribute • Experimental:Lookup Channel • Experimental:Lookup Texture • Experimental:Math Combine • Experimental:Math Mix • Experimental:Math • Experimental:Merge • Experimental:Neighbor • Experimental:Noise • Experimental:Normal • Experimental:Normalize • Experimental:Null • Experimental:Out • Experimental:Particle • Experimental:Pattern • Experimental:Phaser • Experimental:Point File In • Experimental:Point Generator • Experimental:Point • Experimental:Points, Vertices and Primitives in s • Experimental:Polygonize • Experimental:Primitive • Experimental:Projection • Experimental:Proximity • Experimental:Quantize • Experimental:Random • Experimental:Ray • Experimental:Rectangle • Experimental:ReRange • Experimental:Revolve • Experimental:Select • Experimental:Skin Deform • Experimental:Skin • Experimental:SOP to • Experimental:Sort • Experimental:Sphere • Experimental:Sprinkle • Experimental:Subdivide • Experimental:Switch • Experimental:Texture Map • Experimental:TOP to • Experimental:Topology • Experimental:Torus • Experimental:Trail • Experimental:Transform • Experimental:Trig • Experimental:Tube • Experimental:Twist