diff --git a/JotunnModStub/Assets/AlfarNexus/AlfarNexus_face.png b/JotunnModStub/Assets/AlfarNexus/AlfarNexus_face.png index 0402192..2dff3cb 100644 Binary files a/JotunnModStub/Assets/AlfarNexus/AlfarNexus_face.png and b/JotunnModStub/Assets/AlfarNexus/AlfarNexus_face.png differ diff --git a/JotunnModStub/Assets/AlfarNexus/AlfarNexus_icon.png b/JotunnModStub/Assets/AlfarNexus/AlfarNexus_icon.png index 7895308..a85c891 100644 Binary files a/JotunnModStub/Assets/AlfarNexus/AlfarNexus_icon.png and b/JotunnModStub/Assets/AlfarNexus/AlfarNexus_icon.png differ diff --git a/JotunnModStub/Assets/AlfarNexus/AlfarNexus_n.png b/JotunnModStub/Assets/AlfarNexus/AlfarNexus_n.png index 3991152..1940c2a 100644 Binary files a/JotunnModStub/Assets/AlfarNexus/AlfarNexus_n.png and b/JotunnModStub/Assets/AlfarNexus/AlfarNexus_n.png differ diff --git a/scripts/paint_nexus.py b/scripts/paint_nexus.py index 1126dc5..6205c87 100644 --- a/scripts/paint_nexus.py +++ b/scripts/paint_nexus.py @@ -1,7 +1,7 @@ """Paint the Ljoskjarne's pyramid face (Alfar Nexus) and render a preview. Usage: py -3.14 -I paint_nexus.py must hold runes/RuneTile_e.png (Valheim's glyphs, the Ashlands rune tile's glow mask), -metal/blackmetal_d.png and metal/Ironbeam_d.png, all from bundle c4210710. Writes +metal/Ironbeam_d.png, both from bundle c4210710. Writes AlfarNexus_face.png (one face, u 0..1 along the base, v 1 at the apex), AlfarNexus_glow.png (its glow map: the cyan seam down the middle), AlfarNexus_n.png (its normal map), AlfarNexus_icon.png and prev_nexus.png; copy the face, glow, normal map and icon to @@ -34,14 +34,40 @@ wide = [b for b in blobs if b not in tall and (b[2]-b[0]) < 200] glyph = lambda b: Image.fromarray((mask[b[1]:b[3], b[0]:b[2]]*255).astype(np.uint8)) print("glyphs: tall", len(tall), "short", len(wide)) -# --- the plate: forged steel. Fine grain from the black metal bar's texture, tiled every 37 cm, and -# broad blotches from the iron beam's metal, stretched over the whole face. +# --- the plate: three riveted steel panels per face, split by two straight seams and framed by a +# seam along the sloping edges, each brushed in its own streaks toward the apex. Straight lines and +# streaks read as metal; the iron beam's blotches stay only as a faint hint of wear. def norm(a): return (a - a.mean())/(a.std() + 1e-6) -tile = Image.open(os.path.join(d,"metal","blackmetal_d.png")).convert("L").resize((96,96), Image.BICUBIC) -grain = norm(np.tile(np.asarray(tile, dtype=np.float32), (6,6))[:S,:S]) +Y, X = np.mgrid[0:S, 0:S].astype(np.float32) # Y from the apex down +edge = Y/2 - np.abs(X - (S-1)/2) # pixels inside the sloping edges +SEAMS_Y = (int(S*0.31), int(S*0.635)) # above the tall runes, between them and the rows +FRAME = 12 # the edge seam, this far inside the edge +band = (Y >= SEAMS_Y[0]).astype(int) + (Y >= SEAMS_Y[1]).astype(int) + +def brushed(seed): + n = np.random.default_rng(seed).normal(size=(S + 120, S)).astype(np.float32) + c = np.cumsum(n, axis=0); n = (c[120:] - c[:-120])/120 # long streaks down the face + return norm(n + 0.5*np.roll(n, 1, axis=1)) +streaks = np.choose(band, [brushed(1), brushed(2), brushed(3)]) iron = Image.open(os.path.join(d,"metal","Ironbeam_d.png")).convert("L").crop((176,90,256,250)) -mottle = norm(np.asarray(iron.resize((S,S), Image.BICUBIC).filter(ImageFilter.GaussianBlur(6)), dtype=np.float32)) -tone = 0.27 + 0.035*grain + 0.05*mottle +mottle = norm(np.asarray(iron.resize((S,S), Image.BICUBIC).filter(ImageFilter.GaussianBlur(10)), dtype=np.float32)) + +seam_lines = np.zeros((S,S), np.float32) # 1 in the groove, soft at its sides +for y in SEAMS_Y: seam_lines = np.maximum(seam_lines, np.clip(2 - np.abs(Y - y), 0, 1)) +seam_lines = np.maximum(seam_lines, np.clip(2 - np.abs(edge - FRAME), 0, 1)*(Y > FRAME*2)) + +rivets = np.zeros((S,S), np.float32) # domes, 2 cm across +def rivet(cx, cy, r=5): + if edge[int(cy), int(cx)] < FRAME + 2 or abs(cx - (S-1)/2) < 30: return + rivets[:] = np.maximum(rivets, np.sqrt(np.clip(1 - ((X-cx)**2 + (Y-cy)**2)/r**2, 0, 1))) +for y, below in zip(SEAMS_Y, (True, False)): # the rune rows start just under the second seam + for cy in ((y - 8, y + 8) if below else (y - 8,)): + for cx in np.arange(S/2 % 30, S, 30): rivet(cx, cy) +for cy in np.arange(FRAME*2 + 20, S - 12, 30): # down both sloping edges + for side in (-1, 1): rivet((S-1)/2 + side*(cy/2 - FRAME - 9), cy) + +tone = 0.30 + np.choose(band, [0.015, -0.01, 0.005]) + 0.022*streaks + 0.012*mottle +tone = tone*(1 - 0.5*seam_lines) + 0.08*rivets stone = tone[...,None]*np.array([0.95,1.0,1.08]) # --- lay the glyphs out inside the face's triangle (in image space the apex is at the top middle) @@ -58,7 +84,7 @@ for i, b in enumerate(tall[:3]): # short clusters in rows toward the base k = 0 for row, y in enumerate(range(int(S*0.66), S-40, 48)): - half = (y/S)*S/2 - 22 + half = (y/S)*S/2 - 36 # clear of the edge rivets x = S/2 - half while x < S/2 + half: g = glyph(wide[k % len(wide)]); k += 1 @@ -84,9 +110,11 @@ line = np.clip((SEAM_HALF + 1 - xs)/2, 0, 1) # two pixels of soft e glow = np.tile(line, (S,1)) Image.fromarray((glow*255).astype(np.uint8)).convert("RGB").save(os.path.join(d,"AlfarNexus_glow.png")) -# --- the normal map, from a height field: the grain and blotches raised a little, runes and the -# seam's channel cut in. DXT5nm, as Valheim packs it: X in alpha, Y in green and blue, red 255. -height = 0.35*grain + 0.9*mottle - 2.2*np.asarray(ink.filter(ImageFilter.GaussianBlur(1)), dtype=np.float32)/255 \ +# --- the normal map, from a height field: faint streaks and wear, the panel seams, runes and the +# glowing seam's channel cut in, the rivets raised. DXT5nm, as Valheim packs it: X in alpha, Y in +# green and blue, red 255. +height = 0.12*streaks + 0.25*mottle - 1.6*seam_lines + 2.5*rivets \ + - 2.2*np.asarray(ink.filter(ImageFilter.GaussianBlur(1)), dtype=np.float32)/255 \ - 1.5*np.clip((SEAM_HALF + 4 - xs)/3, 0, 1)[None,:] gx = np.zeros_like(height); gy = np.zeros_like(height) gx[:,1:-1] = height[:,2:] - height[:,:-2]; gy[1:-1,:] = height[2:,:] - height[:-2,:]