Skip to content

[feature] ComfyUI-on-Modal manga character pipeline for visual novel assets#67

Draft
lf1up wants to merge 2 commits into
mainfrom
cursor/comfyui-manga-pipeline-3752
Draft

[feature] ComfyUI-on-Modal manga character pipeline for visual novel assets#67
lf1up wants to merge 2 commits into
mainfrom
cursor/comfyui-manga-pipeline-3752

Conversation

@lf1up

@lf1up lf1up commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

New standalone imagegen/ root directory: a ComfyUI deployment on modal.com that generates consistent 2D manga characters for the visual-novel features — one full-body master sprite per character plus identity-preserving derived shots of the same character (face close-ups with different expressions, upper-body, hands, profile…), "interactive manga adventure" style.

Approach (hybrid, per plan)

  • Stage A — base sprite: Animagine XL 4.0 Opt (SDXL anime, CreativeML Open RAIL++-M — commercial use permitted) renders a full-body master sprite; BiRefNet (MIT) cuts a transparent VN-ready PNG.
  • Stage B — body parts / expressions: Qwen-Image-Edit-2509 fp8 (Apache 2.0, native ComfyUI nodes) takes the master sprite + an instruction ("Close-up portrait of this exact character's face, smiling…") and renders identity-preserving shots. Lightning 4-step LoRA by default (~4–8× faster), full 20-step schedule via --no-lightning.

What's included

  • imagegen/modal_app/app.py — Modal app: pinned image build (comfy-cli 1.12.0 / ComfyUI 0.27.0 / comfyui_birefnet_ll@1.1.4), ~38 GB of HF weights cached in a Modal Volume and symlinked into ComfyUI, interactive ComfyUI dev server (modal serve), headless JSON API (proxy-auth protected) on an L40S with scale-to-zero, and a modal run smoke test.
  • imagegen/workflows/ — API-format graphs: character_base.json (txt2img + alpha branch) and character_edit.json (Qwen edit + alpha branch).
  • imagegen/scripts/generate_character.py — CLI turning a character spec (flags or JSON file) into a full bundle: base.png, base_raw.png, face_<expression>.png, shot_<name>.png, manifest.json with seeds for reproducibility. 8 built-in expressions, 4 built-in shots, custom instructions supported.
  • imagegen/RESEARCH.md — research findings: Modal ComfyUI pattern, model licensing comparison, consistency approaches considered (crop-and-refine, VNCCS, per-character LoRA), future work (persona wiring, poses, memory snapshots).
  • imagegen/README.md — setup, deploy, usage, costs (~$0.05–0.15 per bundle on L40S).

Validation

Ran against a live local ComfyUI 0.27.0 installed with the exact pinned commands from the Modal image (CPU flavor):

  • comfy --skip-prompt install --fast-deps --version 0.27.0 and comfy node install --fast-deps comfyui_birefnet_ll@1.1.4 install cleanly with comfy-cli 1.12.0.
  • All 4 workflow variants (base ± alpha branch, edit ± Lightning/alpha) submitted to the live /prompt endpoint: graph/schema validation passes; the only reported errors are the missing model files themselves (expected locally — they live in the Modal Volume).
  • The infer() serving path exercised end-to-end with real comfy run --wait executions: input-image write → execution → output collection by unique prefix → RGBA correctness proven (with InvertMask the foreground stays opaque; the counterfactual without it produces a fully transparent foreground, confirming the JoinImageWithAlpha inversion semantics).
  • All 6 HF model files resolve anonymously (no token needed), ~38.3 GB total, verified via HF metadata.
  • Modal SDK 1.5.2 API usage verified (fastapi_endpoint(requires_proxy_auth=...), modal.experimental.stop_fetching_inputs, App.cls(scaledown_window=...)); app imports and registers ui + ComfyUI.
  • Client CLI helper logic tested (spec merge, expression/shot resolution, argparse).

Not yet run: live modal deploy + GPU sample bundle — blocked on Modal credentials (no ~/.modal.toml / MODAL_TOKEN_ID in the agent environment). Once credentials are available (Cursor Dashboard → Cloud Agents → Secrets, or modal setup locally):

cd imagegen && uv sync
uv run modal deploy modal_app/app.py   # builds image + downloads weights (one-time)
uv run modal run modal_app/app.py      # smoke test: base + happy face to /tmp/imagegen-smoke

Out of scope (documented in RESEARCH.md)

Wiring into agent/ persona data, generating the 9 existing personas, per-character LoRA training, pose ControlNet.

Open in Web Open in Cursor 

Standalone imagegen/ root directory generating consistent 2D manga
characters for the visual novel features: Animagine XL 4.0 full-body
master sprite (BiRefNet alpha cut-out) plus identity-preserving
face/expression/body-part shots via Qwen-Image-Edit-2509 with the
Lightning 4-step LoRA.

- modal_app/app.py: pinned comfy-cli/ComfyUI image build, HF model
  downloads into a Modal Volume, interactive ComfyUI dev server, and a
  proxy-auth JSON API executing API-format workflows headlessly
- workflows/: character_base.json and character_edit.json (validated
  against ComfyUI v0.27.0 node schemas)
- scripts/generate_character.py: character spec -> full asset bundle
  (base + expressions + shots) with reproducibility manifest
- RESEARCH.md: model/licensing research and design rationale

Co-authored-by: Pavel Vdovenko <lf1up@outlook.com>
@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
careersim-landing Ready Ready Preview, Comment Jul 17, 2026 2:14am
careersim-web Ready Ready Preview, Comment Jul 17, 2026 2:14am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 908e0760-86b5-4983-bf5b-1b1984262398

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/comfyui-manga-pipeline-3752

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.09%. Comparing base (cf657bc) to head (f560c10).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #67   +/-   ##
=======================================
  Coverage   72.09%   72.09%           
=======================================
  Files          60       60           
  Lines        4254     4254           
  Branches      662      662           
=======================================
  Hits         3067     3067           
  Misses        978      978           
  Partials      209      209           
Flag Coverage Δ
agent 68.59% <ø> (ø)
api 82.77% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lf1up lf1up changed the title feat(imagegen): ComfyUI-on-Modal manga character pipeline for visual novel assets [feature] ComfyUI-on-Modal manga character pipeline for visual novel assets Jul 17, 2026
…F metadata)

Co-authored-by: Pavel Vdovenko <lf1up@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EXPERIMENT] [feature] Flow for visual novel assets generation

2 participants