Style Cookbook: Mix Your Own Art Style from Stackable Look Blocks
- ..
- .metadata162 B
- README.md5.7 KB
- block.yaml2.7 KB
README.md
Pen line (styleBlock, Line)
An even technical-pen ink line on silhouettes, folds and where one object meets another, a touch heavier on curves and thinner in the distance: the clean line of a pen-and-ink drawing, an architectural sketch or a line-and-wash painting.
Settings: width (1.5), ink (#0f0e0f), setInk (1), opacity (1), silhouette (1), crease (0.8), creaseAngle (0.3), contact (0.45), threshold (0.02), thinNear (4), thinFar (45), farWidth (0.35), fadeEnd (140), paperBreak (0.1), wobble (1), curve (0.25). Low quality draws no contact lines (contact 0) and finds edges with one ring of taps instead of two; like every block it runs at half resolution there, and with no copy of the surface's colour and normals creases come from depth alone (so only within 25 m) and curves are not weighted.
It reads depth, the copied normals and surface colour, the shared ground and wobble, and the scene's pigment set. Edges are found at the line's own width from inverse depth on two rings of opposite taps: a silhouette where depth jumps, drawn on the near thing's side only so two outlines never double up; a fold where depth kinks (every tier, faded out from 12 to 25 m, since the stack keeps depth in half floats and grazing far ground would ripple), or where the copied normals bend more than creaseAngle and depth kinks a little too (high and medium, at any distance), so a normal map (grass, brick, tiles) never draws folds; a contact where two surfaces at nearly the same depth each hold one steady colour and the two colours differ, so a texture's own pattern (grass tufts, gravel, brick) is left alone, faded out from 8 to 22 m so far ground never fills with specks. The weight is full up to thinNear, eases to farWidth of it by thinFar, is heavier on curved surfaces by curve, and the line fades out over the last third of the way to fadeEnd. paperBreak lets the valleys of the shared paper's tooth (from a Ground block such as inkPaper) break the line. The ink is ink, or the picked ink set's first paint mixed in by setInk (StyleKit.setPigments("inkSepia")); a set whose first paint is neither very dark nor very light (most watercolor sets) is ignored, so the line keeps its own ink over a watercolor palette. A white ink (the inkWhiteOnDark set) draws white lines. It is a Line block with layer stacking, so it swaps in one change with the other ink lines and with styleKit's depthLine and sketchLine: StyleKit.swap("line", "inkPenLine").
What it gives up in motion
Lines are found again every frame from depth, so they stay on their edges under pan, dolly, orbit and zoom and follow moving and animated things exactly. Nothing in the line itself is laid on surfaces except the paper break, which follows the shared tooth and so slides along a moving character. Parts thinner than a pixel (far railings, wires, thin branches) can shimmer as they move; that is why lines thin with distance and are gone by fadeEnd. The line has no boil of its own: with a Time block (inkBoil) it trembles with the rest of the stack on the held clock, never per frame.
How it treats content
- Opaque things: outlined at silhouettes, folds and colour contacts at one even weight, a little heavier on curves.
- Transparent things (glass, water): they write no depth, so a pane or a water surface gets no line of its own, and the edges of what is behind it are drawn through it, over the glass's colour. A window shows the lines of the room behind; a pond shows the lines of its bed.
- Particles and smoke: no depth, so smoke, sparks and glows get no outline, and the lines of things behind soft smoke are drawn on top of it: thick smoke does not hide edges. Make effects that must read big and bright rather than fine.
- Sky: never inked. A silhouette against the sky is drawn on the near thing's side.
- Fog: lines come from depth, not colour, so fog does not thin them; distance does (
thinNear,thinFar,farWidth,fadeEnd). In thick fog setfadeEndnear the fog's far distance so dark lines do not float in pale fog. - Skinned characters: outlines follow every pose exactly, since they are found each frame. Toon materials that draw their own outline (toonMaterials' ToonInk) get a second line beside theirs: keep this block off them with a group mask (
StyleKit.options({ groups = { { id } } }),StyleKit.setMask("line", { kind = "group", group = 1, invert = true })) so one thing owns each outline. - Foliage: alpha-tested leaves write depth, so every leaf edge can draw and a near tree reads busy; far branches can shimmer. Raise
threshold, lowercrease, lowerfadeEnd, or keep the line off far things with a depth mask. - World text: text with depth is outlined like any shape, and small letters can fill in. Leave labels a player must read out of the stack by name:
StyleKit.options({ exclude = { "labelName" } }). - Black stays black: it returns through
sk_finish, so the line only darkens what is there and an unlit pixel stays black; with white ink, lines on parts of the scene that get no light at all are held black too.
Known limits
- It runs on the whole frame after antialiasing, so offscreen captures, mirrors and render-to-texture cameras do not show it (#17427).
- Per-object settings (a style channel or a game role) reach it through the shared object mask, at most eight distinct settings a scene. A per-object value cannot reach a geometry pass, so a per-object look that needs one draws passes of its own (#24549).
- Its passes are queued again every frame, even when nothing changed (#24548).
The package README's Known limits lists the rest.