ExperimentsFable 5.2 Python art (30 images)
Image 3 of 30
Misty mountain lake at dawn
The Python script
Open script.py ↗ (opens in a new tab)#!/usr/bin/env python3
"""03 Misty mountain lake at dawn.
Layered ridgelines that fade into fog, a mirror reflection with soft
ripples, and a small wooden dock drawn in perspective.
Fable 5.2 Python art experiment: every pixel comes from the code below.
Run: .venv/bin/python scripts/03-misty-mountain-lake.py
"""
import os, sys, time, math
import numpy as np
from PIL import Image, ImageDraw
from scipy import ndimage as ndi
# ----------------------------------------------------------------------------
# Shared helper code (copied into every script so that each script runs alone)
# ----------------------------------------------------------------------------
W, H = 1600, 2000
T0 = time.time()
HERE = os.path.dirname(os.path.abspath(__file__))
F32 = np.float32
def hexc(s):
s = s.lstrip('#')
return np.array([int(s[i:i + 2], 16) for i in (0, 2, 4)], F32) / 255.0
def c8(c):
return tuple(int(max(0, min(255, round(float(v) * 255)))) for v in c)
def smooth(a, b, x):
t = np.clip((x - a) / (b - a + 1e-12), 0, 1)
return t * t * (3 - 2 * t)
def mix(a, b, t):
return a + (b - a) * t
def ramp(t, stops):
"""Colour gradient. stops = [(position, '#hex'), ...]; t is an array."""
pos = [p for p, _ in stops]
cols = np.array([hexc(c) if isinstance(c, str) else c for _, c in stops])
return np.stack([np.interp(t, pos, cols[:, i]) for i in range(3)], -1).astype(F32)
def vnoise(shape, cell, rng):
"""Smooth value noise in 0..1: a random grid, enlarged with cubic interpolation."""
h, w = shape
cy, cx = (cell, cell) if np.isscalar(cell) else cell
cy, cx = max(1.0, float(cy)), max(1.0, float(cx))
gh, gw = int(h / cy) + 4, int(w / cx) + 4
g = rng.random((gh, gw)).astype(F32)
z = ndi.zoom(g, (cy, cx), order=3 if min(cy, cx) >= 3 else 1)
oy, ox = int(cy * 1.5), int(cx * 1.5)
z = z[oy:oy + h, ox:ox + w]
if z.shape != (h, w):
z = np.pad(z, ((0, h - z.shape[0]), (0, w - z.shape[1])), mode='edge')
return z
def fbm(shape, cell, octaves, rng, gain=0.5, lac=2.0):
"""Fractal noise in about 0..1 (sum of value noise octaves)."""
cy, cx = (cell, cell) if np.isscalar(cell) else cell
out = np.zeros(shape, F32)
amp, tot = 1.0, 0.0
for _ in range(octaves):
out += amp * vnoise(shape, (cy, cx), rng)
tot += amp
amp *= gain
cy /= lac
cx /= lac
return out / tot
def blur(a, s):
"""Gaussian blur for 2D or 3D (h, w, c) arrays; large radii use a small copy."""
if s <= 0:
return a
if s > 10:
k = int(s // 5)
h, w = a.shape[:2]
ph, pw = (-h) % k, (-w) % k
pad = ((0, ph), (0, pw)) + (((0, 0),) if a.ndim == 3 else ())
b = np.pad(a, pad, mode='edge')
hh, ww = b.shape[0] // k, b.shape[1] // k
if a.ndim == 3:
b = b.reshape(hh, k, ww, k, -1).mean((1, 3))
b = ndi.gaussian_filter(b, (s / k, s / k, 0), mode='nearest')
b = ndi.zoom(b, (k, k, 1), order=1)
else:
b = b.reshape(hh, k, ww, k).mean((1, 3))
b = ndi.gaussian_filter(b, s / k, mode='nearest')
b = ndi.zoom(b, (k, k), order=1)
return b[:h, :w].astype(F32)
sig = (s, s, 0) if a.ndim == 3 else s
return ndi.gaussian_filter(a, sig, mode='nearest').astype(F32)
def bloom(a, thresh=0.7, sigmas=(6, 20, 60), gains=(0.35, 0.3, 0.25)):
"""Soft glow around bright areas."""
lum = a.max(-1)
hi = a * smooth(thresh, thresh + 0.25, lum)[..., None]
out = a.copy()
for s, g in zip(sigmas, gains):
out += g * blur(hi, s)
return out
def glow(cx, cy, r, power=2.0):
"""Radial falloff field, 1 at the centre."""
yy, xx = np.mgrid[0:H, 0:W].astype(F32)
d2 = ((xx - cx) ** 2 + (yy - cy) ** 2) / (r * r)
return 1.0 / (1.0 + d2) ** power
def comp(base, rgb, a):
"""Alpha composite. rgb may be one colour or an image; a is an (h, w) mask."""
return base * (1 - a[..., None]) + np.asarray(rgb, F32) * a[..., None]
class Layer:
"""Vector drawing layer (PIL) drawn at 2x size, then averaged down for smooth edges."""
def __init__(self, ss=2):
self.ss = ss
self.im = Image.new('RGBA', (W * ss, H * ss), (0, 0, 0, 0))
self.d = ImageDraw.Draw(self.im)
def _p(self, pts):
s = self.ss
return [(float(x) * s, float(y) * s) for x, y in pts]
def poly(self, pts, col, a=1.0):
self.d.polygon(self._p(pts), fill=c8(col) + (int(a * 255),))
def line(self, pts, col, width=1.0, a=1.0):
wd = max(1, int(round(width * self.ss)))
self.d.line(self._p(pts), fill=c8(col) + (int(a * 255),), width=wd, joint='curve')
def dot(self, x, y, rx, col, a=1.0, ry=None):
s = self.ss
ry = rx if ry is None else ry
self.d.ellipse([(x - rx) * s, (y - ry) * s, (x + rx) * s, (y + ry) * s],
fill=c8(col) + (int(a * 255),))
def arrays(self):
im = self.im.convert('RGBa').reduce(self.ss) # premultiplied alpha
a = np.asarray(im).astype(F32) / 255.0
return a[..., :3], a[..., 3]
def onto(self, base, opacity=1.0, soften=0.0):
rgb, a = self.arrays()
if soften > 0:
rgb, a = blur(rgb, soften), blur(a, soften)
return base * (1 - a[..., None] * opacity) + rgb * opacity
def painterly(ref, rng, sizes=(44, 22, 11, 6), thresh=(0, 0.06, 0.05, 0.04), ss=2,
jitter=0.035, length=5, base_angle=None, edge_follow=1.0, relief=0.3,
density=1.0, tol=0.22, underblur=30, keep=None):
"""Repaint an image with oriented brush strokes, coarse to fine.
Strokes follow the edges of the picture (structure tensor) and a flow field
elsewhere. Finer strokes are added only where the canvas still differs from
the reference. A separate height map of the strokes gives the paint relief.
keep: optional (h, w) probability mask that limits where fine strokes go.
"""
h, w = ref.shape[:2]
lum = ref @ np.array([0.3, 0.59, 0.11], F32)
l2 = ndi.gaussian_filter(lum, 2.0)
gx, gy = ndi.sobel(l2, axis=1), ndi.sobel(l2, axis=0)
jxx, jyy, jxy = blur(gx * gx, 6), blur(gy * gy, 6), blur(gx * gy, 6)
theta = 0.5 * np.arctan2(2 * jxy, jxx - jyy) + np.pi / 2
coh = np.sqrt((jxx - jyy) ** 2 + 4 * jxy ** 2)
cw = smooth(0.0004, 0.01, coh) * edge_follow
if base_angle is None:
base_angle = fbm((h, w), 320, 3, rng) * np.pi * 3
base_angle = np.broadcast_to(np.asarray(base_angle, F32), (h, w))
c2 = cw * np.cos(2 * theta) + (1 - cw) * np.cos(2 * base_angle)
s2 = cw * np.sin(2 * theta) + (1 - cw) * np.sin(2 * base_angle)
ang = 0.5 * np.arctan2(s2, c2)
dxf, dyf = np.cos(ang).astype(F32), np.sin(ang).astype(F32)
start = np.clip(blur(ref, underblur), 0, 1)
canvas = Image.fromarray((start * 255).astype(np.uint8)).resize((w * ss, h * ss), Image.BILINEAR)
hmap = Image.new('L', (w * ss, h * ss), 128)
dr, hd = ImageDraw.Draw(canvas), ImageDraw.Draw(hmap)
for li, s in enumerate(sizes):
sp = max(2.0, s * 0.45 / density)
ny, nx = int(h / sp) + 1, int(w / sp) + 1
gy_, gx_ = np.mgrid[0:ny, 0:nx].astype(F32)
px = (gx_ + rng.random((ny, nx))).ravel() * sp
py = (gy_ + rng.random((ny, nx))).ravel() * sp
ok = (px < w - 1) & (py < h - 1)
px, py = px[ok], py[ok]
xi, yi = px.astype(int), py.astype(int)
sel = np.ones(len(px), bool)
if thresh[li] > 0:
cur = np.asarray(canvas.reduce(ss)).astype(F32) / 255.0
diff = blur(np.abs(cur - ref).sum(-1), s * 0.5)
sel &= diff[yi, xi] > thresh[li]
if keep is not None and li >= 1:
sel &= rng.random(len(px)) < keep[yi, xi]
px, py, xi, yi = px[sel], py[sel], xi[sel], yi[sel]
n = len(px)
if n == 0:
continue
col0 = ref[yi, xi]
K = int(length)
step = s * 0.6
pts = np.zeros((n, 2 * K + 1, 2), F32)
pts[:, K, 0], pts[:, K, 1] = px, py
for sgn in (1, -1):
x, y = px.copy(), py.copy()
ddx, ddy = dxf[yi, xi] * sgn, dyf[yi, xi] * sgn
alive = np.ones(n, bool)
for k in range(1, K + 1):
ix = np.clip(x.astype(int), 0, w - 1)
iy = np.clip(y.astype(int), 0, h - 1)
ndx, ndy = dxf[iy, ix], dyf[iy, ix]
flip = np.where(ndx * ddx + ndy * ddy < 0, -1.0, 1.0)
ddx, ddy = ndx * flip, ndy * flip
nx_, ny_ = x + ddx * step, y + ddy * step
jx = np.clip(nx_.astype(int), 0, w - 1)
jy = np.clip(ny_.astype(int), 0, h - 1)
alive &= np.abs(ref[jy, jx] - col0).sum(-1) < tol
x = np.where(alive, nx_, x)
y = np.where(alive, ny_, y)
pts[:, K + sgn * k, 0], pts[:, K + sgn * k, 1] = x, y
colj = col0 * (1 + jitter * rng.standard_normal((n, 1))) + 0.4 * jitter * rng.standard_normal((n, 3))
cols = (np.clip(colj, 0, 1) * 255).astype(np.uint8)
order = rng.permutation(n)
P = (pts[order] * ss).reshape(n, -1).tolist()
Cc = cols[order].tolist()
G = rng.integers(40, 216, n).tolist()
Bo = (rng.standard_normal((n, 3)) * s * ss * 0.28).tolist()
Bl = (1 + 0.07 * rng.standard_normal((n, 3))).tolist()
wd = max(1, int(s * ss))
r = wd / 2.0
for i in range(n):
p = P[i]
c = tuple(Cc[i])
dr.line(p, fill=c, width=wd, joint='curve')
hd.line(p, fill=G[i], width=wd, joint='curve')
for ex, ey in ((p[0], p[1]), (p[-2], p[-1])):
box = [ex - r, ey - r, ex + r, ey + r]
dr.ellipse(box, fill=c)
hd.ellipse(box, fill=G[i])
if s >= 9: # bristle streaks inside the larger strokes
vx, vy = p[-2] - p[0], p[-1] - p[1]
vl = math.hypot(vx, vy) + 1e-6
ox_, oy_ = -vy / vl, vx / vl
for b in range(3):
o = Bo[i][b]
q = [v + (o * ox_ if j % 2 == 0 else o * oy_) for j, v in enumerate(p)]
cb = tuple(int(max(0, min(255, v * Bl[i][b]))) for v in c)
dr.line(q, fill=cb, width=max(1, wd // 5), joint='curve')
hd.line(q, fill=int(max(0, min(255, G[i] + 40 * (Bl[i][b] - 1) * 14))), width=max(1, wd // 5))
out = np.asarray(canvas.reduce(ss)).astype(F32) / 255.0
if relief > 0:
hm = ndi.gaussian_filter(np.asarray(hmap.reduce(ss)).astype(F32), 0.8)
sh = np.clip((-ndi.sobel(hm, axis=1) * 0.5 - ndi.sobel(hm, axis=0) * 0.85) / 255.0, -1, 1)
out = out * (1 + relief * sh[..., None])
return out
def finish(a, name, rng, vignette=0.22, grain=0.012, weave=0.018):
"""Vignette, canvas weave, grain, then save to ../images/<name>.png."""
yy, xx = np.mgrid[0:H, 0:W].astype(F32)
r = np.sqrt(((xx / W - 0.5) * 1.15) ** 2 + (yy / H - 0.5) ** 2)
a = a * (1 - vignette * smooth(0.3, 0.8, r))[..., None]
if weave > 0:
wv = (np.sin(xx * 2.1) * np.sin(yy * 2.1)) * 0.5 + (vnoise((H, W), 2.5, rng) - 0.5)
a = a * (1 + weave * wv)[..., None]
if grain > 0:
a = a + grain * rng.standard_normal((H, W, 1)).astype(F32)
out = os.path.join(HERE, '..', 'images', name + '.png')
os.makedirs(os.path.dirname(out), exist_ok=True)
Image.fromarray((np.clip(a, 0, 1) * 255 + 0.5).astype(np.uint8)).save(out)
print(f'saved {os.path.normpath(out)} ({time.time() - T0:.1f} s)')
# ----------------------------------------------------------------------------
# The picture
# ----------------------------------------------------------------------------
SEED = 303
rng = np.random.default_rng(SEED)
yy, xx = np.mgrid[0:H, 0:W].astype(F32)
WL = 1180.0 # water line (also the horizon)
SUNX, SUNY = 1085.0, 968.0
MIST = hexc('#f1d9cf')
# ---- sky ---------------------------------------------------------------
ts = np.clip(yy / WL, 0, 1)
sky = ramp(ts, [(0, '#51648f'), (0.3, '#8d8fb4'), (0.55, '#d6a9ac'), (0.78, '#f7c7a2'), (1, '#ffe0b4')])
cl = fbm((H, W), (40, 460), 5, rng) * 0.65 + fbm((H, W), (120, 900), 3, rng) * 0.45
cm = smooth(0.5, 0.72, cl) * smooth(0.0, 0.25, ts) * smooth(0.95, 0.6, ts)
ccol = ramp(ts, [(0, '#c8a7bd'), (0.5, '#f6b9a6'), (1, '#ffd9a6')])
sky = comp(sky, ccol, cm * 0.75)
sunglow = glow(SUNX, SUNY, 170, 1.5)
sky += sunglow[..., None] * np.array([0.5, 0.33, 0.14], F32)
sky += glow(SUNX, SUNY, 30, 3.0)[..., None] * np.array([1.0, 0.9, 0.7], F32) * 1.2
img = sky
# ---- ridges, far to near ------------------------------------------------------
def profile(cell, ridged=0.6, octaves=5):
out, amp, tot = np.zeros(W, F32), 1.0, 0.0
for o in range(octaves):
n = vnoise((1, W), (1, cell / 2 ** o), rng)[0]
n = mix(n, 1 - np.abs(2 * n - 1), ridged)
out += amp * n
tot += amp
amp *= 0.48
out /= tot
return (out - out.min()) / (out.max() - out.min())
xs = xx[0]
LAYERS = [ # base row, height, noise cell, colour, pine size
(1035, 400, 620, '#bda3c0', 0),
(1085, 300, 430, '#9787b0', 0),
(1120, 235, 330, '#6f769e', 0),
(1150, 190, 260, '#495d80', 14),
(1168, 150, 200, '#2b4060', 30),
(1182, 150, 170, '#15263b', 62),
]
for li, (base, hgt, cell, colr, pine) in enumerate(LAYERS):
pr = profile(cell)
if li == 0:
pr = pr * (0.45 + 0.55 * np.exp(-((xs - 520) / 420) ** 2)) # one main peak on the left
if li == 1:
pr = pr * (0.5 + 0.5 * smooth(700, 1500, xs))
if li >= 3: # keep the middle open
open_ = 0.12 + 0.88 * np.clip(np.abs(xs - 900) / 760, 0, 1) ** (1.3 if li < 5 else 1.0)
pr = pr * open_
top = base - hgt * pr
if pine:
px = 0.0
tr = np.zeros(W, F32)
while px < W:
hgt_p = pine * rng.uniform(0.45, 1.25)
wd = hgt_p * rng.uniform(0.22, 0.32)
seg = np.clip(1 - np.abs(xs - px) / wd, 0, 1) * hgt_p
tr = np.maximum(tr, seg)
px += wd * rng.uniform(0.5, 1.5)
top = top - tr * (0.35 + 0.65 * smooth(0.02, 0.2, pr))
m = smooth(-1.2, 1.2, yy - top[None, :])
col = hexc(colr)
depth_below = (yy - top[None, :])
body = np.broadcast_to(col, (H, W, 3)).copy()
tex = fbm((H, W), (60, 90), 4, rng) - 0.5
body *= (1 + 0.16 * tex)[..., None]
if li <= 1: # snow fields catch the first light
snow = smooth(0.56, 0.7, fbm((H, W), (110, 22), 4, rng) + 0.25 * smooth(260, 40, depth_below) - 0.12)
snow *= smooth(240, 60, depth_below)
body = comp(body, hexc('#f6d3c6'), snow * (0.5 if li == 0 else 0.22))
fog = np.exp(-np.clip(WL - yy, 0, None) / (70.0 + 18 * li)) * (0.74 - 0.09 * li)
fog = np.clip(fog + 0.14 * smooth(0, 300, depth_below) * (li < 4), 0, 1)
body = mix(body, MIST, fog[..., None])
body += sunglow[..., None] * np.array([0.3, 0.17, 0.07], F32) * (1 - 0.17 * li)
img = comp(img, body, m * (yy < WL + 3))
# mist that lies on the water line
mb = fbm((H, W), (26, 420), 4, rng)
mist = np.exp(-((yy - (WL - 14)) / 36.0) ** 2) * (0.2 + 0.8 * mb)
mist += np.exp(-((yy - (WL - 70)) / 60.0) ** 2) * smooth(0.5, 0.8, mb) * 0.35
img = comp(img, MIST * 1.02, np.clip(mist, 0, 0.9))
# ---- water: a mirror with ripples ----------------------------------------
depth = np.clip((yy - WL) / (H - WL), 0, 1)
rn = fbm((H, W), (5, 70), 3, rng) - 0.5
rn2 = fbm((H, W), (14, 220), 3, rng) - 0.5
src_y = 2 * WL - yy + (rn2 * 16 + rn * 9) * depth ** 0.8
src_x = xx + (rn * 20 + rn2 * 10) * depth
coords = np.stack([np.clip(src_y, 0, WL), np.clip(src_x, 0, W - 1)])
refl = np.stack([ndi.map_coordinates(img[..., c], coords, order=1) for c in range(3)], -1)
refl = blur(refl, 1.4)
refl = refl * 0.84 + hexc('#3b5873') * 0.07
deep = hexc('#16293c')
fres = (depth ** 1.6) * 0.62
water = mix(refl, deep, fres[..., None])
lanes = smooth(0.58, 0.8, fbm((H, W), (7, 380), 4, rng)) * (0.25 + 0.75 * depth) * 0.2
water += lanes[..., None] * hexc('#f6d6c4')
# glitter path under the sun
gl = (vnoise((H, W), (2.2, 15), rng) > 0.74) * np.exp(-((xx - SUNX) / (40 + 130 * depth)) ** 2) * smooth(0.02, 0.2, depth)
water += blur(gl.astype(F32), 0.8)[..., None] * np.array([1.0, 0.82, 0.55], F32) * 0.55
wm = (yy >= WL).astype(F32)
img = comp(img, water, wm)
# a little more mist drifting over the near water
m2 = np.exp(-((yy - (WL + 22)) / 28.0) ** 2) * (0.1 + 0.65 * mb)
img = comp(img, MIST, np.clip(m2, 0, 0.8))
# ---- the dock -------------------------------------------------------------
FOC, CX, CAMH, DECK = 1700.0, 800.0, 2.6, 0.55
def P(X, Y, Z):
return (CX + FOC * X / Z, WL + FOC * (CAMH - Y) / Z)
axis = lambda z: -1.95 + 0.145 * z
HALF = 0.6
Z0, Z1 = 3.6, 16.0
dock, dref = Layer(), Layer()
# reflection first: dark mirrored shapes under the deck and posts
dref.poly([P(axis(Z0) - HALF, -DECK, Z0), P(axis(Z0) + HALF, -DECK, Z0),
P(axis(Z1) + HALF, -DECK, Z1), P(axis(Z1) - HALF, -DECK, Z1)], hexc('#0f1c29'), 0.9)
POSTS = [4.6, 7.4, 11.0, 15.9]
for z in POSTS:
for sd in (-1, 1):
x = axis(z) + sd * (HALF + 0.07)
dref.poly([P(x - 0.065, 0, z), P(x + 0.065, 0, z), P(x + 0.065, -DECK - 0.62, z), P(x - 0.065, -DECK - 0.62, z)],
hexc('#0f1c29'), 0.9)
ra, rm = dref.arrays()
dxy = np.stack([yy + 0, xx + (rn * 26 + rn2 * 14) * (0.3 + depth)])
rm = ndi.map_coordinates(blur(rm, 2.0), dxy, order=1)
img = comp(img, hexc('#101d2b'), rm * 0.82)
# shadowed underside, then the planks
dock.poly([P(axis(Z0) - HALF, DECK, Z0), P(axis(Z0) + HALF, DECK, Z0),
P(axis(Z1) + HALF, DECK, Z1), P(axis(Z1) - HALF, DECK, Z1)], hexc('#17110f'))
dock.poly([P(axis(Z0) - HALF, DECK, Z0), P(axis(Z0) - HALF, DECK - 0.2, Z0),
P(axis(Z1) - HALF, DECK - 0.2, Z1), P(axis(Z1) - HALF, DECK, Z1)], hexc('#241b17'))
dock.poly([P(axis(Z0) + HALF, DECK, Z0), P(axis(Z0) + HALF, DECK - 0.2, Z0),
P(axis(Z1) + HALF, DECK - 0.2, Z1), P(axis(Z1) + HALF, DECK, Z1)], hexc('#3a2c24'))
z = Z0
while z < Z1 - 0.05:
dz = 0.17 * rng.uniform(0.92, 1.08)
z2 = min(z + dz * 0.9, Z1)
far_t = smooth(Z0, Z1, z)
wood = mix(hexc('#54473f'), hexc('#8a7868'), rng.random())
wood = wood * (0.72 + 0.2 * rng.random()) + np.array([0.9, 0.62, 0.38], F32) * (0.06 + 0.42 * far_t ** 1.5)
ov = rng.uniform(0.0, 0.05, 2)
dock.poly([P(axis(z) - HALF - ov[0], DECK, z), P(axis(z) + HALF + ov[1], DECK, z),
P(axis(z2) + HALF + ov[1], DECK, z2), P(axis(z2) - HALF - ov[0], DECK, z2)], wood)
# wood grain: a few thin lines along each plank
for _ in range(3 if z < 6 else 1):
f = rng.uniform(0.15, 0.85)
zz = mix(z, z2, f)
a_, b_ = sorted(rng.uniform(-HALF, HALF, 2))
dock.line([P(axis(zz) + a_, DECK, zz), P(axis(zz) + b_, DECK, zz)], wood * rng.uniform(0.75, 1.2),
max(0.6, 2.2 / z * 2.2), 0.6)
z += dz
for z in POSTS[::-1]:
for sd in (-1, 1):
x = axis(z) + sd * (HALF + 0.07)
topy = DECK + 0.62
dock.poly([P(x - 0.065, 0, z), P(x + 0.065, 0, z), P(x + 0.065, topy, z), P(x - 0.065, topy, z)], hexc('#2a201b'))
dock.poly([P(x + 0.035, 0, z), P(x + 0.065, 0, z), P(x + 0.065, topy, z), P(x + 0.035, topy, z)], hexc('#a06f4c'))
cxp, cyp = P(x, topy, z)
dock.dot(cxp, cyp, 0.065 * FOC / z, hexc('#8d6f58'), ry=0.022 * FOC / z)
img = dock.onto(img)
# ---- brush pass, then light ------------------------------------------------
flow = 0.35 * (fbm((H, W), 300, 2, rng) - 0.5)
paint = painterly(np.clip(img, 0, 1), rng, sizes=(34, 17, 9, 5, 3), thresh=(0, 0.05, 0.045, 0.04, 0.045),
base_angle=flow, relief=0.13, jitter=0.03, length=6)
img = mix(paint, img, 0.12)
img += glow(SUNX, SUNY, 420, 1.3)[..., None] * np.array([0.5, 0.3, 0.12], F32) * 0.1
img = bloom(img, 0.86, (6, 30), (0.15, 0.15))
img = np.clip(img, 0, 1)
finish(img, '03-misty-mountain-lake', rng, vignette=0.24)

