Overview
Kotonia's character chat can now turn one picture of a character into an avatar whose mouth, blinks and expressions move as it talks. No rigging. It costs 200 yen in points and takes about 10 minutes. If you have a PSD split into layers for Live2D, it is free.
Left: the original picture. Right: the avatar during a conversation (a recording of the real chat screen, with voice).
It took 13 hours from the first line of code to opening it to users. The work was done together with an AI agent (Claude Code). A lot was rebuilt along the way and a lot broke after release, so here it is in order.
- Why not Live2D, and what we did instead (moving the parts in code)
- What raised the quality: the source picture and how the variants were made. Fine-tuning the motion barely mattered
- Evaluation is hard: people do not look by area
- What broke on other people's pictures, and the fixes
- The quality gate: at rest, the right answer is the original picture, but measure the face separately
1. Not Live2D: moving the parts in code
We tried Live2D first. Loading a hand-made Live2D model with the Cubism SDK and driving it with the conversation's expression cues (below) worked within about an hour, and the motion was good. There were two problems.
- Rigging is manual work inside the Cubism Editor GUI. Having someone rig every user's picture does not scale
- Rendering a model a user brings with the Cubism SDK makes the service an "expandable application" under Live2D's terms, and the small-business exemption no longer applies
So we split the picture into parts and move the parts in code.
- The splitting is done by See-through, a model that separates one picture into layers (face, eyes, mouth, hair, clothes and so on)
- The motion runs on Canvas 2D in the browser: an affine transform per part, parallax by depth (turning the head moves the front hair a lot and the back hair the other way), the iris clipped to the eye white, and springs on the hair
- The amounts are kept under the same parameter names as Live2D (
ParamAngleXand so on), so the expression control written for Live2D is reused as is
Expressions and gestures are chosen line by line by the conversation's LLM. Replies already come back as a JSON intermediate representation (IR); each spoken block gained an expression (smile, shy, surprised…) and a gesture (nod, head tilt…). The expression switches the moment that block starts playing.
2. Quality came from the source picture and the variants
Once it moved, we spent about two hours on looks. In hindsight the order of what worked is clear.
What did not matter: fine motion
The first target was natural motion: small human-like jumps of the gaze (saccades), small head movements on the beat of speech, and so on. We built a way to render the same video every time from fixed input, and compared versions in blind pairs.
All 8 pairs were judged "the same". Neither I nor Gemini, shown the videos, could tell them apart.
What worked 1: drawn mouths
At the time the mouth opened by pulling the upper and lower lip parts apart. That was the most visible flaw: mouth shapes nobody drew, with doubled, jagged edges. Both Gemini and I pointed at it.
As in anime lip flaps, we now prepare three drawn mouths (closed, half open, open) and switch by voice level, with a little stickiness (hysteresis and a 60 ms hold).
What worked 2: the base picture
The first elf had been drawn by an image model (HiDream) from text alone. Redrawing from a reference image through the public API had hit Cloudflare's 100-second limit twice. We switched to a carefully drawn picture we already had.
What worked 3: paste back only what changed
The closed eyes and mouth shapes are made as variants of the original. At first HiDream's edit mode made them, but HiDream redraws the whole picture and even shifts the framing by 1.34–1.76x. We re-aligned them with feature points, and every re-alignment blurred the picture.
GPT-image came back with variants where only the changed region (674–7,514 pixels) had been pasted back onto the original (that is what happened through Codex). Nothing else moves by a single pixel, so no alignment is needed and the style matches. For users we call OpenAI's image API with a mask over the eyes or mouth and paste back only the masked region, so "only what changed" is guaranteed rather than lucky.
![]()
Another small but real fix: moving the side hair at the same depth as the front hair. Moving them separately showed the seam between parts as a line.
Prompts had their own quirks.
- Asked for an open mouth, HiDream stuck the tongue out. Writing "no tongue" did not stop it. A prompt that did not mention the tongue at all did
- Asked GPT-image for "a mouth saying 'a'", it opened too wide and round. "A natural mid-sentence talking shape, moderately open" looked right
- The first prompt said "Her … smile". On a male character (Ren) a straight face turned into a smile. The prompt now names no gender and says "keep the original expression"
3. Evaluation is hard: people do not look by area
This was the main lesson.
The fine motion work could not be told apart in any of the 8 blind pairs. Jagged lip edges, or a single line of a collar left over the neck, were noticed immediately. Viewers do not react to how much of the picture differs, but to the face, above all the mouth and eyes. The uncanny valley lives in small areas.
Automatic evaluation showed the same thing.
- Shown a video, Gemini looks at one frame per second by default. Small gaze jumps were invisible to it by design (specifying a frame rate did not help it tell them apart either)
- The quality gate below first measured "what fraction of the person differs from the original". That dilutes small damage on the face (a dark band across the mouth, one of two faces) over the whole body, and it was missed. Measuring the face area separately caught it
A way to measure improvement is needed before the improvement itself. But unless its weighting matches the human eye, it keeps saying that nothing changed.
4. What broke on other people's pictures
After tuning on our own picture, we let users make avatars from theirs. The first one made (I tried it with our official character Ren) came out misshapen.
![]()
| Symptom | Cause |
|---|---|
| A grey slab on the right shoulder | See-through put part of the shoulder's clothing into the "face" layer. The face is drawn over the clothes, so it showed on the shoulder |
| Grey on both sides of the jaw | The neck layer did not reach the corners of the jaw, so the collar lining showed. The threshold of the fill-in step was larger than the difference between that grey and skin |
| A straight face turned into a smile | The variant prompt said smile |
The agent first deleted stray islands from the face layer, but I suspected the real issue was separating the person from the background, and had it look there. Ren's picture is in front of a school, and the background had leaked faintly into every See-through layer (the back hair layer was split into 517 islands). Cutting the person out of the background first gave 1 face island and 6 hair islands.
Cutting out, however, made Ren lose both eye whites. So the pipeline falls back to the original picture with its background when the eye whites are missing. After that fix, running 10 more pictures (full body, two people, chibi, semi-realistic, hat, glasses, three-quarter view, dark skin, long hair, fox ears) broke more things.
- Full body, two people and chibi all failed. The eye and mouth mask was placed from each layer's bounding box, but layers can carry faint pixels over the whole canvas, so the whole picture was redrawn. It now uses visible pixels (a bug in the code the agent wrote)
- Chibi eyes are almost all iris and get no eye-white layer → build the eye white from the iris shape
- The underside of a hat brim over the face / a headphone band across the mouth → See-through also paints hidden areas into its layers. In layers drawn in front of the face, pixels that disagree with the original and get closer to it when removed are erased (99,823 pixels on the hat)
![]()
- Hands, arms and held objects vanished → the tool that assembles the layers had been reused from a chest-up Live2D PSD workflow and dropped hands and props as out of scope. Our published official character (Celestia) had been missing her arms since launch
- White specks around the hair on a dark screen → edges of layers split from a white background kept the white. Edge colours are now taken from the inside
- An oval of slightly different skin tone around the mouth, flickering as the mouth moved (I noticed it on Ren after release) → the mouth variants also redraw the skin shading around the mouth. Instead of one average colour shift, the difference "original − variant" is measured on skin away from the lips, spread smoothly across the oval, and subtracted
Nobody noticed the missing arms because the agent's checks were close-ups of the neck and never compared the whole picture with the original. The agent raised this itself in a retrospective, and it became the quality gate.
5. The quality gate: at rest, the right answer is the original
A user's avatar costs 200 yen in points when it is done. Broken ones like Ren's were charged too.
There is no right answer for motion, but at rest the right answer is the original picture. When an avatar is done, the parts are layered in the renderer's order into a still image and compared with the original inside the person's outline.
| Value | Meaning | Fails above |
|---|---|---|
| Largest differing blob (relative to the person) | partial damage like the shoulder slab | 1% |
| The same, inside the face | the band over the mouth, one of two faces | 2.5% |
| Fraction differing | overall collapse | 15% |
The mouth itself is not compared. The resting mouth is a closed drawing, which always differs from an original with an open mouth (at first we excluded a wide area around the mouth and missed the band across it).
The thresholds come from 6 broken and 13 good results. Everything that looked broken fails and every good one passes. Only the glasses band could not be caught by the gate; erasing painted-in areas (above) fixed it at the source. A failure costs no points, and the screen says that a single character facing forward works best.
What is left
- The pictures tested were our own characters and fictional ones made with an image model. Real user art, line art and monochrome are untested
- The gate only looks at the still picture. Discomfort that shows only in motion is not measured. How to define the right answer for motion is still open
- Pictures with two people are refused before making the avatar (a local LLM counts the faces)
- Chibi eyes flatten together with the iris when the expression narrows the eyes
Numbers: about $0.16 per avatar for OpenAI's image API (tokens used × the official price list) and about 8–12 minutes of GPU (See-through three times). The parts are 0.5–0.9 MB of WebP, rendered in the browser.
