ComfyUI Extension: ComfyUI-42lux

Authored by 42lux

Created

Updated

15 stars

A collection of custom nodes for ComfyUI focused on enhanced sampling, model optimization, and quality improvements.

README

ComfyUI-42lux

A collection of custom nodes for ComfyUI focused on enhanced sampling, model optimization, and quality improvements.

Features

Model Sampling

  • Model Sampling Flux Normalized: Adjusts model sampling parameters based on image dimensions to maintain consistent quality across different resolutions

Latent Generation

  • Flux Empty Latent Size Picker: Advanced latent tensor initialization with multiple modes including VAE sampling, noise generation, and structured initialization

Soul Samplers

Note: Soul Samplers are primarily designed for img2img image restoration workflows. While they work for text2img, they excel at enhancing existing images. For text2img generation, the Soul Sampler Hybrid variants provide the best results.

Sampling nodes with adaptive noise injection for enhanced texture and organic detail:

  • Soul Sampler: Adaptive noise injection with luminance-aware processing for enhanced texture
  • Soul Sampler (Advanced): Full parameter control for fine-tuning noise behavior
  • Soul Sampler DPM++: Modern DPM++ 2M SDE sampling with soul noise integration
  • Soul Sampler DPM++ (Advanced): Complete control over both DPM++ and soul noise parameters

Soul Sampler Features

Adaptive Noise Injection

  • Multi-frequency noise generation: Combines high, mid, and low frequency components for rich texture
  • Luminance-aware processing: Enhances detail in shadows and highlights based on image content
  • Timestep scaling: Reduces noise intensity as generation progresses for natural results

Noise Characteristics

  • Shadow boost: Enhanced detail in dark regions (<15% luminance)
  • Highlight boost: Added texture in bright areas (>85% luminance)
  • Frequency mixing: Balance between fine details and organic variation
  • Structured noise: Trigonometric-based generation for organic, GPU-optimized textures

Sampling Algorithms

  • Euler-based: Enhanced Euler sampling with adaptive noise injection
  • DPM++ 2M SDE: Modern sampling algorithm with soul noise integration
  • Brownian tree noise: Advanced noise sampling with soul characteristics

Usage

Soul Samplers

Soul samplers work best with:

  • Base noise strength: 0.05-0.15 for subtle enhancement, 0.1-0.3 for pronounced effects
  • Shadow/Highlight boost: 1.2-1.5 for natural enhancement
  • Frequency mix: 0.6-0.8 for balanced texture, higher values for more fine detail

Model Sampling Flux Normalized

  • Connect your model and latent inputs
  • Adjust max_shift and base_shift based on your target resolution
  • Higher resolutions typically benefit from higher shift values

Flux Empty Latent Size Picker

  • Choose from predefined resolution presets or use custom dimensions
  • Select initialization mode based on your workflow:
    • zeros: Standard empty latent
    • vae_sample: VAE-based initialization (requires VAE input)
    • gaussian_noise: Random noise initialization
    • uniform_noise: Uniform distribution noise

Parameters

Soul Sampler Parameters

  • base_noise_strength (0.0-0.3): Strength of soul noise injection
  • shadow_boost (1.0-2.0): Noise multiplier for dark regions
  • highlight_boost (1.0-2.0): Noise multiplier for bright regions
  • frequency_mix (0.0-1.0): Balance between high and low frequency noise
  • adaptive_timestep (boolean): Enable timestep-based noise scaling
  • noise_seed (int): Seed for reproducible noise patterns

DPM++ Parameters (DPM variants only)

  • eta (0.0-2.0): Stochasticity parameter (0.0 = deterministic, 1.0 = full SDE)
  • s_noise (0.0-2.0): Noise scaling factor
  • solver_type: Choose between "midpoint" (faster) or "heun" (more accurate)

Technical Details

Soul Noise Generation

The soul samplers use a sophisticated multi-octave noise generation system:

  • Trigonometric functions: Creates organic, structured noise patterns
  • Luminance analysis: Calculates image brightness for adaptive enhancement
  • Frequency decomposition: Separates noise into high, mid, and low frequency bands
  • Adaptive scaling: Adjusts noise strength based on generation progress

Credits and Acknowledgments

Distance Sampling

The distance-based resampling techniques used in the hybrid samplers are based on the excellent work from:

  • DistanceSampler: https://github.com/Extraltodeus/DistanceSampler
  • Original implementation by Extraltodeus
  • Provides advanced distance-based prediction resampling for improved sampling quality