Nodes/XB_ToolBox/XB-BOX - Chunk Visualization
ComfyUI Node

XB-BOX - Chunk Visualization

See your spatial and temporal chunks before you blow your VRAM budget

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - Chunk Visualization
  • Image_Input
  • preview_image
Stat_ModeSpatial & Temporal
Available_VRAM_GB12.0
Image_Width1024
Image_Height1024
Image_Frames1
Current_StageDecode Stage
Spatial_Tile_Size512
Spatial_Tile_Overlap64
Temporal_Chunk_Size33
Temporal_Chunk_Overlap4

Chunking is how video models run on small GPUs: you slice the video into spatial tiles and temporal chunks, process them, and stitch it back together. The problem is that chunking math is invisible - you set tile sizes and overlaps and have no idea how many batches that actually produces until the sampler either works or OOMs. XB_ChunkVisualization makes the math visible: you feed it your planned resolution, frame count, tile size, and overlap, and it renders a preview image showing exactly how your image would be carved up and how many chunks/batches that configuration creates.

It's the visualization half of XB_ToolBox's "visual learning" philosophy - the pack ships an accompanying VRAM calculator for the numbers side. This node is the picture side. If you've ever tuned tile overlap by trial and error, this is the node that turns the trial into a preview.

How it works

The node runs a simple chunk-splitting simulation (the same chunk_size/stride = chunk_size - overlap logic a real chunked sampler uses) and draws it:

  • Spatial: it computes X and Y chunk boundaries across Image_Width × Image_Height with Spatial_Tile_Size and Spatial_Tile_Overlap, then draws the tiling grid on the preview image.
  • Temporal: it computes how Image_Frames splits into Temporal_Chunk_Size chunks with Temporal_Chunk_Overlap, and shows the count.
  • It multiplies the three chunk counts into total_batches - the number of discrete passes your sampler will actually run - and reports it.
  • If you connect an Image_Input, it uses that image's real dimensions instead of the width/height fields, so you can preview the chunking of an actual frame.

Stat_Mode lets you isolate one axis (Spatial Only, Temporal Only, or both), and Current_Stage (Encode Stage/Decode Stage) flags which stage you're budgeting for. Available_VRAM_GB feeds the VRAM estimate it overlays, so the preview doubles as a budget check.

The inputs that matter

  • Stat_Mode - which chunk axes to show.
  • Available_VRAM_GB - your card's VRAM, for the estimate.
  • Image_Width / Image_Height / Image_Frames - the planned output geometry (ignored if you connect Image_Input).
  • Spatial_Tile_Size / Spatial_Tile_Overlap - the tile square and its overlap. Bigger overlap = more chunks per tile, more batches.
  • Temporal_Chunk_Size / Temporal_Chunk_Overlap - the time-axis chunking. Note the temporal defaults (33 size / 4 overlap) are the classic Wan-style chunk settings.

Output: preview_image - the annotated IMAGE, which you can wire into any preview/save node to see it on screen.

Installing

Part of XB_ToolBox - ComfyUI Manager → XB_ToolBox, or

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git

restart, zero extra deps. Pure visualization, no model involved.

Common issues

  • Preview shows nothing - it still outputs an IMAGE, so wire it into a Preview Image node; the pack doesn't auto-preview.
  • Numbers disagree with the real sampler - this is a model of the chunking, matching the common chunk-split convention, but a specific sampler (or ComfyUI's own tile VAE decode) may round differently. Treat it as a close planner, not a contract.
  • Overlap ≥ chunk size - the code clamps overlap to 90% of chunk size internally, so don't be surprised if a crazy overlap setting doesn't produce the crazy count you typed.

Where this earns its place: you're about to run a 121-frame, 1024² video on 12GB and you have a knot in your stomach about whether it'll fit. Set the tile and chunk knobs, look at the total batch count, and then commit to the run. Five seconds of preview, five minutes of generation you didn't waste.

CategoryXB_ToolBox

Inputs (11)

NameTypeDefaultDescription
Stat_ModeCOMBOSpatial & Temporal3 options: Spatial Only, Temporal Only, Spatial & Temporal
Available_VRAM_GBFLOAT12.00.1–128
Image_WidthINT102464–8192
Image_HeightINT102464–8192
Image_FramesINT11–10000
Current_StageCOMBODecode Stage2 options: Encode Stage, Decode Stage
Spatial_Tile_SizeINT51264–8192
Spatial_Tile_OverlapINT640–4096
Temporal_Chunk_SizeINT338–10000
Temporal_Chunk_OverlapINT40–1000
Image_InputoptIMAGE

Outputs (1)

NameTypeDescription
preview_imageIMAGE