diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:17:15 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:17:15 -0500 |
| commit | 4e646b96c126c85cf9a0b9eac4d0c986aa959c2a (patch) | |
| tree | 59f9204fbe256135b8d7db4e935d29d7b6e46663 /docs | |
| parent | 98d6888686aa57b87a2333b1c8761322c5888b65 (diff) | |
| parent | e804d20ff55812dde8640526462f8eb596cd86ba (diff) | |
Merge pull request #2712 from Davide
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/bvh.md | 22 | ||||
| -rw-r--r-- | docs/models.md | 17 |
2 files changed, 38 insertions, 1 deletions
diff --git a/docs/bvh.md b/docs/bvh.md index 5c214ad6d..2da342293 100644 --- a/docs/bvh.md +++ b/docs/bvh.md | |||
| @@ -404,6 +404,28 @@ python -I tools/bvh_geometry_check.py <dehydrated.bin> --geom <vertices.f32>[,<i | |||
| 404 | python -I tests/test_bvh_geometry_check.py | 404 | python -I tests/test_bvh_geometry_check.py |
| 405 | ``` | 405 | ``` |
| 406 | 406 | ||
| 407 | `tools/bvh_match.py` finds the drawable geometry a dehydrated BLAS was built from, on top of `rpf9dump`'s model | ||
| 408 | export rather than a second decoder. It reads the leaf signature (triangles per geometry index, a leaf that holds two | ||
| 409 | primitives counting as two), keeps every (drawable, model) of a `rpf9dump models` manifest whose per-geometry triangle | ||
| 410 | counts contain that signature as an ordered subsequence, and checks the survivors with | ||
| 411 | `tools/bvh_geometry_check.py` from the model's exported OBJ and the 3x4 at `+0x50` of the instance descriptor. The | ||
| 412 | geometries of the two shaders the BVH leaves out are filtered with `--skip-shaders`: those name hashes are game data, | ||
| 413 | as §4a says, so the rule is off unless the user passes them. A geometry whose shader index the manifest cannot resolve | ||
| 414 | keeps its place and the checks decide. Measured on the ten BLAS of the sample pack, against one 1 GiB window of | ||
| 415 | `levels.rpf`: 1,228 models exported, 1 to 374 candidates from the signature per BLAS, and exactly one consistent | ||
| 416 | candidate each. | ||
| 417 | |||
| 418 | `rpf9dump models` and `rpf9dump textures` take `--start`/`--length` to export a window of a file. A window need not be a | ||
| 419 | valid archive - a slice of `levels.rpf` cut at an offset has no `9FPR` header - because both modes read every resource | ||
| 420 | from its own compression blocks; a sub-range is never written to the index cache, which describes a whole file. | ||
| 421 | |||
| 422 | ```powershell | ||
| 423 | dotnet build tools/rpf9dump/rpf9dump.csproj -c Release | ||
| 424 | dotnet tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll models <levels.rpf> <out> --start 3221225472 --length 1073741824 | ||
| 425 | python -I tools/bvh_match.py <dehydrated.bin> <out>/levels/models/manifest.json --descriptor <instance208.bin> [--skip-shaders H,H] | ||
| 426 | python -I tests/test_bvh_match.py | ||
| 427 | ``` | ||
| 428 | |||
| 407 | ## 7a. Building runtime BVHs: `tools/xdxr_bvh.py` | 429 | ## 7a. Building runtime BVHs: `tools/xdxr_bvh.py` |
| 408 | 430 | ||
| 409 | The Vulkan layer has to write acceleration structures in this runtime layout, because the game's traversal shaders | 431 | The Vulkan layer has to write acceleration structures in this runtime layout, because the game's traversal shaders |
diff --git a/docs/models.md b/docs/models.md index 42fe87aba..026ccd998 100644 --- a/docs/models.md +++ b/docs/models.md | |||
| @@ -259,7 +259,7 @@ failures, no duplicate model names, and 2.22 billion triangles (1.95 billion bef | |||
| 259 | ## How the exporter works | 259 | ## How the exporter works |
| 260 | 260 | ||
| 261 | ``` | 261 | ``` |
| 262 | rpf9dump models <archive.rpf> <outdir> | 262 | rpf9dump models <archive.rpf> <outdir> [--start BYTES] [--length BYTES] |
| 263 | ``` | 263 | ``` |
| 264 | 264 | ||
| 265 | `FindCandidateOffsets` scans 4 MiB blocks for a page-aligned 16-byte zero prefix followed by a zlib | 265 | `FindCandidateOffsets` scans 4 MiB blocks for a page-aligned 16-byte zero prefix followed by a zlib |
| @@ -268,6 +268,15 @@ a drawable or fragment header (`RageModelDecoder.LooksLikeResource`). `RecoverAt | |||
| 268 | the following zlib blocks, splits the inflated bytes into the system segment and the graphics | 268 | the following zlib blocks, splits the inflated bytes into the system segment and the graphics |
| 269 | segment, probes the extents, and calls `RageModelDecoder.Decode`. | 269 | segment, probes the extents, and calls `RageModelDecoder.Decode`. |
| 270 | 270 | ||
| 271 | `--start`/`--length` scan one window of the file instead of the whole archive. Neither `models` | ||
| 272 | nor `textures` needs the archive directory: the entry list comes from this run's scan or from the | ||
| 273 | index cache, and every resource is read from its own compression blocks | ||
| 274 | (`tools/rpf9dump/Segments.cs`). A window is therefore a raw slice - a copy of `levels.rpf` from an | ||
| 275 | offset, which has no `9FPR` header - and the scan covers exactly the slice. A sub-range is never | ||
| 276 | written to the index cache, which describes a whole file; the manifest records `Scan.Start` and | ||
| 277 | `Scan.Length` for it. One measured 1 GiB slice of `levels.rpf`: 1,228 models scanned, recovered, | ||
| 278 | decoded and exported in about 2 s (497 MB of OBJ and manifest). | ||
| 279 | |||
| 271 | To locate a named drawable before decoding, `tools/rpf9_names.py` indexes the measured | 280 | To locate a named drawable before decoding, `tools/rpf9_names.py` indexes the measured |
| 272 | `name.#dr`/`#ft`/`#dd` spellings in bounded zlib prefixes without the encrypted TOC; see | 281 | `name.#dr`/`#ft`/`#dd` spellings in bounded zlib prefixes without the encrypted TOC; see |
| 273 | [resource_names.md](resource_names.md). | 282 | [resource_names.md](resource_names.md). |
| @@ -278,6 +287,12 @@ For each returned entry, `tools/rpf9dump/Program.cs` reads the segments, splits | |||
| 278 | offset, OBJ name, model name, mesh/vertex/triangle counts, fragment and bone-binding flags, bounds, | 287 | offset, OBJ name, model name, mesh/vertex/triangle counts, fragment and bone-binding flags, bounds, |
| 279 | per-mesh shader indices, embedded textures, and material texture references. | 288 | per-mesh shader indices, embedded textures, and material texture references. |
| 280 | 289 | ||
| 290 | Three arrays describe the geometries one by one, in the same order as the OBJ's `o` groups: | ||
| 291 | `MeshTris` (triangles), `MeshModels` (the position of the model in the drawable's primary-LOD model | ||
| 292 | list) and `MeshGeoms` (the position of the geometry in that model). That pair is the geometry index | ||
| 293 | a dehydrated BLAS leaf stores ([bvh.md](bvh.md) §4a), which is what `tools/bvh_match.py` matches on; | ||
| 294 | `MeshShaders` maps each geometry to its entry in `Materials`, and therefore to its shader name hash. | ||
| 295 | |||
| 281 | The manifest has no failure, skip, or layout fields. `Program.cs` increments `fail` only when a | 296 | The manifest has no failure, skip, or layout fields. `Program.cs` increments `fail` only when a |
| 282 | model entry returned by the carver fails `RageModelDecoder.Decode`; `skip` is not used in models | 297 | model entry returned by the carver fails `RageModelDecoder.Decode`; `skip` is not used in models |
| 283 | mode. A printed `fail=0 skip=0` therefore means "no decoded entry failed", not "nothing was | 298 | mode. A printed `fail=0 skip=0` therefore means "no decoded entry failed", not "nothing was |