Tech16 min read

Fixing Head Shape, Face Texture, and Lighting on a 3D Pose Guide for Kana's Small-Talk Images

IkesanContents

After my previous post on wiring small-talk images and task handoffs for Kana, I switched the image pipeline for my custom chat assistant “Kana” (which generates casual daily-life character images to accompany small-talk messages) from passing only official artwork to also supplying a posed 3D model render as a guide image for pose and composition.
Looking at the generated images, however, Kana’s head consistently looked flattened rather than round. Because those outputs rely on the 3D guide render, I started by measuring the 3D mesh on an M4 Mac mini and worked through the head shape, jaw contour, facial texture, and guide lighting step by step.

Guide Pipeline and Test Environment

Qwen writes the small-talk text, and once the text is set, the same Qwen model chooses a matching posture, arm poses, camera angle, and outfit.
A background local server receives that specification, poses Kana’s 3D model, and renders a single guide image in Blender. It then passes two reference images (the 3D guide and the official outfit artwork) to Codex CLI’s built-in image generation to render the scene. Because this generates a new image from reference inputs while closely inheriting the guide’s pose and silhouette, I refer to it as I2I (image-to-image) below. Another Qwen instance on Kana’s side reviews the finished image before posting it to chat.

flowchart TD
    A["Qwen writes the small-talk text"]
    B["Qwen selects posture, camera, and outfit"]
    C["Resident server renders 3D guide in Blender"]
    D["Pass 3D guide and outfit art to Codex image generation"]
    E["Kana-side Qwen checks the generated image"]
    F["Post image to chat"]
    A --> B --> C --> D --> E --> F

The 3D model is a mesh (a 3D surface built from polygons) generated from Kana’s artwork and rigged with bones in Blender for posing.
All work ran locally on an M4 Mac mini, with Claude Code writing the measurement and mesh-editing scripts and running test generations under my instructions.

ItemDetails
EnvironmentM4 Mac mini, rendering via Blender’s Python bpy module
3D Model~1.04M vertices, ~2.00M polygons, 8192x8192 texture (2D image mapped onto the 3D surface), 22 bones
Guide RenderingCycles (Blender’s renderer) on CPU, orthographic camera (no perspective distortion). Before the lighting fix, rendered unlit (no light calculation, showing raw texture colors)
Image GenerationCodex CLI built-in image generation (two references: 3D guide and official outfit art)
Test MethodReused prompts from past small-talk posts and swapped only the 3D guide image, generating one image per test

Every measurement in this post comes from this setup, with lengths normalized so full body height equals 1.0.

Measuring Head Cross-Sections by Height

At first, Claude Code suspected the head looked flat because the guide render had no lighting.
Rendering the mesh in plain gray with a light did show surface detail on the chest, waist, and hair strands, but that only checked local surface bumps, not the overall width-to-depth ratio of the head.

Suspecting the base shape itself was off, I had Claude Code measure cross-sections of the head at different heights (linear values normalized to full body height = 1.0).

Measured PartValueCondition
Head width (including hair, excluding side ponytail)0.171-
Head depth (front hair tips to back of head)0.161Smaller than width
Back-of-head rear position (neck to near crown)0.058–0.061Almost constant, forming a flat vertical wall
Neck depth / width0.61–0.67Flat like a board
Chest / waist / hip depth / width0.68–0.81Not flattened
Thigh / shin depth / width~1.1Nearly circular, no issue

While the torso and legs had normal proportions, the head, neck, and back were compressed front-to-back, leaving the back of the head as a flat vertical wall.
Since a head is normally deeper front-to-back than it is wide, a depth of 0.161 against a width of 0.171 is more than 20% short. From high-angle or rear-quarter cameras, that shallow back of the head produced a wide, low silhouette, and because I2I closely traces the guide’s outline, the final images inherited the exact same flattened shape.

Reshaping the Head to Match a Sphere

