Skip to content

About

Production-grade real-time text-driven motion streaming for Unity digital humans, built on NVIDIA ARDY

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

embodied-human

A Unity runtime stack for real-time digital humans. Its central mechanism: emotional state is decided once per utterance — as an explicit 8-dimensional vector — and then fanned out to drive TTS prosody, facial expression, and body motion simultaneously. A channel arbitration layer keeps lip-sync, blinking, emotional expressions, and idle motion from overwriting each other at the mesh.

The problem this solves is concrete. In a typical pipeline, the TTS engine infers prosody from text alone, the face plays whatever expression a separate heuristic selects, and the body loops canned animation on its own clock. Even when every component is individually state-of-the-art, the composite reads as uncanny — because the components disagree about what emotion is being expressed, or whether any emotion is being expressed at all. Cross-modal agreement is one of the strongest signals human perception uses to judge whether a face belongs to a person; viewers cannot articulate what is wrong, but they detect it within seconds.

This repository implements the alternative architecture end to end: the hidden-JSON protocol that carries emotion out of the LLM reply, the resolver that modulates it by the character's personality, the arbitration layer that merges competing animation writers, and the production services that supply neural lip-sync and generative body motion. The result is not higher-fidelity animation — it is animation whose modalities agree.

Built for 《间隙》 (The Gap), a Pepper's Ghost installation in which two life-size avatars hold real-time LLM-driven conversations with exhibition audiences — voice, facial expression, and gesture all generated live, synchronized within ±0.3 s, running continuously on stage for hours.

The architecture in one picture

LLM reply ──► hidden JSON block ──► {emotion: {surprised: .8, happy: .3}, action: ...}
                        │
                        ▼
              EmotionResolver × personality gains     ← one decision point
                        │
          ┌─────────────┼──────────────────┐
          ▼             ▼                  ▼
      voice         face               body
   EmotionSpec   ExprParams →      IBodyEmotionSink
   → TTS emo     MorphArbiter      → motion persona
     vector      .Expression         (ARDY stream)
                        ▲
   lip-sync / blink / micro-motion / idle baseline
   all write through MorphArbiter channels — never the mesh

Read the deep dive: docs/consistency.md — including why personality is a gain stage rather than a mood dropdown, why channels compose by max rather than sum, and the failure modes that taught us.

What's in the box

The consistency layer — unity/consistency/

The soul of the repo. Pure C# at its core, testable outside Unity.

piece what it does
EmotionSpec The shared currency: 8-dim emotion vector + rate + pitch, in IndexTTS2's emo_vec ordering — consumed by voice, face and body alike
EmotionResolver Emotion × personality resolution: per-dimension gains, dominant+runner-up expression blending, emotion-driven speech-rate bias
HiddenJsonProtocol + ParamPayload The wire format for LLM emotional intent + paranoid defensive parsing (LLMs mangle JSON in exactly five ways; all five are handled)
PersonalityConfig + PersonalityDriver Hot-reloadable personality profiles: baseline expressions, emotion gains, voice habits. The same sentence becomes a different person
IBodyEmotionSink The body channel interface — one method between your motion system and emotional consistency

The expression layer — unity/expression/

piece what it does
MorphArbiter The single write point for all facial blendshapes. Lip/blink/expression/idle channels merged once per frame — the end of mouth-freezes-during-smile bugs
AvatarParamApplier + ParamManifest Rig-independence muscle: semantic params (expr_smile) map to whatever they mean on your rig — blendshape fan-out recipes, bones, materials, even lights and camera. Transient expression envelopes, cross-character expression claiming, sparse lerp transitions
BlinkController / FaceMicroMotionController / EyeMotionController The ambient layer that makes a resting face alive: procedural blinks, subtle random facial pulses, and physiologically-modeled eye motion (tremor, drift, saccades with undershoot+correction, occasional zoning out)

The lip-sync layer — unity/lipsync/ + server/a2e/

Neural audio→ARKit52 lip-sync with the timing insight that matters more than the model: analysis depends only on the audio, so run it when the clip is queued, not when it plays — the first syllable is exact instead of a second of volume-driven flapping. Includes the FastAPI reference server (LAM Audio2Expression), an identity map for ARKit-native rigs, and a real Daz mapping example. See docs/lipsync-setup.md.

The body layer — server/ + bridge/ + unity/motion/

Production-grade real-time text-driven motion streaming on NVIDIA ARDY: multi-session continuous motion service, persona hot-switching, gesture injection that flushes and replans mid-stream, jitter-buffered muscle-space retargeting onto any Humanoid rig. The full engineering story — measured latency budgets, retargeting minefields, deterministic gesture scheduling — lives in docs/architecture.md, docs/sync-patterns.md, and docs/retargeting-notes.md.

Quickstart

The layers compose but don't require each other — take what you need:

Face only (smallest useful subset): copy unity/expression/ + unity/consistency/, mount MorphArbiter + AvatarParamApplier + BlinkController + FaceMicroMotionController on any blendshaped humanoid, write a manifest. An afternoon. → docs/integration-guide.md

Add lip-sync: run server/a2e/a2e_server.py against a LAM install, copy unity/lipsync/, point at the identity map (ARKit rigs) or write your own mapping. → docs/lipsync-setup.md

Add generative body motion: the ARDY streaming server on a CUDA box, relay on the show PC, MotionStreamReceiver on your character.

# GPU box:
python server/ardy_stream.py --model soma --transport tcp \
  --session "a:6009:6011:idle" --prompts server/motion_prompts.example.json
# Show PC:
python bridge/tcp_to_udp_relay.py
# Drive it live:
echo "T:nods head once" | nc 127.0.0.1 6011

→ docs/deployment.md

Wire the consistency fan-out: twenty lines in your dialogue layer — see the copy-paste block in docs/integration-guide.md.

Repository layout

unity/
  consistency/   emotion resolution, personality, hidden-JSON protocol (+ example data)
  expression/    morph arbitration, param applier, ambient face motion
  lipsync/       neural lip-sync source + ARKit mapping (+ identity & Daz example maps)
  motion/        motion stream receiver + SOMA skeleton data
server/
  ardy_stream.py + persona library     generative body motion service
  a2e/a2e_server.py                    audio→ARKit52 lip-sync service
bridge/          TCP→UDP relay + local launcher
docs/
  consistency.md            ★ the architectural heart — start here
  integration-guide.md      assembly order, manifest authoring, verification checklist
  hidden-json-protocol.md   the LLM emotion wire format + defensive parsing
  lipsync-setup.md          lip service setup + the prefetch timing design
  architecture.md           body streaming design decisions
  sync-patterns.md          measured latency budgets + deterministic scheduling
  retargeting-notes.md      SOMA→Unity minefield documentation
  deployment.md             blank-environment runbooks

Citing and licenses

  • Code here is MIT (see LICENSE). A link back is appreciated if it ends up in research or a publication.
  • ARDY is © NVIDIA Corporation — nv-tlabs/ardy; checkpoints under the NVIDIA Open Model License, never bundled here. Cite the paper if you use the models.
  • LAM Audio2Expression is © its authors — aigc3d/LAM_Audio2Expression; same deal: weights and their license live there, not here.
  • unity/motion/soma_rest_pose.json / soma_bone_map.json derive from ARDY checkpoint skeleton definitions, redistributed under the same terms.

About

Production-grade real-time text-driven motion streaming for Unity digital humans, built on NVIDIA ARDY

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages