No description
  • C# 99.1%
  • Python 0.9%
Find a file
2026-06-27 23:16:16 +02:00
docs Add event-scenes feature 2026-06-27 14:12:35 +02:00
external Update NovelAI.ImageGen submodule (InHeat/Ahegao emotions) 2026-06-27 14:18:23 +02:00
scripts v0.6.4: New background removal models (BiRefNet, Anime-Seg, ToonOut) 2026-06-17 13:18:45 +02:00
src/NovelAI.VisualNovelCreator Reject duplicate scene/variation names on creation 2026-06-27 20:43:03 +00:00
tests/NovelAI.VisualNovelCreator.Tests Reject duplicate scene/variation names on creation 2026-06-27 20:43:03 +00:00
.gitignore v0.1.0: Initial release of NovelAI Visual Novel Sprite Creator 2026-03-31 22:22:00 +02:00
.gitmodules chore: point NovelAI.ImageGen submodule to TeamAI org 2026-06-27 14:01:31 +02:00
CHANGELOG.md v0.6.4: New background removal models (BiRefNet, Anime-Seg, ToonOut) 2026-06-17 13:18:45 +02:00
CLAUDE.md v0.6.4: New background removal models (BiRefNet, Anime-Seg, ToonOut) 2026-06-17 13:18:45 +02:00
Directory.Build.props v0.1.0: Initial release of NovelAI Visual Novel Sprite Creator 2026-03-31 22:22:00 +02:00
Directory.Packages.props v0.6.4: New background removal models (BiRefNet, Anime-Seg, ToonOut) 2026-06-17 13:18:45 +02:00
NovelAI.VisualNovelCreator.slnx v0.1.0: Initial release of NovelAI Visual Novel Sprite Creator 2026-03-31 22:22:00 +02:00
README.md v0.6.4: New background removal models (BiRefNet, Anime-Seg, ToonOut) 2026-06-17 13:18:45 +02:00

NovelAI Visual Novel Creator

A cross-platform desktop application for creating visual novel character sprites using the NovelAI image generation API.

Features

  • Character Management — Create and organize characters with multiple subsets (outfits, poses, art styles)
  • Tag-Based Generation — Configure positive/negative tags with strength controls for precise image generation
  • Style References — Upload reference images with adjustable strength and fidelity to guide generation
  • Emotion Variants — Batch-generate 24 emotion expressions from a base image using NovelAI's augment emotion API
  • Background Removal — Remove backgrounds from generated sprites using local ONNX models (BiRefNet, Anime-Seg, ToonOut, BRIA RMBG 1.4 & 2.0)
  • Generation Queue — Sequential job queue with pause, resume, and abort controls
  • Character-Level Tags — Share tags and references across all subsets of a character
  • Breadcrumb Navigation — Visual navigation path with back-navigation support
  • Encrypted Token Storage — API tokens stored securely using OS-level encryption

Screenshots

The application has three main views:

  1. Character Overview — Browse and manage a character's subsets with thumbnail previews
  2. Subset Editor — Configure tags, generate base images, and produce emotion variants
  3. Sprites Tab — Generate transparent background-removed sprites for use in visual novel engines

Getting Started

Prerequisites

Build & Run

git clone --recurse-submodules https://github.com/your-repo/NovelAI.VisualNovelCreator.git
cd NovelAI.VisualNovelCreator
dotnet build
dotnet run --project src/NovelAI.VisualNovelCreator

If you already cloned without submodules:

git submodule update --init --recursive

First Launch

  1. Open Settings from the sidebar
  2. Enter your NovelAI API token and click Validate
  3. Choose a Default Save Location for character data
  4. (Optional) Configure a background removal model in the Background Removal tab

Usage

Creating a Character

  1. Click Add Character in the sidebar
  2. Enter a name for the character
  3. Add subsets (e.g., "school_uniform", "casual") to define different visual variants

Generating Images

  1. Select a subset from the sidebar
  2. Add positive tags (what you want) and negative tags (what to avoid)
  3. Optionally upload reference images for style guidance
  4. Click Generate Base Image
  5. Switch to the Emotions tab and click Generate All Emotions