Fixing the head took four iterations.
On the first two tries, I stretched the rear half backward and widened the sides along the axes, but stretching a flat surface only produces a stretched flat surface. Even when the width and depth numbers lined up, it still did not look spherical.

From the third try, I changed approach: pick a center point inside the head, measure the hair’s outer radius in every direction from that center, and push each vertex outward radially by the difference from a target sphere radius.
That expanded the flat back of the head the most while leaving the already-protruding bangs almost untouched, preserving the sculpted hair strand detail. Expanding the head buried the hair tie inside the skull, so I translated the side ponytail, scrunchie, and top ahoge outward to sit on the new surface.
The third pass looked round but made the head too large, so on the fourth pass I lowered the target sphere radius to 0.091.

PassChangeResult
1stStretched rear half backward and raised the crownDepth 0.191, width 0.171. Looked like a tall egg from a high angle
2ndWidened by 14% and reduced crown liftDepth 0.191, width 0.195. Looked flatter than pass 1 from a steep top-down view
3rdFitted outer hair shape to a radius-0.098 sphere around the head centerDepth 0.193, width 0.201. Round, but the head looked too big
4thReduced sphere radius to 0.091Depth 0.182, width 0.188. Stayed round at a smaller size

Below, the top row shows the original model and the bottom row shows pass 4, from left to right: side profile, high angle, and straight overhead.

Unlit clay comparison of the head. The original model on the top row forms a wide oval from directly above, while the fixed model on the bottom row is nearly circular.

Along with the head, I thickened and slightly lengthened the neck and added curvature to the back around the shoulder blades.
Here are two I2I outputs using the same small-talk prompt and outfit art, swapping only the guide: left uses the original model, right uses the pass-4 guide (including the neck and back adjustments).

Two generated images of Kana holding a mug in a kitchen. On the left her head is wide and low; on the right the back of her head is round.

Adding Head Orientation and Torso Tilt Controls

The original guide setup only combined three postures (standing, sitting, walking) with four poses each for the left and right arms. Even though the model already had head, neck, and spine (waist and chest) bones, none of them were ever rotated, so every guide stood stiffly upright facing straight ahead.
Whenever consecutive small-talk posts picked the same posture, the guide image barely changed, leaving Kana standing straight like a board whether in a kitchen or a bakery.

I tested each bone up to its deformation limit and added six angle parameters. Head angles are split across the neck and head bones, torso angles across the waist and chest bones, and the “hold” and “reach” arm poses follow the tilted torso.

ParameterRange (deg)Direction
Head yaw (left/right turn)-50 to 50Positive turns to Kana’s left
Head pitch (nodding up/down)-25 to 25Positive tilts upward
Head roll (side tilt)-20 to 20Positive tilts toward Kana’s left shoulder
Torso pitch (forward/back lean)-10 to 25Positive leans forward
Torso roll (side lean)-15 to 15Positive leans to Kana’s left
Torso yaw (twist)-30 to 30Positive twists to Kana’s left

I also updated Qwen’s prompt so it picks angles matching actions in the text, such as looking down at her hands or glancing back, instead of defaulting to a front-facing upright pose.
On the first small-talk post after restarting the local server, Qwen requested a 20-degree downward head tilt and a 5-degree forward torso lean, and the generated image came out leaning forward and looking down.

Checking Whether the Generated Face Drifted Toward the 3D Texture

Once the head shape and posing were fixed, looking closely at the generated faces showed orange-tinted hair, sharp eyes, and a bright cyan scrunchie.
Comparing the official front artwork against the 3D model’s front view showed that the model’s own texture already differed in color and eye shape. Left is the official art; right is the 3D model.

Official artwork on the left and the 3D model front view on the right. The 3D model has more orange hair, narrower eyes, and a bright cyan scrunchie.

