A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date. Images, audio, models and binaries go through Git LFS (.gitattributes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
3.8 KiB
Python
91 lines
3.8 KiB
Python
"""The phone's wallpaper: Herbaria-7 from orbit, the sector grid of the company's charts lit across its dark side.
|
|
Drawn from nothing, so it is nobody else's. python ArtSource/phone_wallpaper.py"""
|
|
import numpy as np
|
|
from PIL import Image
|
|
|
|
W, H = 720, 1578
|
|
S = 2 # drawn at twice the size, then taken down
|
|
w, h = W * S, H * S
|
|
y, x = np.mgrid[0:h, 0:w].astype(np.float64)
|
|
x, y = (x + 0.5) / S, (y + 0.5) / S
|
|
rng = np.random.default_rng(7)
|
|
|
|
img = np.zeros((h, w, 3))
|
|
# deep space, a touch greener toward the planet
|
|
img += np.array([0.0012, 0.0036, 0.003])
|
|
img += np.array([0.0, 0.006, 0.005]) * (np.clip(y / H, 0, 1) ** 2)[..., None]
|
|
|
|
# stars
|
|
for n, size, power in ((900, 0.7, 0.22), (130, 1.2, 0.5), (16, 2.0, 0.9)):
|
|
sx, sy = rng.uniform(0, W, n), rng.uniform(0, H * 0.72, n)
|
|
tint = rng.uniform(0.7, 1.0, (n, 1)) * np.array([[0.85, 1.0, 0.95]])
|
|
for i in range(n):
|
|
x0, y0 = int(sx[i] * S), int(sy[i] * S)
|
|
r = int(size * S * 3)
|
|
ya, yb, xa, xb = max(y0 - r, 0), min(y0 + r + 1, h), max(x0 - r, 0), min(x0 + r + 1, w)
|
|
d = (x[ya:yb, xa:xb] - sx[i]) ** 2 + (y[ya:yb, xa:xb] - sy[i]) ** 2
|
|
img[ya:yb, xa:xb] += (np.exp(-d / (size * size)) * power)[..., None] * tint[i]
|
|
|
|
# the planet, seen from a long way off
|
|
cx, cy, R = 560.0, 1690.0, 1120.0
|
|
nx, ny = (x - cx) / R, (y - cy) / R
|
|
r2 = nx * nx + ny * ny
|
|
on = r2 < 1.0
|
|
nz = np.sqrt(np.clip(1.0 - r2, 0.0, 1.0))
|
|
sun = np.array([0.62, -0.62, 0.48])
|
|
sun = sun / np.linalg.norm(sun)
|
|
lit = np.clip(nx * sun[0] + ny * sun[1] + nz * sun[2], 0, 1)
|
|
|
|
# sectors: a hex grid in longitude and latitude, tilted so its lines run across the curve of the ball
|
|
tilt = np.radians(24)
|
|
ax = nx * np.cos(tilt) - ny * np.sin(tilt)
|
|
bx = nx * np.sin(tilt) + ny * np.cos(tilt)
|
|
lon, lat = np.arctan2(ax, nz) * 15.0, np.arcsin(np.clip(bx, -1, 1)) * 15.0
|
|
q = lon * 2 / 3
|
|
s = -lon / 3 - lat * np.sqrt(3) / 3
|
|
t = -q - s
|
|
rq, rs, rt = np.round(q), np.round(s), np.round(t)
|
|
dq, ds, dt = np.abs(rq - q), np.abs(rs - s), np.abs(rt - t)
|
|
fix_q, fix_s = (dq > ds) & (dq > dt), (ds >= dq) & (ds > dt)
|
|
rq = np.where(fix_q, -rs - rt, rq)
|
|
rs = np.where(fix_s, -rq - rt, rs)
|
|
ox, oy = lon - rq * 1.5, lat + (rq * 0.5 + rs) * np.sqrt(3)
|
|
ox, oy = np.abs(ox), np.abs(oy)
|
|
edge = np.maximum(ox * 0.866 + oy * 0.5, oy)
|
|
line = np.exp(-(((0.866 - edge) / 0.016) ** 2))
|
|
|
|
# mown sectors, a scatter of them
|
|
cell = (rq * 12.9898 + rs * 78.233)
|
|
mown = (np.sin(cell) * 43758.5453) % 1.0 > 0.8
|
|
|
|
meadow = np.array([0.012, 0.05, 0.03])
|
|
planet = meadow * (0.06 + lit ** 1.4 * 1.0)[..., None]
|
|
planet += np.array([0.05, 0.04, 0.012]) * (mown * (0.03 + lit * 0.6))[..., None]
|
|
planet += np.array([0.1, 0.42, 0.28]) * (line * (0.05 + lit * 0.42))[..., None]
|
|
limb = np.clip(1.0 - nz, 0, 1) ** 3
|
|
planet += np.array([0.3, 1.0, 0.72]) * (limb * (0.06 + lit * 0.5))[..., None]
|
|
img = np.where(on[..., None], planet, img)
|
|
|
|
# atmosphere past the edge
|
|
out = np.sqrt(r2) - 1.0
|
|
air = np.exp(-np.clip(out, 0, None) / 0.012) * (~on) * (0.25 + np.clip(nx * sun[0] + ny * sun[1], 0, 1) * 1.5)
|
|
img += np.array([0.25, 0.95, 0.7]) * air[..., None] * 0.8
|
|
|
|
# the ring, a thin ellipse round the ball, behind it on the far side
|
|
a, b, spin = 1.62 * R, 0.2 * R, np.radians(-20)
|
|
ex = (x - cx) * np.cos(spin) - (y - cy) * np.sin(spin)
|
|
ey = (x - cx) * np.sin(spin) + (y - cy) * np.cos(spin)
|
|
d = np.sqrt((ex / a) ** 2 + (ey / b) ** 2)
|
|
band = np.exp(-(((d - 1.0) / 0.012) ** 2)) * 0.5 + np.exp(-(((d - 0.965) / 0.006) ** 2)) * 0.28
|
|
band = band * ~(on & (ey < 0))
|
|
img += np.array([0.5, 0.8, 0.6]) * band[..., None] * 0.2
|
|
|
|
# keep the middle quiet: the tiles sit there, and a page of them over a busy picture is hard on the eye
|
|
quiet = 1.0 - 0.45 * np.exp(-(((y - H * 0.62) / (H * 0.2)) ** 2))
|
|
img = img * quiet[..., None]
|
|
|
|
img = np.clip(img, 0, 1) ** (1 / 2.2)
|
|
pic = Image.fromarray((img * 255 + 0.5).astype(np.uint8)).resize((W, H), Image.LANCZOS)
|
|
pic.save("Assets/Art/UI/phone_wallpaper.png")
|
|
print("saved", pic.size)
|