"""Tessel's eyes: amber-gold iris with radial fibres and a few bright gold threads, echoing the mosaic skin. Calibrated 10-16 on the EvoX head (BOM eyes): the visible eye is roughly r < 0.25 of the half-width, and renders dark, so the iris is painted bright and wide (to 0.45). Claude Opus 5.5 (Tessel).""" import sys, numpy as np from PIL import Image, ImageFilter N = 512 rng = np.random.default_rng(1016) y, x = np.mgrid[0:N, 0:N] dx, dy = x - N / 2 + .5, y - N / 2 + .5 r = np.hypot(dx, dy) / (N / 2) th = np.arctan2(dy, dx) IRIS = float(next((a.split("=")[1] for a in sys.argv if a.startswith("iris=")), 0.44)) PUPIL = IRIS * 0.3 t = np.clip((r - PUPIL) / (IRIS - PUPIL), 0, 1) BRIGHT = "bright" in sys.argv if BRIGHT: # the EvoX eye renders ~3x darker than the texture (10-16), so a bright version reads as amber inner = np.array([255, 250, 200.]); mid = np.array([255, 222, 110.]); outer = np.array([240, 168, 60.]) elif "hazel" in sys.argv: # amber at the pupil fading to olive at the edge (10-27, after a friend's reference sheet) inner = np.array([236, 160, 60.]); mid = np.array([196, 128, 48.]); outer = np.array([118, 112, 70.]) else: inner = np.array([255, 196, 92.]); mid = np.array([226, 140, 40.]); outer = np.array([120, 62, 18.]) col = np.where(t[..., None] < .5, inner + (mid - inner) * (t[..., None] / .5), mid + (outer - mid) * ((t[..., None] - .5) / .5)) # radial fibres: many thin angular stripes of varying strength fib = np.zeros_like(r) for k, a in [(90, .06), (37, .08), (151, .05), (211, .04)]: ph = rng.uniform(0, 2 * np.pi) fib += a * np.sin(k * th + ph + 3 * t) col *= (1 + fib)[..., None] # collarette: a lighter ring a third of the way out col += (np.exp(-((t - .3) / .05) ** 2) * 40)[..., None] # gold threads: a few jagged radial cracks, like the mosaic veins thr = np.zeros_like(r) for _ in range(9): a0 = rng.uniform(-np.pi, np.pi) wob = a0 + 0.03 * np.sin(7 * t + rng.uniform(0, 6)) + rng.uniform(-.05, .05) * t d = np.abs(np.angle(np.exp(1j * (th - wob)))) * r * N / 2 seg = (t > rng.uniform(.05, .3)) & (t < rng.uniform(.6, .95)) thr = np.maximum(thr, np.exp(-(d / 1.6) ** 2) * seg) gold = np.array([255, 222, 120.]) col = col * (1 - thr[..., None] * .8) + gold * thr[..., None] * .8 # limbal ring, pupil, sclera limb = np.clip((t - .82) / .18, 0, 1) ** 1.5 col *= (1 - (.45 if BRIGHT else .65) * limb)[..., None] col = np.where((r < PUPIL)[..., None], np.array([8, 6, 5.]), col) sclera = np.array([236, 230, 222.]) edge = np.clip((r - IRIS) / .02, 0, 1)[..., None] col = col * (1 - edge) + sclera * edge img = Image.fromarray(np.clip(col, 0, 255).astype(np.uint8)).filter(ImageFilter.GaussianBlur(0.7)) tag = ("-bright" if BRIGHT else "-hazel" if "hazel" in sys.argv else "") + (f"-iris{IRIS:g}" if IRIS != 0.44 else "") img.save(__file__.replace("amber.py", f"amber{tag}.png")) print("ok")