Measuring saturation (color vividness, where 0 is grayscale and 1 is fully saturated), the official art’s hair sat around 0.43 versus 0.61 on the 3D model, and the scrunchie was 0.28 (muted grayish blue) versus 0.91 (bright cyan) on the 3D model. The official eyes are tall and round, whereas the 3D model’s eyes are wider with sharp upper eyelids.
Because the official artwork is supplied as the outfit reference, the generator appeared to pull facial colors and eye shapes from the 3D guide instead.

When I generated the same small-talk scene using a grayscale guide with color stripped out, the pose stayed intact while the eyes turned round and brown and the scrunchie returned to grayish blue. The guide’s texture was indeed steering the face colors and eyes.

Switching permanently to grayscale guides is an option, but I still want the guide to communicate which side the hair tie sits on and when it is visible or occluded.
Instead, I decided to bring the 3D model closer to the official art, starting by lowering the hair and eye saturation by about 30% and recoloring the scrunchie to match the official grayish blue.

Matching the 3D Jaw Contour to Official Artwork

With the colors closer, comparing the front views showed that the face silhouette itself did not match.
The official artwork has fuller cheeks that curve smoothly into a small chin, whereas the 3D model tapers straight down from the cheeks to the chin in a home-plate shape.

My first measurement failed. I compared the width of visible skin between the side hair in both images and widened the jaw to match, but visible skin width depends on where the side hair sits rather than the actual jawline. The numbers matched, yet the silhouette still looked nothing like the official art.

I switched to extracting the actual facial contour from the official front face. Normalizing the distance between the centers of both eyes to 1.0, I measured the half-width from the face centerline to the contour moving downward from eye level.

Distance Below Eye LevelOfficial Art Half-Width3D Model Half-Width
0.700.680.63
0.800.580.52
0.900.450.41
1.00 (near chin tip)0.250.39

From the cheeks to the jaw, the official art is about 10% wider, while at the chin tip the 3D model is wider.
When I first shifted vertices laterally toward these targets, the hair moved along with the skin and the hair tips beside the jaw turned wavy. I added a texture-color check to select only skin vertices while leaving hair strands untouched; after a few rounds of re-measuring and adjusting, the half-width error dropped to 0.01 or less across distances 0.5 to 1.0 below eye level (the table shows 0.70 and below).

Even with the geometry matched, the jaw still looked like a home plate.
Because the guide rendered unlit from raw texture colors, no 3D shading was computed, so the visible jawline came from the painted neck shadow on the texture, and that shadow still followed the old V-shape.
Repainting the official jawline and neck shadow onto the adjusted jaw position finally made the face look round.

Below, from left to right: the official art, the adjusted 3D model, and the overlaid contours (red for official art, blue for the 3D model).

Comparison of the official artwork, the adjusted 3D model front view, and overlaid facial contours. The red and blue point sequences nearly overlap.

Projecting the Official Front Face onto the 3D Model

Rounding the jaw did not change the sharp eyes painted on the texture, so I aligned the official front expression sheet by the eye centers and projected it onto the 3D model’s face from the front.

I first tried Blender’s bake feature (baking surface colors onto a texture image). Direct rendering of the projected color landed in the right spot, yet baking stretched the eyes horizontally and shifted them off position.
Switching to a custom script that paints texture pixels triangle by triangle aligned the eyes accurately.

Next, the bangs broke. Projecting the full front face painted the official bangs and eyebrows onto the forehead mesh, overlapping the 3D hair strands and creating a cropped band across the forehead.
I restricted the repaint to below eye level so the forehead, eyebrows, and bangs kept their original texture. Because the 3D bangs protrude in front of the face surface (meaning a straight front projection would also paint skin and eye colors onto the hair), I also excluded vertices sitting in front of the facial plane.

Why Stray Hair Lines Still Appeared on the Bangs

Even after that, odd dark lines remained across the bangs.
Rendering the untouched original model from the same camera with and without its texture revealed the cause. Left has the texture enabled; right shows the geometry alone.

