Files
openclaw-dnd-city-visualiza…/scripts/adapters
rick 3d50023cfa Toolkit: segment, mass, render plates, batch, gate, matrices, cost, smoke test
Generalized from the render lanes' proven tools: map segmentation, 2.5D massing by
wealth zone, a CPU ray marcher with analytic landmarks and true-scale proxy people,
prompt composition from blocks, a self-calibrating batch submitter with a renderer
adapter point, the plate-vs-frame gates (drift, ECC, landmark region, skyline and
invented structures, figure brackets, corner sweep), matrix job builders, a cost
line, and an end-to-end smoke test on a synthetic town.
2026-10-14 11:39:57 +00:00
..

Renderer adapters

render_batch.py talks to the renderer through one function:

def submit(job, refs, spec, env):
    """job: one entry of jobs.json (id, prompt, size, refs, prompt_alt)
    refs: absolute paths of the reference images, IMAGE 1 first (the plate), then style/material refs
    spec: the jobs.json header (model, quality, ...)
    env:  {"key": IMAGE_API_KEY, "base": IMAGE_API_BASE}
    returns (status_code, png_bytes_or_None, error_body_text, response_headers_or_{})"""

The built-in openai_images adapter posts to an OpenAI-compatible /images/edits endpoint (multipart, image[] for every reference, prompt, size, quality, output_format=png). Jobs with no references go to /images/generations.

What the method needs from a renderer, in order of importance:

  1. Image-conditioned editing with several references where the first image is treated as the scene to re-surface and the others as material/style references. The plate must dominate the layout.
  2. A 16:9 output at 2048x1152 or similar so the plate-to-frame registration is pixel-comparable.
  3. No seed and no strength dial is fine. The method never relied on either: geometry is held by the plate and the prompt, variance is handled by rendering 2-4 takes and gating.
  4. A rate-limit signal (HTTP 429 with Retry-After, or any 5xx) so the batch runner can calibrate concurrency.

Return 429/5xx for "try later" conditions and any other non-200 for a hard failure. A body containing safety, moderation, content_policy or rejected triggers the one allowed rephrase (prompt_alt).

Drop your adapter in this directory as <name>.py and run render_batch.py --adapter <name>.