Painting · real-time shaders

Paper grain

How pastel and chalk looks are made in a shader

Height-map threshold · paper tooth, Sousa and Buchanan 1999

Pastel lands on the paper's peaks first, then fills the valleys

Press harder: the line sinks and the specks join into solid colour.

the stick reaches down to here the marked row, from the side cover = step(1. - tone, h);

Edge width w

A narrow edge draws hard chalk, a wide one a soft smudge

Widen w: each grain's edge goes from a crisp speck to a soft blur of colour.

reach ± w: pigment fades the marked row, from the side reach = mix(1. + w, -w, tone); cover = smoothstep(reach - w, reach + w, h);

The height map

Paper is grains several pixels wide, not one-pixel static

Try static: every pixel is its own grain, so the colony looks like a noisy print instead of a drawing.

paper height pastel on it

A second colour

On other grains, a second colour stays pure and mixes from afar

Other grains keep blue and gold both pure; drag the lens to blur them as distance does. Same grains bury the blue under the gold.

from afar

Screen, world or object space · Cunzi et al. 2003

Grain can stay with the screen, pan with the dish, or ride each cell

The background and the cells are pinned separately; any pair runs.

vec2 qs = c; // screen vec2 qd = c + pan; // dish vec2 qc = (s - o) / k; // cell: o centre, k size
background cells

Recap

What the pastel colony showed