Background Removal

  1. Go to Settings > Background Removal
  2. Select a model provider (BiRefNet, Anime-Seg, ToonOut, or BRIA RMBG-1.4 / 2.0)
  3. Choose a variant and click Download from HuggingFace
    • RMBG-2.0 requires a HuggingFace token (gated model); BiRefNet and Anime-Seg need no token
    • ToonOut has no hosted ONNX — produce it with scripts/convert_toonout_to_onnx.py, then Browse to the file
  4. In the subset editor, switch to the Sprites tab
  5. Click Generate All Sprites to batch-remove backgrounds

Project Structure

src/NovelAI.VisualNovelCreator/     Main Avalonia desktop app
  Models/                            Domain models and settings
  Services/Contracts/                Service interfaces
  Services/Implementation/           Service implementations
  ViewModels/                        MVVM ViewModels
  Views/                             Avalonia XAML views
  Views/Controls/                    Reusable custom controls

tests/NovelAI.VisualNovelCreator.Tests/    NUnit test project (~360 tests)
external/NovelAI.ImageGen/                 Git submodule: NovelAI API client
docs/                                      Architecture and design documentation

Architecture

The application follows a clean MVVM architecture:

  • Views — Pure XAML, no code-behind logic
  • ViewModels — UI state and commands via CommunityToolkit.Mvvm
  • Services — Business logic, file I/O, API integration, background removal

Key architectural decisions:

  • Sequential generation queue — Jobs processed one at a time via Channel<T>, with pause/resume/abort
  • Settings snapshot pattern — Each job captures settings at enqueue time, immune to mid-queue changes
  • Atomic file writes — All persistence uses .tmp + rename to prevent corruption
  • Provider pattern for background removal — Extensible for additional ONNX models
  • Encrypted token storage — Uses Microsoft.AspNetCore.DataProtection (DPAPI/Keychain/file keys)

See docs/architecture.md for detailed technical documentation.

Technology Stack

Component Technology
UI Framework Avalonia 11.3
MVVM CommunityToolkit.Mvvm 8.4
Runtime .NET 10.0
AI Inference ONNX Runtime 1.26
Image Processing SixLabors.ImageSharp 3.1
Logging Serilog
Testing NUnit 4 + NSubstitute
Serialization System.Text.Json (source-generated)

Background Removal Models

Model Architecture Size License Auth Notes
BiRefNet (Lite) BiRefNet SwinT 115 MB (FP16) MIT None Fast; strong fine-detail edges
BiRefNet (Full) BiRefNet SwinL 490 MB (FP16) MIT None Highest quality; slower
Anime-Seg IS-Net (SkyTNT) 176 MB Apache-2.0 None Anime-specialized; fast
ToonOut BiRefNet fine-tune ~885 MB MIT None Anime-specialized; convert locally, then Browse
BRIA RMBG-1.4 IS-Net 88 MB (FP16) CC BY-NC 4.0 None Good for anime; non-commercial
BRIA RMBG-2.0 BiRefNet 514 MB (FP16) CC BY-NC 4.0 HuggingFace token Non-commercial; gated

All models run locally via ONNX Runtime — no cloud inference required after download. The app ships only the loader and downloads weights on demand. See docs/research/background-removal-models-2026.md for the model comparison and recommendations.

File Storage

Character data is stored as plain files in your chosen save location:

{SaveLocation}/{CharacterName}/
  character.json          Character definition (tags, subsets, references)
  {SubsetName}/
    base_image.png        Generated base image
    emotions/             24 emotion variant PNGs
    transparent/          Background-removed sprite PNGs
    references/           Style reference images

Testing

dotnet test

The test suite includes:

  • Service unit tests (character store, generation queue, settings, token store, download service)
  • ViewModel unit tests (navigation, settings, subset editor, queue panel)
  • Serialization round-trip tests
  • DI container smoke tests
  • End-to-end queue integration tests

Documentation

License

This project is for personal use. The NovelAI API requires a valid subscription.