ShitboxInfinity/tools/check_textures.py
m3ultra 82dae637a1 Scenery overhaul: real OSM street furniture, FLUX texture set v2, lighting pass
Builder now uses the furniture OSM already carries (footways, lamps, benches,
bins, bollards, bus stops, crossings): raised chamfered footpaths, shopfront
bands, awnings in three fabrics, parapets, layered fig/palm trees, zebra bars,
dashed centre lines, Queen St Mall winged canopies. ACES tonemap + SSAO + fog
in game.gd. flux_texture.sh gains size/luma clamping (FLUX renders "pale" as
blown-out white); gen_textures.sh + check_textures.py manage the set. Woolies
carpark rebuilt textured, parking the real fleet. Fixes: fractional OSM layer
tag crash, zero-length-normal UV projection, blood-red mall pavers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 14:13:29 +10:00

26 lines
972 B
Python

#!/usr/bin/env python3
"""Report mean luminance / contrast of the level textures.
FLUX happily returns a near-white blank sheet for prompts like "pale grey
concrete", which renders as a blown-out void in game. Anything with a mean
much above ~200 or a range under ~30 is a dud worth re-prompting.
Usage: check_textures.py [name ...]
"""
import os
import sys
from PIL import Image
TEX = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "assets", "textures")
want = set(sys.argv[1:])
bad = 0
for f in sorted(os.listdir(TEX)):
if not f.endswith(".jpg") or (want and f[:-4] not in want):
continue
px = list(Image.open(os.path.join(TEX, f)).convert("L").resize((48, 48)).getdata())
mean, rng = sum(px) / len(px), max(px) - min(px)
flag = " <-- washed out" if mean > 205 else (" <-- featureless" if rng < 8 else "")
bad += bool(flag)
print("%-22s mean %3.0f range %3d%s" % (f[:-4], mean, rng, flag))
sys.exit(1 if bad else 0)