2799c6257e9a6e58da975fdc62f9d80d27095f4b
More Math
Adds math nodes for numbers and types which do not need it. I got inspired by was_extras node.
#WARNING This node is not compatible to ComfyUI-Impact-Pack which forces older antlr version.
Quickstart
- Install ComfyUI.
- Clone this repository into
ComfyUI/custom_nodes. - Restart ComfyUI.
You can also get the node from comfy manager under the name of More math.
Features
- expression parsing with support for functions and variables:
- functions:
- run expressions on both components of CONDITIONING (not that I know what they do), LATENT, IMAGE, NOISE and FLOAT
- math operators (binary and unary +,- and ^,*,/,%)
- boolean operators (false = 0.0; true = 1.0) (<,<=,>,>=,==,!=)
- sin, cos, tan
- asin, acos, atan (can produce NaN outside range -1...1)
- atan2 (x,y)
- sinh, cosh, tanh
- asinh, acosh, atanh (can produce NaN outside range -1...1)
- abs, sqrt (produces NaN on negative numbers), ln (log with base e), log (base 10), exp, pow
- smin, tmin, smax, tmax, tnorm, snorm (norm and t prefixed are not applicable on float math node)
- s prefixed return one number
- t prefixed work element-wise
- floor, ceil, round, gamma, clamp, sigm (sigmoid)
- angle (audio node)
- variables
- a, b, c, d : inputs of type based on node
- w, x, y, z : each node allows use of 4 additional floats
- W : Width of tensor - does not work on FLOAT and CONDITIONING
- H : Height of tensor - does not work on FLOAT and CONDITIONING
- C : Channel of tensor - used as color chanel in IMAGE or as information channel in others. does not work on FLOAT and CONDITIONING
- B : Batch - does not work on FLOAT and CONDITIONING
- X : X position in tensor - does not work on FLOAT and CONDITIONING
- Y : Y position in tensor - does not work on FLOAT and CONDITIONING
- I : Tensor used to initalise sampler before noise injection - usually zeroed out and generated by Empty Latent Image node - Exclusive for NOISE
- use constant e and pi
- functions:
Languages
Python
96.3%
JavaScript
1.4%
ANTLR
1.2%
PowerShell
0.6%
Vue
0.5%