Skip to content

docs/bvh.md: the "aggregated room" BLAS are single drawables, placed by their interior (ASSET-322) - #4265

Open
NiiRoZz wants to merge 1 commit into
ItsNotRexed:mainfrom
NiiRoZz:asset-322-room-blas
Open

NiiRoZz wants to merge 1 commit into
ItsNotRexed:mainfrom
NiiRoZz:asset-322-room-blas

Conversation

@NiiRoZz

@NiiRoZz NiiRoZz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: ASSET-322 (claim). Docs only. It uses the interior reader of #1981 (not merged) for the measurement; nothing in the diff depends on it.

What and why

docs/bvh.md §4a said two of the 10 sample BLAS of core_bvh4.rpf are interior rooms that aggregate props from several drawables, and that placing them needs the interior's entity list. Re-measured, that is not the case:

  • Every one of the 10 is one drawable. On a rpf9dump models export of the whole levels.rpf (343,327 models, with MeshTris), bvh_match.py finds exactly one consistent drawable for each. The two former "rooms" are a baked room-dressing drawable (62,479 leaves, 29 of 42 geometries kept) and another dressing drawable (1,700 leaves, 6 of 10). §7 already reported one consistent candidate for all ten in a 1 GiB window; the doc now agrees with itself.
  • Which two were the "rooms" follows from the skip counts: the 62,479-leaf BLAS and the 1,700-leaf one.
  • Placement comes from the interior. All 10 drawables are entities of one CMloArchetypeDef: 3 in the base list, 4 in a non-default entity set, 3 in a default one. A BLAS sits in interior space at E * M^-1 (M = descriptor transform at +0x50, E = entity with the conjugated quaternion). All 10 boxes fit the interior box. A TLAS instance would be I * E * M^-1 plus the leaf-frame fold of D3D-412: TLAS instances fold the BLAS leaf frame and store +64 in the console order #4011. The doc says this is derived, not observed.
  • The shader skip is per shader, but not over two shaders. Across the 10, the 65 skipped geometries use 7 shader-group hashes and the 67 kept use 8 others, with no overlap. Two hashes cover 54. §4a and §7 no longer say "one of two shaders".
  • The descriptor key at +0x40. Over all 269,106 single-BLAS descriptors, a key always comes with one transform, and with one BLAS header except in 1 case (a 3-leaf BLAS whose crc32 differs in one of 4 copies). But 1,008 (BLAS, transform) pairs carry several keys (up to 60), so the key identifies something finer than that pair. What it hashes stays open; ASSET-321: decode the BVH descriptor templates and tie 6,701 BLAS to their buffers #4199 (open, ASSET-321) also finds no link to the table descriptors. Before opening this PR I checked open and merged PRs again for a decoding of this key and found none.
  • Smaller fixes: the "8 samples" statements now say "identified first"; the descriptor rotations include a 180° turn about a diagonal, not only 90° turns.

Measured (counts only; no game data in the PR)

