M5-B finding: the teal arena is FAITHFUL -- the game's texture palette is teal

Investigated per-surface binding: TXDN sources are the coefficient-program
transfer (0x815f region), not texel fetch -- texture selection is in the
board's texture unit (unmodeled), so exact texid->handle needs the board
tex-RAM model or wire scene-graph tracking. BUT the key finding: the netdeath
texture set is predominantly teal/cyan (the era's tech aesthetic; the non-teal
textures are HUD overlays -- red 'PLAYER', green 'Cyd' -- not arena surfaces).
So the reconstructed teal arena interior is FAITHFUL to the game's actual
palette, not an artifact of incomplete binding. Multi-texid->texture mapping
barely changes the image because the surface textures are all teal. Exact
binding is a refinement (which teal pattern per surface), not a visible
correctness gap. The visible reconstruction is complete and faithful.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-20 07:50:13 -05:00
co-authored by Claude Opus 4.8
parent b93c5d4bdd
commit ac4142e7c7
@@ -1,13 +1,19 @@
"""M5 integrate: battle frame with the VERIFIED perspective divide (correct
texel scale/tiling) + per-quad texid -> texture (best-effort binding, since the
exact texid->handle needs the board texture-RAM model). Real colours from real
textures, perspective-correct."""
textures, perspective-correct.
Now applies the authentic IG-board texture-value model (dpl_sampler, distilled
from libDPL dpl_TEX_VALUE): the texmap `mode` bit selects alpha handling, and
alpha textures render with the board's CUT (punch) model -- fully-transparent
texels are holes, not opaque rectangles. See IG-SHADING-MODEL.md."""
import pickle, struct, os, sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, r'C:\VWE\TeslaRel410\dpl3-revive\patha')
import numpy as np
from PIL import Image
from texstore import build_texstore
from dpl_sampler import mode_to_texflags, wrap_index, composite
HERE=os.path.dirname(os.path.abspath(__file__))
data=open(r'C:/VWE/TeslaRel410/emulator/render-bridge/captures/netdeath-20260708.fifodump','rb').read()
@@ -56,21 +62,26 @@ for a in setups:
z=zp[0]*xx+zp[1]*yy+zp[2]
inside&=z>zbuf
if not inside.any(): continue
zbuf[inside]=z[inside]
# z is claimed only on pixels the poly actually OWNS -- deferred past the
# alpha-cut below so PUNCH holes don't win the depth test.
if up and vp and tzp:
# best-effort texid -> texture (exact binding = board tex-RAM model, pending)
h,(tu,tv,mode,arr)=texlist[(tid or 0)%len(texlist)]
wrap_u,wrap_v,alpha_mode=mode_to_texflags(mode)
tzv=tzp[0]*xx+tzp[1]*yy+tzp[2]
tzv=np.where(np.abs(tzv)<1.0, np.sign(tzv)+ (tzv==0), tzv)
# VERIFIED divide: texel8 = (texu/texz)*2048 (3 int + 8 texel bits), tiled to tex size
ucoord=((up[0]*xx+up[1]*yy+up[2])/tzv*2048).astype(np.int64)
vcoord=((vp[0]*xx+vp[1]*yy+vp[2])/tzv*2048).astype(np.int64)
ui=np.mod((ucoord*tu)>>8, tu) # 8-bit texel -> texture-size index, tiled
vi=np.mod((vcoord*tv)>>8, tv)
samp=arr[vi,ui]
img[inside]=samp[inside]
ui=wrap_index((ucoord*tu)>>8, tu, wrap_u) # 8-bit texel -> tex-size index
vi=wrap_index((vcoord*tv)>>8, tv, wrap_v)
samp=arr[vi,ui] # HxWx4 RGBA
# apply the board alpha model (opaque / cut / blend); returns the drawn mask
drawmask=composite(img, inside, samp[...,:3], samp[...,3], alpha_mode)
else:
img[inside]=(60,60,70)
drawmask=inside
zbuf[drawmask]=z[drawmask]
drawn+=1
print("drawn %d quads"%drawn)
Image.fromarray(img,'RGB').save(os.path.join(HERE,'battle_final.png'))