Skip to content

Live2D Integration ​

Live2D serves as a primary rendering backend for Nimi Avatar. Powered by the official Cubism SDK for Web, Avatar does not guess package capabilities from scattered Cubism files alone. Instead, it systematically validates package assets, computes the proven compatibility tier, and presents the character through a shared, cross-platform embodiment surface.

This guide also explains how to author the Live2D Adapter Manifest. The adapter manifest enables creators to map an existing Cubism model to Avatar activities, expressions, lipsync channels, physics simulations, postures, and hit-test regions without altering the original model assets.

SDK and Renderer Boundaries ​

ConcernImplementation Component
Underlying SDKOfficial Cubism SDK for Web
Canvas RendererWebGL Canvas managed within apps/avatar
Model Entrypointmodel3.json, along with declared motions, expressions, physics, textures, and hit areas
Frame Update CycleCubism model.update() coordinated with Avatar frame scheduling
Audio Lipsync BridgewLipSync driving ParamMouthOpenY and optional mouth-form parameters
Package MetadataVerified adapter manifest and compatibility tier evaluation

Live2D operates under the closed backend discriminator kind: 'live2d'. The Avatar carrier translation layer consumes the neutral embodiment interface, meaning creator scripts never directly access Cubism internal classes or Live2D parameter extensions.

Asset Ingestion Pipeline ​

Avatar processes a Live2D package through four deterministic steps:

  1. Resolution: Locate and verify local asset paths using the Avatar package resolver.
  2. Resource loading: Parse the designated model3.json and load all referenced Moc bytecode, textures, and motion files.
  3. Compatibility evaluation: Validate the adapter manifest, license metadata, and asset signatures.
  4. Window bounds calculation: Calculate nominal physics bounds and mesh extents so the transparent desktop window neatly fits the character's visible silhouette.

Packages failing schema or licensing validation are rejected immediately. Missing essential files triggers fail-closed isolation, whereas missing optional parameters or expressions lowers the computed compatibility tier while emitting actionable diagnostic traces.

Compatibility Tiers ​

Compatibility TierDescription & System Posture
unsupportedValidation failed: missing core schemas, invalid licenses, or corrupted model files
render_onlyBasic rendering: character renders visually, but lacks promised motions, expressions, or lipsync
semantic_basicBaseline companion: essential companion activities (neutral, greet, listening, thinking) are mapped
companion_completeFull companion experience: verified support for all advanced Avatar desktop companion interactions

A package may declare a requested tier in its manifest, but Avatar only grants the highest tier verified by empirical validation.

Adapter Manifest Authoring ​

Creators can embed an adapter manifest directly within the model package:

text
<model-package>/runtime/nimi/live2d-adapter.json

Alternatively, desktop launchers can configure an external sidecar adapter. The system enforces a single-source-of-truth policy: embedded and sidecar adapters are never merged or blended.

The manifest begins with standard headers:

json
{
  "manifest_kind": "nimi.avatar.live2d.adapter",
  "schema_version": 1
}

Key Field Reference ​

FieldPurpose & Usage
adapter_idStable unique identifier for the adapter file
target_modelTarget model ID and relative path to model3.json
licenseRedistribution rights and test fixture terms
compatibility.requested_tierAuthor's requested evaluation tier
semantics.motionsMaps general activities (idle, greet, thinking) to Cubism motion groups
semantics.expressionsMaps standardized Avatar expression names to Cubism expression IDs
semantics.lipsyncDesignates the mouth opening parameter for audio lipsync
semantics.physicsConfigures model physics simulations
semantics.hit_regionsMaps user click aliases (head, body) to internal model hit areas

Feature declarations must be unambiguous: if a capability is missing from the model, mark it explicitly as unsupported or not_applicable with an explanation, rather than leaving fields empty for loaders to guess.

Minimum Adapter Example ​

