Eyes and mouth
🧪 in progress · the eye works and the output was judged a failure; the mouth is not painted at all · the method name and where a person writes it: appendix G · code: appendix B
How an artist paints it
An eye is a part to be drawn rather than shaded: one shape for the sclera, one for the iris (darker above and brighter below, either a gradient or two bands), one dark shape for the pupil, the upper lid with its lashes as the thickest and blackest line there is (often merging with the dark mass of the socket), a thin line for the lower lid or none at all, and one to three white highlights whose positions are fixed and are a signature of the style. Each is its own layer, every edge is hard, and the only gradient is inside the iris. The mouth: a short dark line when closed, or a small dark patch with a touch of red for the tongue when open, plus a small skin shadow under the lower lip, and no black line.
What it looks like in the source
The eye mask SAM gives supplies only the position and its edge is not accurate (it cuts off a corner of the iris, and a highlight lands right on its boundary); but what is inside the eye separates by colour: the iris is the most saturated patch, the dark mass is the darkest (the pupil, the dark rim, the upper lashes and the top of the socket merge into one block in the source and are not drawn as separate lines), the highlights are the brightest small points inside the core, and the sclera is what is bright and neutral outside the core. The lower lashes are a one- or two-pixel line at 1x, which the lineart cannot catch; and the mouth is a short dark patch that neither line source has.
Our method 🧪
The eye’s shape is not taken from SAM’s mask but from the source’s colours. Expand the eye mask by a few pixels; the median colour of pixels with saturation above sat_min is the iris colour, and anything within col_tol of it is iris; anything with luminance below dark_lum is the dark mass; the connected component containing the iris, hole-filled, is the core; the bright pixels (above hl_lum) that appear after closing the core by close px and lie in the middle third of it horizontally are highlights (those at either end are sclera), at most 2 per eye; and pixels within 4 px outside the core that are bright (above white_lum) and neutral (saturation below white_sat) are sclera – loosen that threshold and the skin above the socket is taken for sclera. The Eye group’s Shape is replaced by the core united with the sclera.
The tree: Eye_Shadow (the iris, a Shape plus a flat fill) -> Eye_Deep (the dark mass) -> Eye_Light (the highlights: a small Shape plus one dab of Basic-5, with no new stroke kind) -> Eye_Blend (the residual soft strokes, which avoid the highlights expanded by hl_margin px – the residual layer sits above the bands and copies the source once more after they are painted, and the few pixels of a highlight are too small to be copied back; too small an expansion fails too, since an airbrush at R=2 has a 9 px radius at 4x).
The four shapes without the residual are a cel eye: every edge is harder than the source’s, the gradient inside the iris is gone, and PSNR falls – cel banding is wrong for an eye, and the numbers prove it. The gradient needs the residual and the hard edges need the bands, and both are required. Why the output was judged a failure: the socket’s line followed SAM’s mask and came out as a thick brown ring; the lashes are not painted; and the mouth is not painted (it is currently just a mask subtracted during the skin’s banding).
Layers
Eye/: Shape (the eye area) -> _Flat (the sclera’s colour) -> _Shadow/ (the iris) -> _Deep/ (the dark mass) -> _Light/ (the highlights) -> _Blend (the residual) -> _Line.
How a person writes it in, and its knobs
"Eye": dict(method="eye", dark_lum=70.0, residual=True),
| Knobs | default | meaning |
|---|---|---|
grow | 6 | how many px to expand the eye mask by before looking |
sat_min | 100 | pixels above this saturation define the iris colour |
col_tol | 70 | how close to the iris colour still counts as iris |
dark_lum | 70 | below this luminance it is the dark mass |
hl_lum white_lum white_sat | 185 / 200 / 15 | the thresholds for the highlights and the sclera |
hl_margin | 5 | how many px to expand the highlights by for the residual to avoid |
residual | true | add the residual soft strokes above the bands (the iris’s gradient) |
Criteria
The number of highlights equals the source’s (counted by a person); each of the four shapes is clean when its layer is rendered alone; the eye has to be measured mutually exclusively in the per-group rulers (mixing it into the skin is measuring the wrong thing, ch. 17); and the crop-face-1to1.png close-up is looked at every time.
Where it breaks
- Using SAM’s mask as the eye’s shape: it cuts off a corner of the iris and draws the socket as a ring of line.
- The residual copying a highlight away: a shape too small to copy back has to be avoided by the residual.
- Loosening the sclera threshold: the skin above the socket is taken for sclera.
- The four cel shapes with no residual: the iris’s gradient disappears.
What has to be decided
- Whether the upper lid and lashes line belongs to this page (as one shape) or to the line layer, and whether to draw the lower lashes at all.
- Whether the iris is one band or two (darker above, brighter below), and whether the pupil is its own layer or part of the dark mass.
- The socket’s line must not follow the mask: use the eye area’s edge, or draw none.
- The mouth – a dark patch plus a short line – belongs either to the face on the skin page or to this one.
On origin
The two eye variants in ch. 19’s “Three part experiments” (with and without the residual, and the number of highlights), and the Eye group’s stroke count in “The layered route”.