The user caught the inversion (blocked viewports, see-through frames); the
answer came from the rasterizer board itself: an i860 disassembly of the
VREND.MNG firmware decoded the damageize handler (@0xf040f6f8) -- cmd 0x20
(vr_damage_action) writes the dpl_Punchize token triple onto the punch
geogroup's first three geometry chunks IN FILE ORDER:
chunk1 = the detailed window-aperture shapes -> an invisible per-pixel MASK
chunk2 = the coarse hull -> the ONLY colour-drawn geometry (where not masked)
chunk3 = byte-identical hull twin -> the damage-reset record, never visible
Visible canopy = hull-minus-apertures. Both earlier readings were wrong ways
around the same three chunks: dropping all punch left floating fragments (no
hull); hiding the duplicate pair hid the HULL and drew the MASK -- the exact
inversion observed.
Port: bgfload tags per punch patch {non-paired pmesh = mask (role 1),
first twin = hull (role 2), second twin = skip}; L4D3D DrawMesh runs
mask->stencil-1 (no colour/z-write, z-tested), hull->stencil-NOTEQUAL,
mask->stencil-0; device D24X8 -> D24S8 + stencil clear. The cut never
touches z, so later-drawn entities show through the apertures.
BT_COP_PLATES=1 disables (diag).
In-game, all 8 mechs on pure defaults: connected dark frames with clear
viewports -- thor (the footage mech) shows the central viewport + surrounding
frame exactly as filmed. Combat regression clean (kill + no NaN).
Arena textured punch uses the same firmware kit; the black-texel alpha path
there is a working approximation, flagged in the KB.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4.9 KiB
id, title, status, source_sections, related_topics, key_terms, open_questions
| id | title | status | source_sections | related_topics | key_terms | open_questions | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bgf-format | BGF Model Format (DIV-BIZ2 geometry) + the render gotchas | established | docs/BGF_FORMAT.md (full spec); CLAUDE.md §5, §10 render-fidelity notes |
|
|
|
BGF Model Format
.BGF = DIV-BIZ2 little-endian nested Tag-Length-Value geometry. Full byte-level parsing
spec (verified against all 1275 content .BGF files) lives in docs/BGF_FORMAT.md — this
topic captures the structure + the hard-won gotchas that cost real debugging. Loader of record:
engine/MUNGA_L4/bgfload.cpp (game-callable via LoadBgfFile); standalone reference reader
DivLoader/VGCDivLoader.cpp. Tag names: dsys/PFBIZTAG.H.
Structure
OBJECT → LOD → PATCH (geogroup) → PMESH. Interleaved float32 verts; QUAD faces (must
triangulate [a b c][a c d]); materials referenced by library:material name (resolved
against the map's .BMF libs). Damage/articulation are name-driven via SV_SPECIAL (0x2037)
dz_* tokens, not stored geometry. [T1]
Indices — the CONN/PCONN story (two corrections)
A PMESH carries faces in CONNECTION_LIST (0x0047) and/or PCONN_LIST:
CONNECTION_LISTis a FLAT TRIANGLE LIST (3 indices/face) — NOT "one polygon, fan-triangulate" (the original doc was wrong; fan-triangulating turned buttec's 115 tris into 341 fan-garbage). Corpus-verified: ALL 3488 CONN chunks have n%3==0. [T2]- CONN and PCONN COEXIST — a pmesh can carry quads/hexes in PCONN PLUS loose triangles in
CONN. 370 of 841 GEO models had mixed pmeshes silently dropping their CONN triangles until
both were processed always (the "turret base missing panels" bug).
ppf=6hexagons exist. [T2]
LODs — the √3 decode
Each LOD chunk carries a 0x2046 header = [near..far) viewing band. The board selected the
LOD whose band contains the camera distance.
- √3 range decode: every stored band value is the authored euclidean distance ÷ √3 (92% of
the corpus is exactly nice-number/√3; hand-conversion typos prove it). Multiply parsed bands by
√3(kLodRangeScale=1.7320508). [T2] - Metric = the instance-transformed OBJECT ORIGIN distance, ONE shared
dfor all LODs of an object (a bounding-sphere-SURFACE metric desyncs sibling bands — wrong). [T2] - ADDITIVE_LODS (object-level
SV_SPECIALtoken, 135 pod BGFs — all arena structures): at eye distance d, EVERY LOD withd < OutDistdraws (near detail ADDS onto coarser massing). Non-additive keep first-LOD-only (the 2007 engine's own behavior). [T2] - PUNCH (patch-level
SV_SPECIAL,dpl_Punchize= FUN_00490308 → VPX board cmd0x20, tokens{0x80000003,0x80000017,0x80000004}— a CONSTANT geogroup-modifier opcode, no color key; the siblingdpl_DamagizeFUN_004902b0 uses the same cmd with a different triple). Two cases: [T1]- Textured punch (arena walls/catwalks): black texels = HOLES (alpha-test in the opaque pass). Coplanar shells inside one LOD z-fight → depth-bias by submission ordinal. [T2]
- FINAL mechanism (i860 VREND.MNG firmware, decoded 2026-07-11): a punch geogroup is a THREE-CHUNK STENCIL-CUT KIT -- in file order: aperture MASK (invisible per-pixel cutout), visible HULL (the only colour-drawn chunk, drawn where not masked), byte-identical hull TWIN (the damage-reset record, never visible). Visible result = hull-minus-apertures. Applies to cockpit canopies, arena punch (AR02 etc.) and outside-torso punch (VUX_TOR) alike -- the port's arena "black texels = holes" alpha-test path is a visual approximation that predates this decode (works; revisit for exactness). Port: bgfload punch-kit roles + the L4D3D stencil cut (D24S8). See cockpit-view + decomp-reference for firmware addresses. [T1 mechanism / T2 render-verified all 8 cockpits]
Shading model (from libDPL DPLTYPES.H)
Shading is selected PER-GEOMETRY by vertex type:
- No-normal geometry (XYZ_UV / XYZ_RGBA_UV: mesas/ground/sky/buildings/mech, WHITE baked verts) is UNLIT, colorized by the material's 2-endpoint RAMP (see material-ramp).
- Normal-bearing geometry (XYZ_N_UV: ~150 vehicle/missile files) is LIT by the map light.
- Applying the ramp to lit geometry = the "dusty white blobs" bug — gate on
hasNormals. [T2]
Skeleton assembly
A mech is not one BGF — it's a .SKL skeleton (a DCS tree of joints) whose each joint's
Object=part.bgf is loaded + posed, then animated by .ANI clips. See asset-formats /
locomotion for skeleton + animation. [T1]
Key Relationships
- Detailed spec:
docs/BGF_FORMAT.md. - Consumed by: rendering (the D3D9 draw path), locomotion (skeleton parts).
- Related: asset-formats (BMF/BSL/SKL/ANI), decomp-reference.