ο»Ώ# MagicNodes β ComfyUI Render Pipeline (SD/SDXL)
Simple start. Expert-grade results. Reliable detail.
/
![]() |
TL;DR: MagicNodes, it's a plug-and-play multi-pass "render-machine" for SD/SDXL models. Simple one-node start, expert-grade results. Core is ZeResFDG (Frequency-Decoupled + Rescale + Zero-Projection) and the always-on QSilk Micrograin Stabilizer, complemented by practical stabilizers (NAG, local masks, EPS, Muse Blend, Polish). Ships with a four-pass preset for robust, clean, and highly detailed outputs.
Our pipeline runs through several purposeful passes: early steps assemble global shapes, mid steps refine important regions, and late steps polish without overcooking the texture. We gently stabilize the amplitudes of the "imageβs internal draft" (latent) and adapt the allowed value range per region: where the model is confident we give more freedom, and where itβs uncertain we act more conservatively. The result is clean gradients, crisp edges, and photographic detail even at very high resolutions and, as a side effect on SDXL models, text becomes noticeably more stable and legible. |
Please note that the SDXL architecture itself has limitations and the result depends on the success of the seed, the purity of your prompt and the quality of your model+LoRA.
Draw
![]() |
![]() |
Photo Portrait
![]() |
![]() |
![]() |
![]() |
Photo Cup
![]() |
![]() |
Photo Dog
![]() |
![]() |
Features
- ZeResFDG: LF/HF split, energy rescale, and zero-projection (stable early, sharp late)
- NAG (Normalized Attention Guidance): small attention variance normalization (positive branch)
- Local spatial gating: optional CLIPSeg masks for faces/hands/pose
- EPS scale: small early-step exposure bias
- QSilk Micrograin Stabilizer: gently smooths rare spikes and lets natural micro-texture (skin, fabric, tiny hairs) show through β without halos or grid patterns. Always on, zero knobs, nearβzero cost.
- Adaptive Quantile Clip (AQClip): softly adapts the allowed range per region. Confident areas keep more texture; uncertain ones get cleaner denoising. Tileβbased with seamless blending (no seams). Optional Attn mode uses attention confidence for an even smarter balance.
- MGHybrid scheduler: hybrid Karras/Beta sigma stack with smooth tail blending and tiny schedule jitter (ZeSmart-inspired) for more stable, detail-friendly denoising; used by CADE and SuperSimple by default
- Seed Latent (MG_SeedLatent): fast, deterministic latent initializer aligned to VAE stride; supports pure-noise starts or image-mixed starts (encode + noise) to gently bias content; batch-ready and resolution-agnostic, pairs well with SuperSimple recommended latent sizes for reproducible pipelines
- Muse Blend and Polish: directional post-mix and final low-frequency-preserving clean-up
- SmartSeed (CADE Easy and SuperSimple): set
seed = 0
to auto-pick a good seed from a tiny low-step probe. Uses a low-discrepancy sweep, avoids speckles/overexposure, and, if available, leverages CLIP-Vision (withreference_image
) and CLIPSeg focus text to favor semantically aligned candidates. LogsSmart_seed_random: Start/End
. I highly recommend working with SmartSeed. - CADE2.5 pipeline does not just upscale the image, it iterates and adds small details, doing it carefully, at every stage.
Hardware Requirements
- GPU VRAM: ~10-28 GB (free memory) for the default presets (start latent ~ 672x944 -> final ~ 3688x5192 across 4 steps). 15-25 GB is recommended; 32 GB is comfortable for large prompts/batches.
- System RAM: ~12-20 GB during generation (depends on start latent and whether Depth/ControlFusion are enabled). 16+ GB recommended.
- Notes
- Lowering the starting latent (e.g., 512x768) reduces both VRAM and RAM.
- Disabling hi-res depth/edges (ControlFusion) reduces peaks. (not recommended!)
- Depth weights add a bit of RAM on load; models live under
depth-anything/
.
Install (ComfyUI 0.3.60, tested on this version)
Preparing: I recomend update pytorch version: 2.8.0+cu129.
- PyTorch install:
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu129
- CUDA manual download and install: https://developer.nvidia.com/cuda-12-9-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_local
- Install
SageAttention 2.2.0
, manualyhttps://github.com/thu-ml/SageAttention
or use scriptscripts/check_sageattention.bat
. The installation takes a few minutes, wait for the installation to finish. p.s.: To work, you definitely need to installSageAttention v.2.2.0
,version 1.0.6
is not suitable for pipeline.
Next:
- Clone or download this repo into
ComfyUI/custom_nodes/
- Install helpers:
pip install -r requirements.txt
- Take my negative LoRA
models/LoRA/mg_7lambda_negative.safetensors
and place the file in ComfyUI, toComfyUI/models/loras
- download model
depth_anything_v2_vitl.pth
https://huggingface.co/depth-anything/Depth-Anything-V2-Large/tree/main and place inside in todepth-anything/
folder. - Workflows
Folder
workflows/
contains ready-to-use graphs:
mg_SuperSimple-Workflow.json
β one-node pipeline (2/3/4 steps) with presetsmg_Easy-Workflow.json
β the same logic built from individual Easy nodes You can save this workflow to ComfyUIComfyUI\user\default\workflows
- Restart ComfyUI. Nodes appear under the "MagicNodes" categories.
π₯ I strongly recommend use mg_Easy-Workflow
workflow + default settings + your model and my negative LoRA mg_7lambda_negative.safetensors
, for best result.
π "One-Node" Quickstart (MG_SuperSimple)
Start with MG_SuperSimple
for the easiest path:
- Drop
MG_SuperSimple
into the graph - Connect
model / positive / negative / vae / latent
and aLoad ControlNet Model
module - Choose
step_count
(2/3/4) and Run
or load mg_SuperSimple-Workflow
in panel ComfyUI
Notes:
- When "Custom" is off, presets fully drive parameters
- When "Custom" is on, the visible CADE controls override the Step presets across all steps; Step 1 still enforces
denoise=1.0
- CLIP Vision (if connected) is applied from Step 2 onward; if no reference image is provided, SuperSimple uses the previous step image as reference
βTips
(!) There are almost always artifacts in the first step, don't pay attention to them, they will be removed in the next steps. Keep your prompt clean and logical, don't duplicate details and be careful with symbols.
MG_SuperSimple-Workflow
is a bit less flexible thanMG_Easy-Workflow
, but extremely simple to use. If you just want a stable, interesting result, start with SuperSimple.Recommended negative LoRA:
mg_7lambda_negative.safetensors
withstrength_model = -1.0
,strength_clip = 0.2
. Place LoRA files underComfyUI/models/loras
so they appear in the LoRA selector.Download a CLIP Vision model and place it under
ComfyUI/models/clip_vision
(e.g., https://huggingface.co/openai/clip-vit-large-patch14; heavy alternative: https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K). SuperSimple/CADE will use it for reference-based polish.Samplers: i recomend use
ddim
for many cases (Draw and Realism style). Scheduler: useMGHybrid
in this pipeline.Denoise: higher -> more expressive and vivid; you can go up to 1.0. The same applies to CFG: higher -> more expressive but may introduce artifacts. Suggested CFG range: ~4.5β8.5.
If you see unwanted artifacts on the final (4th) step, slightly lower denoise to ~0.5β0.6 or simply change the seed.
You can get interesting results by repeating steps (in Easy/Hard workflows), e.g.,
1 -> 2 -> 3 -> 3
. Just experiment with it!Recommended starting latent close to ~672x944 (other aspect ratios are fine). With that, step 4 produces ~3688x5192. Larger starting sizes are OK if the model and your hardware allow.
Unlucky seeds happen β just try another. (We may later add stabilization to this process.)
Rarely, step 3 can show a strange grid artifact (in both Easy and Hard workflows). If this happens, try changing CFG or seed. Root cause still under investigation.
Results depend on checkpoint/LoRA quality. The pipeline βsqueezesβ everything SDXL and your model can deliver, so prefer highβquality checkpoints and nonβovertrained LoRAs.
Avoid using more than 3 LoRAs at once, and keep only one βleadβ LoRA (one you trust is not overtrained). Too many/strong LoRAs can spoil results.
Try connecting reference images in either workflow β you can get unusual and interesting outcomes.
Very often, the image in
step 3 is of very good quality
, but it usually lacks sharpness. But if you have aweak system
, you canlimit yourself to 3 steps
.SmartSeed (auto seed pick): set
seed = 0
in Easy or SuperSimple. The node will sample several candidate seeds and do a quick lowβstep probe to choose a balanced one. Youβll see logsSmart_seed_random: Start
andSmart_seed_random: End. Seed is: <number>
. Use any nonβzero seed for fully deterministic runs.The 4th step sometimes saves the image for a long time, just wait for the end of the process, it depends on the initial resolution you set.
Repository Layout
MagicNodes/
ββ README.md
ββ LICENSE # AGPL-3.0-or-later
ββ assets/
ββ docs/
β ββ EasyNodes.md
β ββ HardNodes.md
β ββ hard/
β ββ CADE25.md
β ββ ControlFusion.md
β ββ UpscaleModule.md
β ββ IDS.md
β ββ ZeSmartSampler.md
β
ββ mod/
β ββ easy/
β β ββ mg_cade25_easy.py
β β ββ mg_controlfusion_easy.py
β β ββ mg_supersimple_easy.py
β β ββ preset_loader.py
β ββ hard/
β ββ mg_cade25.py
β ββ mg_controlfusion.py
β ββ mg_tde2.py
β ββ mg_upscale_module.py
β ββ mg_ids.py
β ββ mg_zesmart_sampler_v1_1.py
β
ββ pressets/
β ββ mg_cade25.cfg
β ββ mg_controlfusion.cfg
β
ββ scripts/
β ββ check_sageattention.bat
β ββ check_sageattention.ps1
β
ββ depth-anything/ # place Depth Anything v2 weights (.pth), e.g., depth_anything_v2_vitl.pth
β ββdepth_anything_v2_vitl.pth
β
ββ vendor/
β ββ depth_anything_v2/ # vendored Depth Anything v2 code (Apache-2.0)
β
ββ models/
β ββ LoRA/
β ββ mg_7lambda_negative.safetensors
β
ββ workflows/
β ββ mg_SuperSimple-Workflow.json
β ββ mg_Easy-Workflow.json
|
ββ requirements.txt
Models folder
- The repo includes a sample negative LoRA at
models/LoRA/mg_7lambda_negative.safetensors
. - To use it in ComfyUI, copy or move the file to
ComfyUI/models/loras
β it will then appear in LoRA selectors. - Keeping a copy under
models/
here is fine as a backup.
Depth models (Depth Anything v2)
- Place DA v2 weights (
.pth
) indepth-anything/
. Recommended:depth_anything_v2_vitl.pth
(ViT-L). Supported names include:depth_anything_v2_vits.pth
,depth_anything_v2_vitb.pth
,depth_anything_v2_vitl.pth
,depth_anything_v2_vitg.pth
, and the metric variantsdepth_anything_v2_metric_vkitti_vitl.pth
,depth_anything_v2_metric_hypersim_vitl.pth
. - ControlFusion auto-detects the correct config from the filename and uses this path by default. You can override via the
depth_model_path
parameter (preset) if needed. - If no weights are found, ControlFusion falls back gracefully (luminance pseudo-depth), but results are better with DA v2.
- Where to get weights: see the official Depth Anything v2 repository (https://github.com/DepthAnything/Depth-Anything-V2)
and its Hugging Face models page (https://huggingface.co/Depth-Anything) for pre-trained
.pth
files.
Documentation
- Easy nodes overview and
MG_SuperSimple
:docs/EasyNodes.md
- Hard nodes documentation index:
docs/HardNodes.md
Control Fusion (mg_controlfusion.py, mg_controlfusion_easy.py,)
- Builds depth + edge masks with preserved aspect ratio; hires-friendly mask mode
- Key surface knobs:
edge_alpha
,edge_smooth
,edge_width
,edge_single_line
/edge_single_strength
,edge_depth_gate
/edge_depth_gamma
- Preview can optionally reflect ControlNet strength via
preview_show_strength
andpreview_strength_branch
CADE 2.5 (mg_cade25.py, mg_cade25_easy.py)
- Deterministic preflight: CLIPSeg pinned to CPU; preview mask reset; noise tied to
iter_seed
- Encode/Decode: stride-aligned, with larger overlap for >2K to avoid artifacts
- Polish mode (final hi-res refinement):
polish_enable
,polish_keep_low
(global form from reference),polish_edge_lock
,polish_sigma
- Smooth start via
polish_start_after
andpolish_keep_low_ramp
eps_scale
supported for gentle exposure shaping
Depth Anything v2 (vendor)
- Lives under
vendor/depth_anything_v2
; Apache-2.0 license
MG_ZeSmartSampler (Experimental)
- Custom sampler that builds hybrid sigma schedules (Karras/Beta blend) with tail smoothing
- Inputs/Outputs match KSampler:
MODEL/SEED/STEPS/CFG/base_sampler/schedule/CONDITIONING/LATENT
->LATENT
- Key params:
hybrid_mix
,jitter_sigma
,tail_smooth
, optional PC2-like shaping (smart_strength
,target_error
,curv_sensitivity
)
Seed Latent (mg_seed_latent.py)
- Purpose: quick LATENT initializer aligned to VAE stride (4xC, H/8, W/8). Can start from pure noise or mix an input image encoding with noise to gently bias content.
- Inputs
width
,height
,batch_size
sigma
(noise amplitude) andbias
(additive offset)- Optional
vae
andimage
whenmix_image
is enabled
- Output:
LATENT
dict{ "samples": tensor }
ready to feed into CADE/SuperSimple. - Usage notes
- Keep dimensions multiples of 8; recommended starting sizes around ~672x944 (other aspect ratios work). With SuperSimpleβs default scale, step 4 lands near ~3688x5192.
mix_image=True
encodes the provided image via VAE and adds noise: a soft way to keep global structure while allowing refinement downstream.- For run-to-run comparability, hold your sampler seed fixed (in SuperSimple/CADE). SeedLatent itself does not expose a seed; variation is primarily controlled by the sampler seed.
- Batch friendly:
batch_size>1
produces independent latents of the chosen size.
Dependencies (Why These Packages)
transformers β used by CADE for CLIPSeg (CIDAS/clipseg-rd64-refined) to build textβdriven masks (e.g., face/hands). If missing, CLIPSeg is disabled gracefully.
opencv-contrib-python β ControlFusion edge stack (Pyramid Canny, thinning via ximgproc), morphological ops, light smoothing.
Pillow β image I/O and small conversions in preview/CLIPSeg pipelines.
scipy β preferred Gaussian filtering path for IDS (quality). If not installed, IDS falls back to a PyTorch implementation.
sageattention β accelerated attention kernels (auto-picks a kernel per GPU arch); CADE/attention patch falls back to stock attention if not present.
Optional extras
- controlnet-aux β alternative loader for Depth Anything v2 if you donβt use the vendored implementation (not required by default).
Preprint
CADE 2.5 - ZeResFDG
CADE 2.5 - QSilk
How to Cite
@misc{rychkovskiy2025cade25zeresfdg,
title={CADE 2.5 - ZeResFDG: Frequency-Decoupled, Rescaled and Zero-Projected Guidance for SD/SDXL Latent Diffusion Models},
author={Denis Rychkovskiy},
year={2025},
eprint={2510.12954},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2510.12954},
}
@misc{rychkovskiy2025qsilkmicrograinstabilizationadaptive,
title={QSilk: Micrograin Stabilization and Adaptive Quantile Clipping for Detail-Friendly Latent Diffusion},
author={Denis Rychkovskiy},
year={2025},
eprint={2510.15761},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2510.15761},
}
Attribution (kind request)
If you use this work or parts of it, please consider adding the following credit in your README/About/credits: "Includes CADE 2.5 (ZeResFDG, QSilk) by Denis Rychkovskiy (βDZRoboβ)"
License and Credits
- License: AGPL-3.0-or-later (see
LICENSE
)
Support
If this project saved you time, you can leave a tip:
- GitHub Sponsors: https://github.com/sponsors/1dZb1
- Bymeacoffee: https://buymeacoffee.com/dzrobo