Recover OMT resources, morph topology, and original engine evidence

This commit is contained in:
UnixNight committed 2026-10-23 17:32:48 -04:00
1 parent d62e2ab4de
commit 3df20ac19a
12 files changed
+1648

No files matched your search

+138
View File
@@ -0,0 +1,138 @@
# Original asset formats
This describes formats recovered from the supplied files and OMT2.dll serializers.
All multibyte OMT metadata is big-endian unless explicitly stated otherwise.
Paths below are relative to `Original/`. See [asset evidence](analysis/assets.md)
for executable addresses, confidence, test results and limitations.
## 0MF2 OMT database
| Offset / field | Representation |
|---|---|
| `0` | ASCII `0MF2` |
| `4` | BE32 absolute resource-index offset |
| Index start | BE32 resource-type count |
| Each type | fourcc, BE32 entry count |
| Each entry | BE32 ID, absolute offset, length; byte Pascal-name length + Latin-1 bytes |
IDs are unsigned on disk; some metadata IDs represent negative signed values.
Offsets point to live resource payloads. Resources can occur in arbitrary order
and an archive can contain obsolete/unindexed allocations. Use the index instead
of blindly scanning magic strings. `0HDR` describes allocation/index bookkeeping
and can overlap the index region. It is preserved, not decoded as a game object.
`mCTy` records per-object metadata; interpretation remains incomplete.
Examples: `omt/level1.omt` index at `0x1ee333`; type counts are 47 `Canv`,
195 `3DSh`, 181 `3DMa`, one `mCTy`, one `0HDR`.
Object links serialize as BE16 boolean; if nonzero, fourcc + BE32 resource ID
follow. All booleans used by these serializers occupy **two** bytes.
## 3DSh / 3DSP version 2
All 2,155 supplied shape payloads use this exact version:
1. `3DSP`, BE32 version (2).
2. Eight BE32 floats (bounds/settings); additional legacy float + BE16 boolean.
3. BE32 vertex count; each vertex three BE32 IEEE-754 floats.
4. BE32 polygon count; variable polygon records below.
5. BE32 color count; each color four BE32 floats.
6. BE32 normal count; each normal three BE32 floats.
Polygon v2:
1. Two BE16 booleans, BE16 legacy field, BE32 ID, two BE32 floats.
2. BE16 legacy field, BE16 corner count.
3. Each corner: BE32 vertex index, float U, float V, BE32 normal index.
4. Three float polygon normal coordinates.
5. BE16 material-present boolean; if true, serialized object link.
Vertices preserve original scale and engine world coordinates. Do not normalize
individual scene shapes or reapply arbitrary transforms. Names can identify
already placed world objects. `3DMa` IDs are local to the source database.
Collision meaning of legacy polygon flags has not yet been recovered.
## 3DMa compact version 1
Every supplied material uses BE16 version 1, followed by BE16 legacy style 0..2,
a float scalar and BE16 flag. Styles 1/2 store four unsigned16 RGB triplets and
another boolean; style 0 stores one triplet. Style 2 adds a boolean, BE16 texture
presence enum and, for enum 1, an object link. Final BE16 field completes record.
Typical textured material length is 52 bytes; untextured variants can be 38/42.
RGB triplets are converted to floats by dividing by 65,535. The output keys
`emission`, `diffuse`, `specular`, `ambient` are inferred conventional roles;
legacy flags are retained with neutral names pending renderer validation.
## Canv / OmCv / OmGW
| Field | Representation |
|---|---|
| Signature | `OmCv` |
| Flags | BE32 |
| Pixel header | `OmGW` |
| Width, height, bit depth | BE16 each |
| Packing unit enum, color-key kind | byte each |
| Decoded row byte stride | BE16 |
| Has color key | BE16 boolean |
| Key | RGB16 triplet for key-kind 0; otherwise BE32 only when key present |
| Has palette | BE16 boolean |
| Optional palette | described below |
| Compressed data size | BE32 |
| Data | one BE16 encoded row length + encoded bytes per image row |
Packing enum 0/1/2 selects RLE units of 1/2/4 bytes. This is a PackBits variant:
control values are **little-endian** signed values of the unit width (the dword
variant tests low signed16 bits). Nonnegative N copies N+1 literal units; negative
N repeats the next unit 1-N times; -128 is a no-op. Encoded row must consume
exactly its advertised bytes and produce exactly the decoded stride.
Pixel values remain big-endian in encoded literal/repeat payloads. RGB555 selects
bits 10..14, 5..9, 0..4 and shifts each channel left three, matching original
conversion. The 32-bit format selects RGB at bits 16/8/0. Both derive alpha from
full stored-pixel equality with the color key; without a key alpha becomes 255.
Palette signature `OPa2` or `OmPa`, Pascal-name, BE32 color count, count RGB16
triplets. `OPa2` additionally stores a 4,096-byte palette accelerator. The original
converter takes low bytes of palette16 values after endian conversion. The twelve
indexed textures all use 8-bit pixels and decode with this layout.
## Wave resources
A `Wave` database entry contains RIFF/WAVE bytes either directly or after an OMT
object prefix. RIFF chunk sizes and WAVE audio format are little-endian. Extraction
finds the RIFF inside its indexed resource and preserves exactly `size+8` bytes;
it checks that the result is WAVE and never crosses the indexed resource boundary.
PCM is reusable by cross-platform audio. One MP3-in-WAVE is retained unchanged
and requires decoding support if that particular resource is played. Surrounding
OMT object metadata may contain playback settings; extracting a WAV does not
recover loop policy automatically.
## ASE source models
`ASE/*.ASE` and `ASE/jimstop.ase` are 3DS Max ASCII export files. Source object
positions are already exported vertex coordinates. Shared original OMT/ASE
objects prove the conversion `(x,y,z) -> (x,z,y)` and UV `(u,v) -> (u,-v)` while
retaining face winding. `MESH_ANIMATION` contains complete vertex samples tagged
with `TIMEVALUE`; scene FPS and ticks/frame establish source sample times.
Some morph-only files omit UVs and can have a different face table from the
original base shape. The original renderer keeps base topology and texture
coordinates while substituting morph vectors by vertex index. Use `--base`
explicitly rather than rendering missing UVs as `(0,0)`. First prepared player
base is `jimstop.ase`, normal runtime atlas is `png/jimycarl.png` (texture slot 0);
`png/jimyshock.png` is a separate effect in slot 1. See InitObject evidence.
## Prepared scene interchange
`scene.json` has `vertices:[[x,y,z]]`, `uvs:[[u,v]]`, `normals:[[x,y,z]]`,
`indices:[uint...]`, and `meshes:[{name,shapeId,firstIndex,indexCount,material}]`.
Vertices are expanded per polygon corner to retain discontinuous UVs and normals.
`materials` retain source IDs, texture links and numeric fields. `textures` give
ID/name/width/height and relative paths to tightly packed row-major RGBA8 bytes
and PNG preview. Source archive filename and SHA-256 establish provenance.
No coordinate or UV convention conversion is applied to already native OMT data.
`animation.json` records source hash, FPS, ticks/frame, frame JSON relative paths,
original TIMEVALUE, morph base provenance and optional original texture metadata.
Frame JSON uses the scene vertex/UV/index schema. Preview normals are currently
flat normals, explicitly marked in the manifest; original smooth shading is pending.