json
{
  "manifest_kind": "nimi.avatar.live2d.adapter",
  "schema_version": 1,
  "adapter_id": "ren-live2d-adapter",
  "target_model": {
    "model_id": "ren",
    "model3": "ren.model3.json"
  },
  "license": {
    "redistribution": "allowed",
    "evidence": "Model owner reviewed redistribution rights.",
    "fixture_use": "committable"
  },
  "compatibility": {
    "requested_tier": "semantic_basic"
  },
  "semantics": {
    "motions": {
      "idle": { "group": "Idle" },
      "activities": {
        "neutral": { "group": "RenNeutral" },
        "greet": { "group": "RenGreet" },
        "listening": { "group": "RenListening" },
        "thinking": { "group": "RenThinking" }
      },
      "missing_activity": "diagnostic_no_success"
    },
    "expressions": {
      "map": { "happy": "smile" },
      "disposition": { "status": "supported" }
    },
    "poses": {
      "map": {},
      "disposition": {
        "status": "not_applicable",
        "reason": "Model has no pose3 file."
      }
    },
    "lipsync": {
      "mouth_open_y_parameter": "ParamMouthOpenY",
      "disposition": { "status": "supported" }
    },
    "physics": {
      "mode": "model_physics",
      "disposition": { "status": "supported" }
    },
    "hit_regions": {
      "map": {
        "head": ["head"],
        "body": ["body"]
      },
      "fallback": "alpha_mask_only",
      "disposition": { "status": "supported" }
    }
  }
}

Authoring Checklist ​

  • [ ] Exactly one *.model3.json file resides in the root.
  • [ ] target_model.model_id precisely matches the resolved model ID.
  • [ ] FileReferences.Moc and all referenced texture assets exist.
  • [ ] A looping idle motion group is configured.
  • [ ] When requesting semantic_basic, neutral, greet, listening, and thinking map to valid motion groups.
  • [ ] All mapped expression IDs exist within FileReferences.Expressions.
  • [ ] Lipsync parameters point to an active opening parameter (e.g. ParamMouthOpenY).
  • [ ] Hit region aliases map to declared model hit areas or specify an alpha-mask fallback.
  • [ ] Licensing terms are verified prior to distribution.

Diagnostic Codes ​

Diagnostic CodeUnderlying Cause & Resolution
AVATAR_LIVE2D_COMPAT_MANIFEST_INVALIDAdapter JSON failed schema validation
AVATAR_LIVE2D_COMPAT_MODEL_ID_MISMATCHAdapter target model does not match resolved model
AVATAR_LIVE2D_COMPAT_LICENSE_UNVERIFIEDMissing redistribution rights or license metadata
AVATAR_LIVE2D_COMPAT_MOTION_MISSINGDeclared motion group cannot be found in model definitions
AVATAR_LIVE2D_COMPAT_EXPRESSION_MISSINGDeclared expression ID missing from expression files
AVATAR_LIVE2D_COMPAT_POSE_UNAVAILABLESupported pose mapping claimed but FileReferences.Pose missing or unusable
AVATAR_LIVE2D_COMPAT_LIPSYNC_PARAMETER_MISSINGSpecified mouth-opening parameter missing in model
AVATAR_LIVE2D_COMPAT_HIT_REGION_MISSINGDeclared hit region cannot be resolved

Diagnostics clearly communicate what needs resolution; Avatar avoids pretending partial failures are complete successes.

Typical Scenario: Diagnostic and Resolution ​

When validating a Live2D package claiming pose support:

  1. Inspection: Avatar evaluates the model package and adapter manifest against declared capability requirements.
  2. Identify defect: A supported pose mapping is declared, but FileReferences.Pose is absent or unusable.
  3. Diagnostic feedback: Emits typed diagnostic AVATAR_LIVE2D_COMPAT_POSE_UNAVAILABLE and marks the tier as unsupported rather than silently masking the error.
  4. Resolution: The creator either removes the unsupported pose declaration or adds the missing pose asset and re-validates the package.

Source Basis ​

Documentation for Nimi — the installable, open-source, local-first personal AI product.