Creating stunning AI-generated art is all about exploring possibilities, and wildcards and dynamic values in ComfyUI make that exploration effortless. These features allow you to introduce randomness, variety, and experimentation into your workflows, generating diverse outputs without constant manual adjustments.

In this guide, we’ll cover what wildcards and dynamic values are, how to use them, and how they can supercharge your creativity in ComfyUI.

What Are Wildcards?

Wildcards are placeholders in your text prompts that dynamically swap in different words or phrases during image generation. Instead of writing multiple prompts manually, you can use a wildcard to let ComfyUI cycle through various options.

Example:

Prompt: “A {dog|cat|rabbit} playing in a field.”

  • Output 1: “A dog playing in a field.”
  • Output 2: “A cat playing in a field.”
  • Output 3: “A rabbit playing in a field.”

Wildcards let you quickly explore different ideas, ensuring variety in your results with minimal effort.

What Are Dynamic Values?

Dynamic values are parameters in your workflow (e.g., CFG scale, sampling steps, or LoRA weights) that can change automatically during batch processing. They enable you to experiment with different configurations without manually adjusting settings for each run.

Example:

  • CFG Scale: Dynamically switch between 7, 10, and 15 for different levels of prompt adherence.
  • LoRA Weight: Test values like 0.8, 1.0, and 1.2 to see how each affects the output.

Dynamic values are perfect for fine-tuning your workflows and finding the sweet spot for your settings.

How to Use Wildcards in ComfyUI

Step 1: Create a Wildcard Prompt

  1. Use curly braces {} in your text prompt to define the wildcard options.cssCopy code
A {sunset|rainy|snowy} landscape with a mountain.
  1. Separate the options with a vertical bar |.

Step 2: Add a Text Input Node

  1. In ComfyUI, use a Text Input node to hold your prompt.
  2. Enter your wildcard-based prompt in the node:
A {forest|beach|desert} at sunrise.

Step 3: Enable Batch Processing

To generate outputs for each wildcard option:

  1. Set up a batch workflow in ComfyUI.
  2. Add a Batch Prompt node to cycle through the wildcard options.

Step 4: Generate Images

Run your workflow, and ComfyUI will create one image for each wildcard variation. You can review the results in an Image Grid node for easy comparison.

How to Use Dynamic Values in ComfyUI

Step 1: Add a Primitive Node

  1. Use a Primitive node to define dynamic values for a parameter (e.g., CFG scale or LoRA weight).
  2. Enter a list of values separated by commas:
7, 10, 15
  1. Connect the Primitive node to the desired parameter in your workflow, such as:
    • CFG Scale in a KSampler node.
    • LoRA Weight in a LoRA Loader node.
  2. Ensure the parameter in your workflow recognizes the input from the Primitive node.

Step 3: Batch Process Dynamic Values

Enable batch processing to test each value dynamically:

  1. Add a Batch Process node to iterate through the values.
  2. Run your workflow, and ComfyUI will generate outputs for each configuration.

Advanced Techniques with Wildcards and Dynamic Values

1. Combine Wildcards and Dynamic Values

Why stop at one? Use wildcards in your prompt alongside dynamic values for parameters like CFG scale or sampling steps. For example:

A {dog|cat|rabbit} in a {forest|beach|desert}.
  • CFG Scale: 7, 10, 15.

ComfyUI will generate outputs for every combination of prompts and CFG scales.

2. Nested Wildcards

Use nested wildcards for even more variety:

A {small {dog|cat}|large {horse|elephant}} in a field.

3. Experiment with Dynamic LoRA Weights

Apply dynamic weights to LoRAs for layered effects:

  • Weight: 0.8, 1.0, 1.2.
  • LoRA: Cyberpunk Style.

Test how each weight alters the influence of the LoRA on your output.

4. Vary Resolution and Sampling Steps

Use dynamic values to adjust resolution or sampling steps in your workflow. For example:

  • Resolution: 512x512, 768x768, 1024x1024.
  • Steps: 20, 50, 100.

Tips for Leveraging Trial and Error

  1. Keep It Simple First Start with a single wildcard or dynamic parameter to understand its effect before adding more complexity.
  2. Use an Image Grid Review outputs side by side using an Image Grid node. This makes it easier to compare and identify the best combinations.
  3. Document Your Tests Label your outputs with their wildcard or dynamic settings to keep track of what worked and what didn’t.
  4. Iterate and Refine Once you find promising combinations, refine your wildcards or dynamic values for even better results.

Caveats and Considerations

  • Computational Load: Generating multiple variations can be resource-intensive, especially with high resolutions or many combinations. Use batch settings wisely to avoid overloading your system.
  • Prompt Clarity: Ensure your wildcards make sense in the context of the prompt. Ambiguous combinations can lead to confusing outputs.
  • Dynamic Overlap: Avoid conflicting dynamic values (e.g., extreme CFG scales combined with high LoRA weights) to maintain balance in your outputs.

Why Wildcards and Dynamic Values Are Game-Changers

Wildcards and dynamic values turn ComfyUI into a creative powerhouse. They save time, encourage exploration, and let you push the boundaries of what’s possible with AI art. Whether you’re testing new ideas, refining workflows, or generating diverse outputs for a project, these features make the process both efficient and exciting.

So, get creative with your wildcards, experiment with dynamic values, and let ComfyUI do the heavy lifting. The next big idea might just be one wildcard away!