fix(IconForge): point the texture path at the real dump directory
render.py was lifted from the scratch pipeline with its default TEXDIR still aimed at tools/IconExtract's build output — a tool that is not in the repo. forge.py overrides the value, so the icons built correctly and the staleness was invisible; anyone importing render.py directly would have been sent to a path that never existed. Default now matches where tools/MosswartArt actually writes, and a missing texture prints a warning instead of silently dropping out: a partial texture set renders some parts flat grey, which reads as a lighting bug rather than a missing extraction step. Both icons still reproduce byte-for-byte. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
a1ffe77af4
commit
48c44abd4a
1 changed files with 9 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
"""Software rasterizer for the exported mosswart mesh.
|
"""Software rasterizer for the exported mosswart mesh.
|
||||||
|
|
||||||
Loads the JSON dumped by tools/MosswartArt, textures dumped by tools/IconExtract,
|
Loads the geometry and textures dumped by tools/MosswartArt into work/, and
|
||||||
and renders a lit, shaded, supersampled image. Deliberately simple: z-buffer,
|
renders a lit, shaded, supersampled image. Deliberately simple: z-buffer,
|
||||||
perspective camera, Lambert key/fill/rim + Blinn specular for wet skin.
|
perspective camera, Lambert key/fill/rim + Blinn specular for wet skin.
|
||||||
"""
|
"""
|
||||||
import json, glob, os, math
|
import json, glob, os, math
|
||||||
|
|
@ -9,8 +9,9 @@ import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||||
ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
|
# Default matches where tools/MosswartArt writes its texture dump. forge.py
|
||||||
TEXDIR = os.path.join(ROOT, "tools", "IconExtract", "bin", "Release", "net10.0", "out")
|
# overrides this when --work points elsewhere.
|
||||||
|
TEXDIR = os.path.join(HERE, "work", "textures")
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------- data loading
|
# ---------------------------------------------------------------- data loading
|
||||||
|
|
@ -19,6 +20,10 @@ def load_textures(ids):
|
||||||
for tid in ids:
|
for tid in ids:
|
||||||
hits = glob.glob(os.path.join(TEXDIR, tid + "_*.png"))
|
hits = glob.glob(os.path.join(TEXDIR, tid + "_*.png"))
|
||||||
if not hits:
|
if not hits:
|
||||||
|
# Say so: a partial texture set renders some parts flat grey, which
|
||||||
|
# is easy to mistake for a lighting problem rather than a missing
|
||||||
|
# extraction step.
|
||||||
|
print(f" WARNING: no texture found for {tid} in {TEXDIR}")
|
||||||
continue
|
continue
|
||||||
im = Image.open(hits[0]).convert("RGBA")
|
im = Image.open(hits[0]).convert("RGBA")
|
||||||
out[tid] = np.asarray(im, dtype=np.float32) / 255.0
|
out[tid] = np.asarray(im, dtype=np.float32) / 255.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue