Painting · real-time shaders

Water­colour washes

How a fragment shader turns flat fills into pigment on paper

Pigment density · Bousseau et al. 2006

Pigment density d: one number per pixel that thins or deepens the fill

Every later slide sets d per pixel except slide 4: the fills' shapes come from the flat painting, and slide 4 wobbles their edges.

mix toward blackdensity d as painted mix colony core:red green blue before (→ bright) after (↑ bright) c *= 1. - (1. - c) * (d - 1.);

Edge darkening · Curtis et al. 1997

Edge darkening: a gradient edge detector adds pigment at every boundary

In paint, pigment drifts to a wash's rim as it dries; here the colour gradient stands in for that.

resultedge detector
output,
as density d1 grey2 black
// colour gradient by central differences vec3 g3 = abs(cL - cR) + abs(cD - cU); d = 1. + k * (g3.r + g3.g + g3.b) / 3.;

Wobbling edges

The paper's slope pushes each edge

The slope map is the paper enlarged 2.5×, finest bumps dropped, so edges wobble slowly instead of fraying.

paper heightedge as filledafter lookupresult vec2 s = texture(slope, uv).rg * 2. - 1.; c = texture(image, uv + k * s / res).rgb;

Density layers

A wash is never one flat value

T is a layer's grey, 0 to 1: turbulence is broad, dispersion fine, and grain sits in the paper's hollows.

resultΣ (d − 1)−1 white0 grey1 black float T = texture(layer, uv).r; d = 1. + beta * (T - .5);

The whole pipeline

Stacked, the flat fills read as washes

Switch effects off one at a time to see what each one carries; all off is the flat dish.

Recap

From flat fill to wash