My flashcard app has a pet. Its name is Lúa, the Vietnamese word for the rice plant. Lúa is a small water buffalo in a leaf hat, and every card you review is one bundle of grass for it. Why a water buffalo? It is one of the symbols of Vietnam, my country.
Lúa is a real 3D model. You can drag to turn it around and tap to give it a pat. But nobody shaped that model by hand. It is the output of a Python script, 1,054 lines long, that runs inside Blender. I did not write the script either. Claude wrote it, in Claude Code.
I have never modelled anything in Blender myself. Not yet.
This post shows how that works, and what went wrong first.
The first version was plain three.js shapes
It started with four drawings of Lúa, one for each growth stage, from calf to herd leader.
The first 3D version had no model file at all. It was three.js code that put simple shapes together: ellipsoids, tapered tubes, a rounded solid for the head. The rig was one 479-line file, plus a file of shape helpers. It had six moods and four growth stages, and it worked. It just did not look like the drawing. The commit message says so: "the model is still an approximation of the 2D art".

A commit 86 minutes later replaces that code with a model file built in Blender. The Blender model in this picture is the model as it is today, not that first build.
Blender as a build step
The script never opens Blender's window. It runs from the command line:
/Applications/Blender.app/Contents/MacOS/Blender -b --factory-startup \
--python tools/mascot/lua_blender.pyIt starts from an empty scene, builds every part from code, and writes one
file, lua.glb. That file is committed next to the script. The app never
runs Blender. So Blender works like a compiler here: the script is the
source, and the model is the build output.
Here is the body, trimmed a little:
bm = bmesh.new()
ellipsoid(bm, TORSO_RADII, TORSO_CENTER, segments=40, rings=20)
ellipsoid(bm, *CHEST, segments=28, rings=14)
for x, z in LEG_SPOTS:
lathe(bm, (x, z), [...], start_y=0.2, end_y=0.78) # leg profile cut
skin = mesh_object('bodySkin', bm, 'coat', body)
fuse = skin.modifiers.new('fuse', 'REMESH')
fuse.mode = 'VOXEL'
fuse.voxel_size = 0.046
fillet = skin.modifiers.new('fillet', 'SMOOTH')
fillet.factor = 0.6
fillet.iterations = 6
bake(skin)Two ellipsoids make the trunk and the chest. Four legs are added. Then a voxel remesh fuses everything into one skin, and a smooth pass softens the places where the parts meet.
The sizes are not guesses. The script works in "head units", where the head is 1.8 wide. Its docstring says the sizes "were measured from the four stage drawings by counting pixels per color". The colors are not typed twice either: the script reads the palette from the same config file the app uses.
The face is painted on
In the drawing, the eyes, brows and blush are flat shapes. The script keeps them flat. It describes each one as a 2D outline, then shoots a ray at the head to find where every point lands on the surface:
def projector(bvh, toward=Z, across=X, up=Y, center=ORIGIN):
"""(x, y) on a plane in front of the surface → (point on the surface, normal facing the plane)."""
def project(x, y):
origin = center + across * x + up * y
hit, normal, _, _ = bvh.ray_cast(origin + toward * 6, -toward)
if hit is None:
hit, normal, _, _ = bvh.find_nearest(origin)
return hit, (normal if normal.dot(toward) > 0 else -normal)
return projectEach point is then raised a little off the skin. The face looks like the drawing from the front, and it still curves with the head when you turn the model.
One file, four ages
Lúa grows as you study. One model file holds all four stages. The horns show how:
horn_obj = mesh_object('horns', horns(1), 'horn', head)
for stage in (2, 3, 4):
grown = horns(stage)
add_morph(horn_obj, f'stage{stage}', [v.co.copy() for v in grown.verts])
grown.free()The base mesh is the calf's small buds. Each later stage is stored as a morph target: the same vertices at other places. In the browser, a growth value of 2.5 gives horns halfway between the young shape and the grown shape. The eyelids use the same trick to close.
The whole file is 938 KB: 45,700 triangles in 72 meshes, with 5 morph targets. It is not compressed yet.
A mood is a row of numbers
Lúa has six moods: happy, full, eating, hungry, sad and thin. None of them is a separate model. A mood is a row of numbers. Here are five of the fourteen numbers in each row:
// girth = how plump the body is, ear = ear droop, lid = eyelid (1 is shut)
happy: { girth: 1.0, ear: 0, browTilt: 0.1, lid: 0, tears: 0 },
full: { girth: 1.16, ear: -0.12, browTilt: 0.1, lid: 0, tears: 0 },
hungry: { girth: 0.93, ear: 0.25, browTilt: 0.5, lid: 0, tears: 0.7 },
sad: { girth: 0.97, ear: 0.5, browTilt: 0.55, lid: 0.12, tears: 1 },
thin: { girth: 0.78, ear: 0.6, browTilt: 0.42, lid: 0.45, tears: 0 },On every frame, the pose moves a little toward the numbers of the current mood:
const k = still ? 1 : 1 - Math.exp(-dt * EASE_RATE)
for (const key in target) pose[key] += (target[key] - pose[key]) * kEASE_RATE is 9. The step uses the real time between frames, so the motion
has the same speed on a slow screen and on a fast one. When you miss a day,
Lúa does not jump to a sad picture. The ears sink, the brows tilt, and the
tears fade in.

Two things cannot blend: the shape of the mouth, and open or closed eyes. Those switch at once. A blink of 0.14 seconds hides the switch.
Why it still looks like a drawing
Two small things on the three.js side do most of the work.
The lit parts use MeshToonMaterial with a light ramp of only four bytes:
two flat tones with a hard edge between them. The side facing away from the
light is just 10% darker.
The ink line comes from the OutlineEffect that ships with three.js. It is
about 2.4 pixels wide on a big canvas and thinner on a small one.
What the AI did, and what I did
Claude Fable 5.2 wrote the Blender script and the three.js code, in Claude Code. The commits carry its name as co-author.
My part was the start. I gave Claude the 2D drawings and asked it to turn them into 3D. The early results were not good. The three.js version above is one of them.
What this setup gives me is a model that is text. Six days after the first build, Lúa got twelve things to wear, such as glasses, a bell and a crown. That change was a diff. The script went from 788 to 1,054 lines, and the file from 640 KB to 938 KB.
Lúa lives in Etch, my flashcard app. You can meet Lúa here without an account: turn it around, feed it, and change its mood.
The model file is a build output. The source is text, so it can be read, diffed and reviewed like any other code.