Contant3Vector(Color)
A solid-color image, sized to whatever you feed it — the pack's silent workhorse
- imga
- IMAGE
Contant3Vector (the typo in the class name is upstream's, not yours) creates a flat, solid-color image. The name is straight out of the Unreal material editor's Constant3Vector node, which is where this whole pack's vocabulary comes from - "Constant3Vector" is just game-dev for "an RGB color." Give it R, G, B values and it produces a full image of that color, at the resolution of whatever reference image you plug in.
Why does a flat color image deserve a node? Because in this pack's world, images are inputs to math, and sometimes the math needs a constant. The killer use case is difference/keying without a green screen: feed an image and a solid color into the pack's Distance node, and you get a mask that's bright everywhere the image isn't that color. That's a reference-color key built from two nodes and zero chroma hardware. Solid colors are also the obvious base layer for building gradients - create red, add a second color, lerp between them.
How it works
The formula builds a np.ones array at the reference image's resolution and multiplies it by your RGB values, divided by 255 (because ComfyUI images are 0–1 floats, not 0–255):
height, width = imga.shape[1:3]
img = np.ones((1, height, width, 3), dtype=np.float32)
[R, G, B] = [pfloat1, pfloat2, pfloat3]
result = img * [R, G, B] / 255
The three sliders are pfloat1 (R), pfloat2 (G), pfloat3 (B), each 0–255 with the classic red-default of 255/0/0. If you don't connect imga, it falls back to 512×512 - the same default as every node in this pack.
Inputs
pfloat1- R, 0–255.pfloat2- G, 0–255.pfloat3- B, 0–255.imga- optional reference; defines the output resolution (512×512 if unconnected).
One IMAGE output.
Install
ComfyUI Manager → search "FuncAsTexture", or:
cd ComfyUI/custom_nodes
git clone https://github.com/CoiiChan/ComfyUI-FuncAsTexture-CoiiNode
# restart ComfyUI
No models, no requirements.txt. Category: FunctionAsTexture.
Notes
- The values are 0–255, the output is 0–1. The
/255happens in the formula, so what you set on the slider is what you'd type in a color picker. No mental conversion. - The formula is required input and it's short - it's there for consistency with the rest of the pack, and it's the one formula you can actually read in one glance.
- No alpha channel. It's a flat RGB image; if you need a transparent constant, you'll be building a mask separately (and this node is a great source for exactly that).
It's the most boring node in the pack and one of the most load-bearing. Every workflow that needs "a reference color at the right size" - chroma keys, distance masks, color-correction references - starts here. Sometimes the right tool is a paint bucket.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| formula | STRING | #height, width = 512,512 height, width = imga.shape[1:3] img = np.ones((1, height, width, 3), dtype=np.float32) [R,G,B] =[pfloat1,pfloat2,pfloat3] result = img *[R,G,B] /255 | — |
| pfloat1 | FLOAT | 2550–255 | Optional,RGB::R(0~255). |
| pfloat2 | FLOAT | 00–255 | Optional,RGB::G(0~255). |
| pfloat3 | FLOAT | 00–255 | Optional,RGB::B(0~255). |
| imgaopt | IMAGE | 可选,参考尺寸,默认 =(1,512,512,3) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |