Skip to content

bvh.md: the dehydrated BLAS rehydrate, with their packing and source geometry (PROC-109) - #2034

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
wildheathen:docs/bvh-rehydrate-geometry
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
wildheathen:docs/bvh-rehydrate-geometry

Conversation

@wildheathen

@wildheathen wildheathen commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

PROC-109. Claim: #1902 (comment) (new item, docs only).

docs/bvh.md §4 left open whether the bvh4 packs are XboxBvhBuilder's rehydrate inputs, and §3.1 left the dehydrated packing open. This settles both. It adds §4a, "Rehydration and source geometry (measured)":

  • The library runs on a PC. RehydrateRaytracingAccelerationStructureX runs on the CPU path: buffers are mapped at their GPU virtual addresses, and it makes no device calls. It returns S_OK on the packs.
  • The packing. The section describes the element chunks and the box groups by level, with their override masks, the level table and the +-inf box16 overflow. It also covers the leaf frame decoded from compressionParams. A CPU model built on this layout gives the same bytes as the library on 8 BLAS, from 384 bytes to 2.5 MB.
  • The instance transform. The 3x4 at descriptor +0x50 is the geometry transform: x' = M * x.
  • The source of the triangles. They come from the drawables in levels.rpf. A leaf's geometry index counts only the geometries whose shader the BVH keeps. Two shaders are left out. Their name hashes stay out of the repository per §8, and the doc says how to recover them locally.
  • Checks for a geometry match. A byte-identical library result does not prove the geometry is right, so the section lists four checks that use what the BLAS stored: header bounds, box overrides, box area and paired leaves. With them, 8 of 10 samples have exactly one matching drawable. The other 2 are interior rooms that aggregate props, and placing those needs the MLO entity list (world_build: place interior (MLO) entities (--interiors, ASSET-127) #1981).

The tools that measured this are in a fork of another project, GPL-2.0-only: wildheathen/americas-recomp, branch feat/bvh-rehydrate-tools. No code from it is in this PR, and only layouts, offsets and counts are reproduced.

Testing: docs only. Run on this branch:

  • test_docs_links, test_docs_list_items, test_docs_repo_paths and test_xdxr_bvh pass.
  • test_docs_design_rows fails the same way on main, on design.md, README.md and testing.md, none of which this PR touches.

The measurements ran on Windows 11 with the retail package, on the CPU only; no GPU was involved.

AI-assisted.

…geometry

The packs are XboxBvhBuilder's rehydrate inputs: RehydrateRaytracingAccelerationStructureX returns S_OK on a PC (CPU path, buffers mapped at their GPU virtual addresses), and a CPU model of the packing gives the same bytes on 8 samples. New section 4a records the element and box packing, the leaf frame from compressionParams, the instance descriptor's 3x4 as the geometry transform, where the triangles come from (drawables in levels.rpf, minus the geometries of two shaders), and four checks that verify a geometry match. The two shader name hashes stay out per section 8.
@dcastell1

Copy link
Copy Markdown
Contributor

Code read + CPU tests, 84c7067: pass (tests/test_docs_links.py → 5 passed). The "rehydrate before traversal" sentence is the one that will save someone a debugging day.

@wildheathen wildheathen changed the title bvh.md: the dehydrated BLAS rehydrate, with their packing and source geometry bvh.md: the dehydrated BLAS rehydrate, with their packing and source geometry (PROC-109) Nov 22, 2026
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.

3 participants