Nodes/ComfyUI-BrainDead/BD GLSL Batch (iterate uniforms)
ComfyUI Node

BD GLSL Batch (iterate uniforms)

Run a GLSL shader N times with different uniform values, batching the fc0/fc1/fc2/fc3 outputs along the batch dimension. Shader compiles ONCE per call, reused across iterations — much faster than re-submitting the workflow N times. Iteration count is auto-detected from the longest 'vary' list. Uniforms not listed in a vary spec use their base value (same every iteration). Vary syntax: one line per uniform, 'u_intN=v1,v2,v3,...' or 'u_floatN=v1,v2,v3,...'. Lines with one value are treated as constants.

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
BD GLSL Batch (iterate uniforms)
  • u_image0
  • u_image1
  • u_image2
  • u_image3
  • u_image4
  • fc0_batch
  • fc1_batch
  • fc2_batch
  • fc3_batch
  • iteration_names
  • iteration_count
fragment_shader#version 300 es precision highp float; in vec2 v_texCoord; uniform sampler2D u_image0; layout(location=0) out vec4 fragColor0; void main(){ fragColor0 = texture(u_image0, v_texCoord); }
fragment_shader_file
floats
ints
vary_ints
vary_floats
iteration_names
iterations_override0
width0
height0
Category🧠BrainDead/GLSL

Inputs (15)

NameTypeDefaultDescription
fragment_shaderSTRING#version 300 es precision highp float; in vec2 v_texCoord; uniform sampler2D u_image0; layout(location=0) out vec4 fragColor0; void main(){ fragColor0 = texture(u_image0, v_texCoord); }The fragment shader source code (GLSL ES 3.0). OVERRIDDEN by fragment_shader_file if that path is set and exists.
fragment_shader_fileSTRINGOptional ABSOLUTE path to a .glsl file. When set and the file exists, its contents are used instead of the fragment_shader text field. Lets you edit the shader externally and have BD_GLSLBatch pick up the latest version on each workflow execution. Example: /path/to/shaders/skin_shader.glsl
floatsSTRINGBase float uniform values, one per line: u_float0=0.48 u_float1=0.5 Indexes 0..19. Missing slots default to 0.0.
intsSTRINGBase int uniform values, one per line: u_int0=255 u_int1=128 Indexes 0..12. Missing slots default to 0.
vary_intsSTRINGPer-iteration int overrides. One uniform per line: u_int3=255,240,160,140 u_int4=255,190,110,190 Iteration count = longest list. Single-value lines are constants.
vary_floatsSTRINGPer-iteration float overrides. Same format as vary_ints.
iteration_namesSTRINGOne name per iteration for downstream filename use: light medium dark zombie Defaults to '1', '2', '3', ... if empty.
u_image0optIMAGEBound to sampler2D u_image0.
u_image1optIMAGEBound to sampler2D u_image1.
u_image2optIMAGEBound to sampler2D u_image2.
u_image3optIMAGEBound to sampler2D u_image3.
u_image4optIMAGEBound to sampler2D u_image4.
iterations_overrideoptINT00–128If > 0, force this iteration count. 0 = auto-detect from vary specs.
widthoptINT00–8192Output width. 0 = use u_image0's width.
heightoptINT00–8192Output height. 0 = use u_image0's height.

Outputs (6)

NameTypeDescription
fc0_batchIMAGEStacked IMAGE batch (B=N_iterations) of fc0 outputs.
fc1_batchIMAGE
fc2_batchIMAGE
fc3_batchIMAGE
iteration_namesSTRINGNewline-joined iteration names, in order.
iteration_countINT