ComfyUI Extension: ComfyUI-GameDev

Authored by ecalot

Created

Updated

0 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

ComfyUI custom nodes for depth-to-layers processing and grid slicing. For Game Development use cases.

Looking for a different extension?

Custom Nodes (3)

README

ComfyUI-GameDev

A custom ComfyUI node pack for game development workflows. Currently includes depth-to-layers color mapping, nearest-neighbor resize + dithering, and grid-based sprite/frame slicing.

Features

  • Adds a node named Depth to Layers (depth to layers internally)
  • Maps grayscale/depth ranges to color layers using editable intervals
  • Interactive in-node editor with histogram, preview, add/drag/remove handles, and reset button
  • Adds a node named Grid Slice (grid slice internally)
  • Splits a sprite sheet or atlas into a batch of equally sized frames
  • Supports optional skip of the last grid column for irregular sheets
  • Adds a node named Resize + Dither (resize and dither internally)
  • Resizes each image in a batch using nearest-neighbor sampling
  • Applies dithering using either positional (ordered Bayer) or Floyd-Steinberg
  • In-node before/after preview with frontend-local updates from widget changes

Requirements

  • ComfyUI
  • Python dependencies:
    • torch>=2.6.0
    • numpy
    • pillow

Installation

  1. Clone or copy this folder into your ComfyUI custom nodes directory:
ComfyUI/custom_nodes/ComfyUI-GameDev
  1. Install this package (dependencies are defined in pyproject.toml):
pip install .
  1. Restart ComfyUI.

Node Info

Depth to Layers Node

  • Display name: Depth to Layers
  • Class key: depth to layers
  • Category: Game Development/Image Adjustments
  • Function: transform
  • Inputs:
    • intervals (required STRING, multiline JSON)
    • images (optional IMAGE)
    • node_id (hidden UNIQUE_ID, used for UI preview messaging)
  • Output:
    • IMAGE (images)

Grid Slice Node

  • Display name: Grid Slice
  • Class key: grid slice
  • Category: Game Development/Image Adjustments
  • Function: slice_image
  • Inputs:
    • image (IMAGE)
    • columns (INT)
    • rows (INT)
    • ignore_last_column (BOOLEAN)
  • Output:
    • IMAGE batch (all sliced frames)

Resize + Dither Node

  • Display name: Resize + Dither
  • Class key: resize and dither
  • Category: Game Development/Image Adjustments
  • Function: transform
  • Inputs:
    • images (IMAGE batch)
    • width (INT)
    • height (INT)
    • dither_mode (positional or floyd)
    • palette_mode (vga_256 or optimized_x_colors)
    • palette_colors (INT, used when palette_mode=optimized_x_colors)
    • node_id (hidden UNIQUE_ID, used for UI preview messaging)
  • Output:
    • IMAGE batch (resized + dithered RGB)

Usage

Using Depth to Layers

  1. Add Depth to Layers to your workflow.
  2. Connect an image output to the image input.
  3. Run once to populate preview and histogram.
  4. Click in the histogram to add intervals.
  5. Drag start/end handles to adjust intervals.
  6. Use Shift + click on an interval/handle to remove it.
  7. Click Reset to restore defaults.
  8. Run again to bake the updated output image.

Using Grid Slice

  1. Add Grid Slice to your workflow.
  2. Connect a sprite sheet image to image.
  3. Set columns and rows to match the sheet layout.
  4. Optionally set ignore_last_column to true if the last column should be skipped.
  5. Run to produce a batch of tiles/frames.

Using Resize + Dither

  1. Add Resize + Dither to your workflow.
  2. Connect an image batch to images.
  3. Run once to load before/after previews into the node.
  4. Adjust node widgets (width, height, dither_mode, palette_mode, palette_colors).
  5. Preview updates immediately in the frontend using local processing.
  6. Run again to bake the selected output into the graph.

How It Works

  • Backend processing lives in depth_to_layers.py, resize_dither.py, and grid_slice.py.
  • Frontend UI logic lives in js/depth_to_layers.js and js/resize_dither.js.
  • Shared color constants live in constants.py and are reused by both node backends.
  • The Depth to Layers UI previews interval changes locally in the node editor.
  • The Resize + Dither UI previews nearest-neighbor + dithering locally using the same algorithm as backend.

Notes

  • Depth to Layers stores intervals in intervals.
  • Depth to Layers outputs an RGB colorized image based on interval mapping.
  • Grid Slice divides image dimensions using integer grid steps (width // columns, height // rows).
  • If no image is provided to Depth to Layers, the node returns None.

License

See LICENSE.

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more