46294b9571fe6d2663ed0f65d74f76f0cf915b6b
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
- functions and variables in math expressions
- Nodes for CONDITIONING, LATENT, IMAGE, NOISE, FLOAT, VIDEO and AUDIO
Operators
- Math:
+,-,*,/,%,^ - Boolean:
<,<=,>,>=,==,!=
(false = 0.0,true = 1.0)
Functions
- Basic:
abs,sqrt,ln,log,exp,pow - Trigonometric:
sin,cos,tan,asin,acos,atan,atan2 - Hyperbolic:
sinh,cosh,tanh,asinh,acosh,atanh - Aggregates:
smin,smax,snorm(scalar),tmin,tmax,tnorm(elementwise) - Other:
floor,ceil,round,gamma,clamp,sigm(sigmoid)fft(N-D FFT on non-batch/channel dims),ifft(Inverse N-D FFT, returns real component),angle(in ifft only) - Shaders:
lerp(a, b, w),step(x, edge),smoothstep(x,edge0, edge1),fract(x) - ML:
relu(x),softplus(x),gelu(x),sign(x) - Tensor:
swap(tensor, dim, index1, index2)(swaps two slices of a tensor along a dimension)
Variables
-
common inputs (matches node input type):
a,b,c,d
-
Extra floats:
w,x,y,z
-
INSIDE IFFT
Forfrequency_count– frequency count (freq domain, iFFT only)Korfrequency– isotropic frequency (Euclidean norm of indices, iFFT only)Kx,Ky,K_dimN- frequency index for specific dimensionFx,Fy,F_dimN- frequency count for specific dimension
-
IMAGE and LATENT:
Corchannel- channel of imageX- position X in image. 0 is in top leftY- position Y in image. 0 is in top leftWorwidth- width of image. y/width = 1Horheight- height of image. x/height = 1Bor 'batch' - position in batch- 'T' or 'batch_count` - number of batches
Norchannel_count- count of channels
-
AUDIO:
Bor 'batch' - position in batchNorchannel_count- count of channelsCorchannel- channel of audioSorsample– current audio sample- 'T' or 'sample_count` - audio lenght in samples
Rorsample_rate– sample rate
-
VIDEO
- refer to
IMAGE and LATENTfor visual part (butbatchisframeandbatch_countisframe_count) - refer to
AUDIOfor sound part
- refer to
-
NOISE
- refer to
IMAGE and LATENTfor most variables Iorinput_latent– latent used as input to generate noise before noise is generated into it
- refer to
-
CONDITIONING and FLOAT
- no additional variables
Forfrequency_count– frequency count (freq domain, iFFT only)Korfrequency– isotropic frequency (Euclidean norm of indices, iFFT only)Kx,Ky,K_dimN- frequency index for specific dimensionFx,Fy,F_dimN- frequency count for specific dimension
-
Constants:
e,pi
Languages
Python
96.3%
JavaScript
1.4%
ANTLR
1.2%
PowerShell
0.6%
Vue
0.5%