CPPN Generator:
CPPN Generator creates image patterns by evaluating a randomly initialized neural network across a grid of spatial coordinates. Rather than placing individual shapes on a canvas, it uses each pixel’s position and distance from the center to produce a continuous-looking pattern. This makes it useful for exploring abstract textures, gradients, and repeating forms. The same configuration and seed can reproduce a result, while changes to the network or coordinate settings can produce a different composition. The exact appearance also depends on the imported CPPN model, whose internal implementation is not shown here.
CPPN Generator Input Parameters:
seed
An integer used to initialize the random generator for the network and its latent values. Keep the same seed and other settings to reproduce a result; change it to explore another variation. Default: 0. Minimum: 0. Maximum: BIGMAX, whose numeric value is not provided in the source.
width
Sets the number of horizontal coordinate positions evaluated for the image. A larger width requests more detail but increases the number of pixels the network must process. Default: 1024. Minimum: 1. Maximum: 8192. The supplied coordinate formula divides by width - 1, so a width of 1 may produce invalid coordinates despite being allowed by the interface.
height
Sets the number of vertical coordinate positions evaluated for the image. Increasing it raises the pixel count and processing demand. Default: 1024. Minimum: 1. Maximum: 8192. The supplied coordinate formula divides by height - 1, so a height of 1 may produce invalid coordinates despite being allowed by the interface.
framecount
An integer control with a default of 1, minimum of 1, and maximum of 512. Although its name suggests a sequence length, the shown execution code never uses this value. Changing it does not request additional frames in this implementation.
dim_z
Sets the length of the randomly generated latent vector supplied to the CPPN model. This vector contributes to the pattern generated across the image; changing its length also changes the model configuration. The precise visual effect depends on the imported model. Default: 32. Minimum: 1. Maximum: 512.
channels_in
Sets a size parameter passed to the CPPN model’s constructor. It may affect the model’s internal capacity and processing cost, but the imported model code is not available, so its exact role and visual effect cannot be confirmed. Default: 32. Minimum: 1. Maximum: 512.
layers
Sets the layer-count parameter passed to the CPPN model. More layers may increase model complexity and processing cost, but the exact network structure is defined in the unavailable model code. Default: 3. Minimum: 0. Maximum: 16.
first_activation
Selects the activation name passed to the CPPN model for its first stage. Activations are mathematical transformations that influence how the network turns coordinates into patterns; the exact visual result depends on the model implementation. Options: Tanh, Sigmoid, Sin, ReLU, ELU, Softplus, and Modulo. No explicit default is specified in the source.
middle_activations
Selects the activation name passed to the CPPN model for its middle stages. Try different options to explore how the pattern changes, while recognizing that the source does not show how many middle stages use this setting. Options: Tanh, Sigmoid, Sin, ReLU, ELU, Softplus, and Modulo. No explicit default is specified in the source.
last_activation
Selects the activation name passed to the CPPN model for its final stage, before the node applies its output multiplier and offset. This choice can affect the values reaching those final adjustments, although the exact behavior depends on the model. Options: Tanh, Sigmoid, Sin, ReLU, ELU, Softplus, and Modulo. Default: Sigmoid.
scale
Multiplies the horizontal and vertical coordinates supplied to the model, changing which coordinate range the image samples. A larger magnitude samples positions farther from the center; a negative value reverses both coordinate directions. Its visual effect depends on the generated network. Default: 1.0. Minimum: -1024.0. Maximum: 1024.0.
x_offset
Shifts the horizontal coordinate values before they are multiplied by scale. Adjust it to sample a different horizontal region of the coordinate-based pattern. Because scale is applied afterward, setting scale to 0 also removes the effect of this offset. Default: 0.0. Minimum: -100000000.0. Maximum: 1000000000.0.
y_offset
Shifts the vertical coordinate values before they are multiplied by scale. Adjust it to sample a different vertical region of the pattern; its effect is removed when scale is 0. Default: 0.0. Minimum: -1000000000.0. Maximum: 1000000000.0.
z_offset
Adds a constant to every element of the randomly sampled latent vector before the vector is supplied to the model. It changes the values influencing the generated pattern without changing the spatial coordinates. Default: 0.0. Minimum: -1000000000.0. Maximum: 1000000000.0.
mean
A value passed to the CPPN model’s constructor. Its name suggests a statistical setting, but the provided source does not show where or how the model uses it; a specific brightness or pattern effect cannot be promised. Default: 0.0. Minimum: -1000.0. Maximum: 1000.0.
std
A nonnegative value passed to the CPPN model’s constructor. The model implementation is unavailable, so its exact effect cannot be verified from this node source. Default: 1.0. Minimum: 0.0. Maximum: 1000.0.
bias_mean
A value passed to the CPPN model’s constructor alongside its bias settings. Its precise effect depends on the unavailable model implementation, so treat it as a model configuration control rather than a guaranteed image brightness adjustment. Default: 0.0. Minimum: -1000.0. Maximum: 1000.0.
bias_std
A nonnegative value passed to the CPPN model’s constructor as a bias setting. The provided code does not reveal how the model applies it or how visibly it changes a pattern. Default: 1.0. Minimum: 0.0. Maximum: 1000.0.
zero_bias
A Boolean passed to the CPPN model’s constructor. Its name indicates a bias-related choice, but the available source does not establish exactly how the model handles it. Default: True. Options: True or False.
output_factor
Multiplies every value produced by the model before optional normalization. Use it to adjust the scale of the output values; a negative value reverses their sign. If normalization is enabled, the subsequent rescaling can reduce or remove the visible effect of a positive multiplier. Default: 1.0. Minimum: -100000000.0. Maximum: 1000000000.0.
output_offset
Adds a constant to every value after output_factor is applied. With normalization off, this shifts the output values directly. With normalization on, subtracting the result’s minimum generally cancels a uniform offset. Default: 0.0. Minimum: -1000000000.0. Maximum: 1000000000.0.
mode
Selects the number of channels requested from the CPPN model. Grayscale requests one channel, which the node then repeats into three identical channels for its image output. RGB requests three channels. Options: Grayscale and RGB. No explicit default is specified in the source.
normalize
Controls whether the node rescales the completed result by subtracting its minimum and dividing by its new maximum, when that maximum is not zero. Enable it to bring a nonconstant result into the 0-to-1 range; leave it off to retain the values after output_factor and output_offset, which may fall outside that range. Default: False. Options: True or False.
images
An optional IMAGE input. The shown execution method accepts it but never reads or combines it with the generated result. Connecting an image therefore has no effect in this implementation. No default, minimum, maximum, or options are specified.
CPPN Generator Output Parameters:
images
The generated IMAGE tensor. The node evaluates one set of coordinates and one latent vector, then returns a result with three channels: three model-generated channels in RGB mode, or one generated channel repeated three times in Grayscale mode. The output values reflect output_factor and output_offset, followed by optional normalization. The shown code does not use framecount to create a sequence, and the optional input image is not included in the output. For nonsquare dimensions, note that the code reshapes using width before height; check downstream orientation when choosing unequal values.
CPPN Generator Usage Tips:
- Start with a modest size, such as 256 by 256, while exploring seeds and settings. The model evaluates
width × heightpixel positions, so reducing both dimensions substantially reduces the work. - Keep the seed fixed when comparing changes to
scale, offsets, activations, or model settings. This makes it easier to see which setting caused a difference. - Use widths and heights of at least 2. Although the interface permits 1, the coordinate calculation divides by the dimension minus 1.
- Choose
Grayscalewhen you want the same generated value in all three output channels, andRGBwhen you want the model to generate three channels. - Turn on
normalizewhen you need the generated values rescaled to 0 through 1. Leave it off when the direct effect ofoutput_factorandoutput_offsetmatters to your workflow. - Do not rely on
framecountfor animation or connect an image expecting image-to-image processing; neither value is used in the shown execution code. - For nonsquare images, inspect the result’s orientation before building a larger workflow around it.
CPPN Generator Common Errors and Solutions:
RuntimeWarning: invalid value encountered in divide
- Explanation: This warning may occur in coordinate generation when
widthorheightis 1: its coordinate range divides by the dimension minus 1. - Solution: Set bothwidthandheightto at least 2, then generate the image again.
RuntimeError: ... out of memory
- Explanation: Large dimensions create many coordinate and intermediate values, and the model processes a value for every pixel. Available memory may be insufficient, especially with larger model settings.
- Solution: Reduce
widthandheightfirst. If needed, also try smallerdim_z,channels_in, orlayers; their exact memory effects depend on the imported model.
RuntimeError: shape '[-1, ...]' is invalid for input of size ...
- Explanation: The node reshapes the model result to the requested dimensions and channel count. This error can occur if the imported model returns an incompatible number of values.
- Solution: Check that the installed CPPN model matches this node’s expected interface and that
modeis one of the provided options. Restart with default-sized model settings to narrow down the cause.
ModuleNotFoundError: No module named '...cppn...' or ImportError: cannot import name 'CPPN'
- Explanation: The node imports
CPPNfrom a companion.cppn.modelsmodule. If that module or class is missing, the node cannot load. - Solution: Check that the complete node package, including its
cppn/modelsimplementation, is installed in the expected location.
NameError: name 'BIGMAX' is not defined
- Explanation: The seed input declares
BIGMAXas its maximum, but its definition is not included in the supplied source. If it is missing from the installed module, input setup will fail. - Solution: Check that the installed node includes the definition or required import for
BIGMAX.
Generated image contains nan values or appears blank
- Explanation: Invalid coordinates, extreme settings, or non-finite values produced by the model can make the result unusable. Normalization does not reliably repair non-finite values.
- Solution: Use dimensions of at least 2 and return
scale, offsets, statistical settings, and output adjustments to their defaults. Then change one setting at a time to identify the cause.
Changing framecount or connecting images has no effect
- Explanation: These inputs are present in the node interface, but neither is used in the shown execution method. This is expected behavior for the provided implementation, not an error message.
- Solution: Use the generated single image as the node currently provides it. A sequence or image-conditioned result would require a change to the node implementation.
Output looks clipped or has unexpected brightness
- Explanation: With
normalizeoff, the node does not constrain the values after multiplying byoutput_factorand addingoutput_offset. A later display or processing node may handle out-of-range values differently. - Solution: Enable
normalizeto rescale a finite, nonconstant result to 0 through 1, or bringoutput_factorandoutput_offsetcloser to their defaults.