Close-up of the original model's face. Left with texture, right geometry only. Dark lines cut diagonally across the inside of the sculpted hair strands on the left.

The misalignment had been there from the start. The bangs are sculpted as thick individual strands, but the dark lines painted on the texture sat off the strand edges and ran across the middle of the strands, with thin lines from the source illustration baked onto geometry of a different width and position.

I tried once to repaint strand lines from the geometry by darkening vertices along valleys and edges between hair strands, which turned the hair into an indistinct brown lump and painted the neck shadow in hair color.
I gave up on painted hair lines altogether, replaced the hair texture with a flat solid color, and switched to lighting the 3D guide so real shading defines the overlapping strands.

Adding Lighting and Solid-Color Hair to the Guide

Turning on lighting alone cast the bangs’ shadow onto the eyes and darkened the face, so I combined a diffuse shader (a surface that shows light and shadow) with mild emission (self-illumination so shadowed areas stay readable).
Because solid-color hair turns into a flat silhouette without lighting, I swapped the model and render script into production together.

ItemBeforeAfter
SurfaceUnlit raw texture emissionDiffuse shading plus mild emission
LightingNoneLow ambient light plus a key light (main light) from upper-left of camera
BackgroundLight graySame gray to the camera, with background ambient light on the character reduced so the backdrop does not wash out shadows
Samples (rays per pixel)248 (with denoising to smooth out render grain)
Render time per guide-8 seconds at production resolution

Left is the guide before the change; right is after.

Comparison of the 3D guide render. Left has painted hair lines and looks flat; right has no painted lines and shows hair strands through shading.

Testing Five Outfits and Poses with the New Guide

After deploying the updated model and render script, I triggered one small-talk post through the local server’s test endpoint.
Text and pose planning, guide rendering, image generation, Kana-side review, and chat delivery all ran through, and the review passed without revisions.

I then generated five additional scenes with different outfits and poses using test prompts (without running the Kana-side review step).

SceneOutfitGuide ParametersResult
Reading on sofaPink loungewearHolding with both hands, head down 18 deg, forward lean 8 degForward lean, downward gaze, and outfit all came through (1st image below)
Looking back in bookstoreGray sweaterRear-quarter view, head left 40 deg, torso twist 20 degOver-the-shoulder glance reproduced accurately (2nd image below)
Latte at cafeWhite shirtRight hand near face, head left 20 degBrought cup toward mouth while looking to the side
Standing stretchSportswearRight arm extended, torso right tilt 12 degOutfit matched; torso tilt mostly disappeared
Walking with ice creamYellow T-shirtWalking, holding in right hand, head right 25 degWalking pose came through, but the face stayed nearly front-facing

Large motions like looking down or turning back carried over well, whereas smaller angles like a 12-degree torso tilt or a 25-degree head turn mostly vanished in the final images. Head roundness, jaw shape, and eye and hair colors stayed consistent across all five outputs.

Here are the first two scenes with the 3D guide on the left and the generated image on the right.

Reading on the sofa (left: guide, right: generated image).

3D guide and generated image for reading on a sofa. Both lean forward looking down at the book.

Looking back in a bookstore (left: guide, right: generated image).

3D guide and generated image for looking back in a bookstore. Viewed from behind at an angle, glancing back over her left shoulder.

A few rough edges remain. There are no finger bones yet, so the hands stay partially curled, and sitting poses distort the hip joints.
Because the face texture was projected straight from the front, turning the head around 70 degrees sideways reveals dark artifacts along the cheek and jaw edge. Also, the official front expression sheet used for projection has a smile, so the guide’s mouth always smiles, though the generated images varied their expressions per scene and have not shown any practical issue so far.


In whether MOSS-Image can keep a side ponytail in place from a right profile, even rewriting training captions never got the hair tie to consistently stay tucked behind the head in right-side profiles.
Since switching to 3D guide renders, side-ponytail placement errors have nearly disappeared. Driving generation from 3D still wins here.