- comfy-spike/comfy.py: depth → ComfyUI/Z-Image render bridge over LAN - pixelart/pixelate.py: locked Primordyn recipe (Floyd–Steinberg, OKLab, linear-light) limited-256 dither; montage.py helper; primordyn_v2 palette - README + .gitignore; curated before/after + contact-sheet samples Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| comfy-spike | ||
| pixelart | ||
| .gitignore | ||
| README.md | ||
reikhelm tools — AI-render → pixel-art pipeline
Post-processing tools that turn a depth map into atmospheric, palette-locked pixel art via a local diffusion render. Two stages, glued by PNG files.
depth map ──► Stage 1: ComfyUI/Z-Image render ──► Stage 2: dither ──► pixel art
(synthetic now; (comfy-spike/comfy.py) (pixelart/pixelate.py)
real reikhelm
geometry next)
Setup
The pixelart tools share a venv (Pillow + numpy + opencv-headless):
python3 -m venv tools/pixelart/.venv
tools/pixelart/.venv/bin/pip install pillow numpy opencv-python-headless
comfy-spike/comfy.py is pure stdlib (no venv). LAN calls to ComfyUI need the Bash sandbox disabled.
Stage 1 — depth → diffusion render (comfy-spike/comfy.py)
Talks to ComfyUI over HTTP (workstation http://192.168.1.26:8188).
python3 comfy-spike/comfy.py depth --kind corridor --width 1536 --height 864 --out d.png # synthetic test depth
python3 comfy-spike/comfy.py zrender http://192.168.1.26:8188 --depth d.png --prompt "..." --prefix scene
# also: probe <url> | nodeinfo <url> <Node...> for introspection
Proven Z-Image depth recipe: ModelPatchLoader + ZImageFunControlnet, CLIP type qwen_image,
EmptySD3LatentImage, res_multistep/simple, 8–12 steps, cfg 1.0, ModelSamplingAuraFlow shift 3.0.
Depth strength ~0.6 for freeform; ~0.65–0.85 to honor real geometry.
Stage 2 — render → pixel art (pixelart/pixelate.py)
LOCKED "Primordyn" recipe = the defaults:
tools/pixelart/.venv/bin/python pixelart/pixelate.py render.png --palette pixelart/primordyn_v2.json
# → 640×360 · Floyd–Steinberg · OKLab match · linear-light · serpentine · fill
# --size 320x180 = chunky cut; --dither atkinson|jjn|bayer4|none to experiment
Outputs a true indexed PNG (+ optional --preview-scale nearest-neighbor preview). Palette loader
auto-detects .json / .gpl / JASC .pal / hex / Paint.NET / .png / adaptive:N.
Helpers & references
pixelart/montage.py— tile labeled images into a contact sheet.pixelart/samples/— curated reference: before/after pair + the kernel/size & palette-stretch contact sheets.
Next
Wire real reikhelm geometry → depth-map export (top-down from the renderer's distance field, then a height layer) into Stage 1, so we render actual generated dungeons. Later: port the locked Stage-2 dither into a Rust crate so the engine owns the whole chain. See project memory.