feat: Alfar chests get bodies of their own
Players mistook a plain Wood chest for the Eldividarkista, so neither Alfar chest looks like a buildable vanilla chest any more. Eldividarkista: the Mistlands dvergr crate stretched to 1.6 x 0.8 m, blackened iron with a bronze frame and an iron grate on the front. The grate glows and throws sparks only while the chest holds wood the drones may burn. Inngangskista: the dvergr town loot chest, navy steel with silver trim. A cyan line in the lid shines while it holds anything but the sigil. Both have new hammer icons, and their hover names say their role (input, fuel) in English, Italian and Russian. If a borrowed vanilla model is missing, the chest falls back to the old tinted wood chest. scripts/paint_*_chest.py repaint the textures and render previews and icons offline with scripts/render_obj.py.
This commit is contained in:
parent
16cacde532
commit
b661fa6516
15 changed files with 634 additions and 10 deletions
45
scripts/paint_input_chest.py
Normal file
45
scripts/paint_input_chest.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""Paint the Inngangskista (Alfar input chest) and render its preview and hammer icon.
|
||||
Usage: py -3.14 -I paint_input_chest.py <pylib> <scripts dir> <work dir>
|
||||
<work dir> must hold tex/dvergrchestWorn_d.png, tex/anvil.png and
|
||||
TreasureChest_dvergrtown__stonechest.obj / __stonechesttop_closed.obj, exported from bundle c4210710.
|
||||
Writes AlfarInputChest_d.png and AlfarInputChest_icon.png; copy both to
|
||||
JotunnModStub/Assets/AlfarInputChest/. The trim is recoloured in code (AlfarInputChest.Trim)."""
|
||||
import sys, os
|
||||
sys.path.insert(0, sys.argv[1]); sys.path.insert(0, sys.argv[2])
|
||||
import numpy as np
|
||||
from PIL import Image, ImageFilter
|
||||
from render_obj import render
|
||||
d = sys.argv[3]
|
||||
|
||||
S = 128
|
||||
src = Image.open(os.path.join(d,"tex","dvergrchestWorn_d.png")).convert("RGB")
|
||||
up = np.asarray(src.resize((S,S), Image.BICUBIC), dtype=np.float32)/255
|
||||
lum = up @ np.array([0.3,0.59,0.11])
|
||||
lo, hi = np.percentile(lum, 3), np.percentile(lum, 97)
|
||||
t = np.clip((lum-lo)/(hi-lo), 0, 1)
|
||||
rng = np.random.default_rng(11)
|
||||
brushed = np.asarray(Image.fromarray((rng.random((S,S))*255).astype(np.uint8)).resize((S,S//16), Image.BICUBIC).resize((S,S), Image.BICUBIC), dtype=np.float32)/255
|
||||
# steel-blue plates: the planks' seams survive as faint plate joints
|
||||
steel = np.array([0.12,0.17,0.24])[None,None,:] * (0.85 + 0.25*brushed)[...,None] * (0.8 + 0.35*t)[...,None]
|
||||
Image.fromarray((np.clip(steel,0,1)*255).astype(np.uint8)).save(os.path.join(d,"AlfarInputChest_d.png"))
|
||||
|
||||
TRIM = (1.25,1.3,1.35) # AlfarInputChest.Trim
|
||||
K = 1.5*1.2 # the mesh scale times the chest's 1.2
|
||||
LIDTOP, HX, HZ = 0.48*K, 0.42*K, 0.24*K
|
||||
INSET, W = 0.10, 0.03 # AlfarInputChest inlay
|
||||
cyan = (0.35,0.9,1.0)
|
||||
panel = Image.open(os.path.join(d,"AlfarInputChest_d.png")); metal = Image.open(os.path.join(d,"tex","anvil.png"))
|
||||
parts = [{'obj':os.path.join(d,'TreasureChest_dvergrtown__'+n+'.obj'),'texs':[metal,panel],'colors':[TRIM,(1,1,1)],'scale':(K,K,K)}
|
||||
for n in ('stonechest','stonechesttop_closed')]
|
||||
cube = os.path.join(d,'cube.obj')
|
||||
ix, iz = HX-INSET, HZ-INSET
|
||||
for z in (-iz, iz): parts.append({'obj':cube,'color':cyan,'emissive':True,'scale':(2*ix+W,0.01,W),'offset':(0,LIDTOP+0.004,z)})
|
||||
for x in (-ix, ix): parts.append({'obj':cube,'color':cyan,'emissive':True,'scale':(W,0.01,2*iz),'offset':(x,LIDTOP+0.004,0)})
|
||||
|
||||
tiles = []
|
||||
for k,yw in enumerate((-30,60,150,240)):
|
||||
p = os.path.join(d,f'_i{k}.png'); render(parts,p,size=256,yaw=yw,pitch=-30,light=(0.4,0.8,0.6)); tiles.append(Image.open(p))
|
||||
sheet = Image.new('RGBA',(1024,256))
|
||||
for k,tl in enumerate(tiles): sheet.paste(tl,(k*256,0))
|
||||
sheet.save(os.path.join(d,'prev_input.png'))
|
||||
render(parts, os.path.join(d,'AlfarInputChest_icon.png'), size=128, yaw=160, pitch=-28, bg=(0,0,0,0), light=(0.3,0.8,0.7))
|
||||
Loading…
Add table
Add a link
Reference in a new issue