#91 thor black rectangle: it's the OWN missile pod -- blakskn now material-keyed

Three testers reported a black rectangle swaying with the footsteps in the
thor cockpit (Summoner = the thr1 label, same THX canopy -- no isolation).
Decode: the inside view is a PER-MECH AUTHORED type-A set, not the cop
alone (no fallback in EntitySegment::GetVideoObjectName -- authored data):
madcat/vulture/bhk1 = cop; sunder/loki/avatar = +tor; thor = +tor +MSL
(the shoulder pod, the reported rectangle); owens = +both legs +tshd.
The pod/leg pilot-facing surfaces use the SAME "<pfx>skin:blakskn_dz_*"
interior-structure material as the canopy frame, but the unlit frame
constant was keyed on the _cop FILENAME -- identical material rendered
(0.13,0.12,0.15) on the canopy and pure (0,0,0) on the pod/legs
([matlog]: owx_cop blakskn vcol=FF211F26 vs owx_lule vcol=FF000000).

Fix (bgfload.cpp): the frame-constant treatment keys on meshIsCop OR
material contains "skin:blakskn_dz_". mechfx:blakskn_mtl (tshd shadow
quads) deliberately excluded. Verified: zero pure-black px in the lower
view band across walk captures, the pod plate renders frame-toned and
blends with the bar at rest (the reported anomaly dissolves), owens legs
read as coherent structure, canopy/terrain un-regressed.

Diags added: BT_MAT_LOG=<stem> per-batch material routing dump (bgfload),
BT_HIDE_INSIDE_SEG=<substr> inside-mesh hide (btl4vid), [view] per-segment
inside-roster names. KB: cockpit-view.md exactly-one claim corrected +
the #91 section; bench scratchpad/night11/thorrect.sh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Joe DiPrima
2026-08-04 12:43:36 -05:00
co-authored by Claude Fable 5
parent dcd8583449
commit 6180a44c64
3 changed files with 93 additions and 3 deletions
+37 -1
View File
@@ -640,6 +640,7 @@ struct Builder {
bool currentTSphere = false; // material is tsphere_mtl (translocation warp): ramp it despite normals
bool meshIsTSphere = false; // this OBJECT is the translocation warp -> smooth-tessellate the cone
bool meshIsCop = false; // this OBJECT is a *_cop cockpit canopy shell (task #55)
std::string meshStem; // lowercased load stem (BT_MAT_LOG diag)
std::map<const void*, int> copRoleMap; // punch-kit roles per PMESH chunk: 1=mask 2=hull 3=skip (see TAG_PATCH)
int currentCopRole = 0; // role of the pmesh being built (consumed by buildPmesh)
bool currentHasEmissive = false;
@@ -778,7 +779,19 @@ struct Builder {
// value is not recoverable from the code (texture-less ramp = no texel
// luminance to index); default (0.13,0.12,0.15) [T3] matches the dark
// near-black frame in pod gameplay footage. BT_COP_FRAME="r g b" overrides.
if (useRamp && currentTex.empty() && meshIsCop) {
// The same interior-structure treatment applies to the blakskn SKIN
// family on ANY mesh, not just *_cop shells: the inside skeletons
// author pilot-facing surfaces of the OWN-BODY meshes (thor thx_msl
// missile pod, owens owx_* legs -- issue #91) with the identical
// "<pfx>skin:blakskn_dz_*" material the canopy frame uses, and the
// board shaded them all the same way. Keying on the filename alone
// left those surfaces vcol=pure-black -- the reported "black
// rectangle" was the thor pod's blakskn mount plate at RGB(0,0,0)
// instead of the frame constant. mechfx:blakskn_mtl (the tshd
// shadow quads) must NOT match -- key on the skin-lib "_dz_" form.
const bool blaksknSkin =
currentMatName.find("skin:blakskn_dz_") != std::string::npos;
if (useRamp && currentTex.empty() && (meshIsCop || blaksknSkin)) {
auto CB = [](float ff){ int v=(int)(ff*255.0f+0.5f); return (uint32_t)(v<0?0:v>255?255:v); };
vcol = 0xFF000000u | (CB(copFrameRGB(0))<<16) | (CB(copFrameRGB(1))<<8) | CB(copFrameRGB(2));
}
@@ -939,6 +952,28 @@ struct Builder {
else
batch.lodBias = 0.0f;
mesh->batches.push_back(batch);
// #91 diag: BT_MAT_LOG=<substr> dumps each batch of a matching mesh
// stem -- the material routing decision (ramp vs lit vs emissive,
// resolved colour, texture) for the inside-view black-mesh hunt.
{
static const char* s_matLog = getenv("BT_MAT_LOG");
if (s_matLog && *s_matLog
&& meshStem.find(s_matLog) != std::string::npos)
fprintf(stderr, "[matlog] %s mat=%s color=%08X hasDiff=%d "
"tex='%s' ch=%d hasRamp=%d useRamp=%d norms=%d "
"emis=%d vcol=%08X tris=%u\n",
meshStem.c_str(), currentMatName.c_str(), currentColor,
(int)currentHasDiffuse, currentTex.c_str(),
currentTexChannel, (int)currentHasRamp, (int)useRamp,
(int)hasNormals(vtag), (int)pureEmissive, vcol,
idxCount / 3);
if (s_matLog && *s_matLog
&& meshStem.find(s_matLog) != std::string::npos)
fprintf(stderr, "[matlog] ramp lo=(%.3f,%.3f,%.3f) "
"hi=(%.3f,%.3f,%.3f)\n",
currentRampLo[0], currentRampLo[1], currentRampLo[2],
currentRampHi[0], currentRampHi[1], currentRampHi[2]);
}
if (getenv("BT_COP_DUMP") && currentHasRamp && currentTex.empty()) {
float lo[3]={1e9f,1e9f,1e9f}, hi[3]={-1e9f,-1e9f,-1e9f}, cen[3]={0,0,0}; int nv=0;
for (uint32_t i = idxStart; i < idxStart + idxCount; ++i) {
@@ -1386,6 +1421,7 @@ bool LoadBgfFile(const std::string& name, BgfData& out) {
// single-siding + dark-frame ramp reconstruction in emitTri/buildPmesh applies to
// these meshes only.
b.meshIsCop = stemLower(name).find("_cop") != std::string::npos;
b.meshStem = stemLower(name);
b.res = &res;
for (const Chunk& c : roots) b.collect(c);
b.finish();