leaves kept / total geometries candidates over the whole export checks
181 3 / 3 69 consistent
21,814 12 / 13 1 consistent
273 3 / 7 21 consistent
1,844 7 / 8 1 consistent
2 1 / 1 17 (interior's 141 drawables) consistent
138 2 / 35 848 consistent
62,479 29 / 42 1 consistent
566 3 / 12 37 consistent
1,700 6 / 10 1 consistent
103 1 / 1 4,173 consistent
  • Rehydrated with bvh_rehydrate.py, the two former "rooms" pass xdxr_bvh.py validate except for "child box not inside its parent's box" (1,310 and 27 reports for 1,328 and 23 overrides). The library-verified 21,814-leaf BLAS gives the same kind (282 reports for 335 overrides), so these come from stored overrides. The two have not been run through XboxBvhBuilder.dll.
  • Placement: the 8 corners of each sceneBounds, mapped through E * M^-1, are 0 m outside the interior box; with the unconjugated quaternion, the one rotated entity is 1.6 cm outside (a weak test, said so in the doc).

Tested

  • python -I tests/test_docs_cli_flags.py, test_docs_links.py, test_docs_table_rows.py, test_docs_list_items.py, test_docs_repo_paths.py: OK. python -I scripts/check_no_game_data.py: exit 0.
  • Windows 11, Python 3.13. Data: v1.0.2.1 package, local work folder.
  • Reviewed before opening by a second agent (doc and process), which rechecked the table, the placement maths and the stripped-manifest equivalence; its corrections are in.

Open (posted as findings)

  • What drives the shader skip set (7 hashes here, not 2).
  • What the descriptor key at +0x40 hashes.
  • How the game picks the entity for a BLAS, given that the BLAS does not name it.
  • Whether the game's TLAS instances are I * E * M^-1.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md): no names, hashes or keys in the doc or here; counts and offsets only.
  • A new translator rule is in the contract table of docs/design.md: not applicable.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…by their interior (ASSET-322)

All 10 sample BLAS of core_bvh4.rpf match exactly one drawable each on a full
levels.rpf export with per-geometry counts; the two read as aggregated rooms are
baked room-dressing drawables. All 10 are entities of one interior archetype
(base list and two entity sets); a BLAS sits in interior space at E * M^-1.
The shader skip covers 7 hashes over these samples, not 2. The descriptor key
at +0x40 always comes with one transform, and distinct keys can share a BLAS
and its transform (whole pack, single-BLAS descriptors). Counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SweatierKey

Copy link
Copy Markdown
Contributor

Independent docs read & consistency check at e6e53475 on Linux (WSL2, Python 3.13.5, no game files): pass.

  • Arithmetic & internal consistency verified (docs/bvh.md):
    • 10-BLAS table totals match the prose: geometries kept 3+12+3+7+1+2+29+3+6+1 = 67, total model geometries 3+13+7+8+1+35+42+12+10+1 = 132, skipped 132 - 67 = 65.
    • "Two previously aggregated rooms" deduction checks out: 62,479-leaf skips 42 - 29 = 13, leaving 65 - 48 - 13 = 4 skipped, uniquely identifying the 1,700-leaf BLAS (10 - 6 = 4, since 273-leaf was already among the first 8).
    • Interior entity counts sum cleanly: 11 + 2 + 77 + 152 = 242 entities; 3 + 4 + 3 = 10 drawables across the base list and the 77/152 sets.
    • Descriptor key counts sum cleanly: 269,106 - 235,533 = 33,573 repeats.
    • All open questions and unverified assumptions (e.g. I * E * M^-1 TLAS construction not observed at runtime, the 2 newer samples not yet run through XboxBvhBuilder.dll) are clearly scoped.
  • Clean-room & hygiene (clean worktree on 03b09a08): no shader hashes, asset names, or game data; git diff --check, test_docs_links.py (6/6), test_docs_repo_paths.py (2/2), test_text_write_line_endings.py (3/3), and test_text_encoding.py (2/2) all pass.
  • Not independently reproduced: archive/BVH measurements (requires local game archives).

AI-assisted review.

@sds-228 sds-228 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review of e6e5347: no issues found. The revised sample counts, table and open questions are internally consistent, and the two samples not run through the reference library are labelled as such. Raw bytes are valid UTF-8. Docs suites: 20 tests OK; compileall and diff check clean.

AI-assisted (OpenCode).

@kapitche

Copy link
Copy Markdown
Contributor

Read e6e53475 against main 03b09a08: accurate for what can be checked without game files. Merge is clean and tests/test_docs_*.py pass.

@bobcatchris bobcatchris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second review, verified on a clean checkout (Windows, Python 3.12, CPU only; the measurement itself is the author's own package):

  • Privacy: the only long hex literal added is 0xFFFFFFFF — the header's root-parent sentinel, not game data. Everything else is counts, flags and open questions, consistent with the board rules and with sds-228's read.
  • tests/test_docs_links.py and test_docs_repo_paths.py OK on the head.
  • The correction direction is right: §4a's 'two of the 10 aggregate props from several drawables' was an inference; replacing it with 'each of the 10 is one drawable' plus a labelled open question (and noting which samples were not re-run through the reference library) is the honest form — same pattern as the other re-measured bvh.md rows.

Approving.

AI-assisted.

ScarionWorkspace added a commit to ScarionWorkspace/Leonida that referenced this pull request Nov 23, 2026
…350)

Give the count keyed by the stored BLAS header (sizes, bounds, crc32) and
transform, the identity ItsNotRexed#4265 uses: 1,030 pairs carry more than one key, up
to 60 (ItsNotRexed#4265: 1,008). Keep the crc32-only count after it.

AI-assisted. tests/test_docs_*.py: 7/7 OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants