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

+124
View File
@@ -0,0 +1,124 @@
# Original rendering evidence
Static analysis of supplied OMT2.dll / Neutron.exe, 2026-10-23. No rendered
reference frame has been captured yet. All DLL addresses use preferred base
0x10000000; EXE addresses use0x400000.
## API and backend
The supplied DLL implements **Direct3D7 fixed-function rendering over DirectDraw7**
and an **OMT software rasterizer**. This is more specific than readme's DirectX8
runtime requirement: input uses DirectInput8 but rendering uses D3D7 interfaces.
Evidence:
- DDRAW imports DirectDrawCreateEx and DirectDrawEnumerateA; there is no D3D8 import.
- IID_IDirect3D7 `{F5049E77-4861-11D2-A407-00A0C90629A8}` occurs at DLL0x10116E0C;
IID_IDirectDraw7 `{15E65EC0-3B9C-11D2-B92F-00609797EA5B}` at0x10116E1C.
- OMediaDXRenderPort::draw at0x100372A0 calls device vtable offset0x64 (D3D7
DrawPrimitive) with FVF0x152. SetTransform uses offset0x2C and SetRenderState0x50.
- Named exports OMediaDXRenderer/DXRenderPort, OMediaOMTRenderer/OMTRenderPort,
software texture16/texture32 rasterization functions and a CPU pipeline coexist.
- Executable contains renderer labels OPENGL, DIRECT3D HAL and DIRECT3D T&L HAL.
The OPENGL label does **not** prove this supplied DLL implements an OpenGL backend:
no matching GL import/backend exports were found. Do not implement one by assumption.
## Function map
| Preferred DLL VA | Named export / behavior |
|---|---|
| 0x10035D80 | OMediaDXRenderPort constructor |
| 0x10036320 | begin_render, initializes/reuses device state |
| 0x10036560 | end_render |
| 0x100372A0 | draw, translates OMediaRenderVertex vector to D3D vertices |
| 0x100374B0 | draw_shape, polygon/material path |
| 0x10037AC0 | draw_surface, canvas quad path |
| 0x10036AF0 | set_model_view, D3D transform1 |
| 0x10036B10 | set_projection, D3D transform3 |
| 0x1004D650 | OMediaLayer::prepare_projection_matrix |
| 0x1004E650 | perspective projection with symmetric -1..1 clip Z |
| 0x1004E6E0 | perspective projection with 0..1 clip Z |
| 0x1003FC00 | OMediaElement::compute_model_matrix overload |
| 0x1003FF70 | compute_model_matrix overload using parent matrix |
| 0x100EE740 | OMediaViewPort::update_render_ports |
## Vertex formats
OMediaDXRenderPort::draw reads input vertices with **68-byte stride**, converts
them to **36-byte D3D vertices**, and passes **FVF0x152**:
| D3D vertex offset | Contents | OMT input offset |
|---|---|---|
| 0x00 | float3 position |0x00 |
| 0x0C | float3 normal |0x34 |
| 0x18 | packed ARGB diffuse |float RGBA0x10,0x14,0x18,0x1C |
| 0x1C | float2 texture UV |0x2C |
FVF = XYZ0x2 + NORMAL0x10 + DIFFUSE0x40 + TEX10x100. It does not contain
pretransformed RHW coordinates. Source color packing multiplies each channel by
DLL constant0x10114A10 and converts through x87 integer conversion. Primitive enum
mapping in this function and exact polygon triangulation still need examination.
## State translations proven by disassembly
| OMT function | Address | D3D state evidence | Vulkan requirement |
|---|---|---|---|
| enable_faceculling |0x10036570 |CULLMODE22=2 (CW) | Match winding after coordinate/viewport transforms |
| disable_faceculling |0x10036590 |CULLMODE22=1 (none) | Per-material culling flag |
| turn_fog_on |0x100365F0 |FOGENABLE28=1; FOGVERTEXMODE140=3 (linear) | Vertex-derived linear fog compatible with reference |
| set_fog_color |0x10036650 |FOGCOLOR34 | Preserve packed color |
| set_fog_range |0x10036670 |FOGSTART36, FOGEND37 | Float fog distances |
| set_zbuffer_write |0x10036910 |ZWRITEENABLE14 | Pipeline depth-write enable |
| set_zbuffer_test |0x10036940 |ZENABLE7 | Pipeline depth-test enable |
| set_zbuffer_func |0x10036970 |ZFUNC23 | Map each original comparison enum |
| set_blend |0x10036A50 |ALPHABLENDENABLE27 | Pipeline blend enable |
| set_blend_func |0x10036AB0 |SRCBLEND19, DESTBLEND20 | Preserve original factors |
begin_render default setup0x10036484 onward sets CW culling, NORMALIZENORMALS142=1,
LIGHTING137=0, texture stage0 COLOROP1=4 (MODULATE), COLORARG12=2 (TEXTURE),
COLORARG23=0 (DIFFUSE). Thus an unlit texture-times-diffuse baseline is evidence
based; game/material overrides still need full tracing. Lighting, fog and alpha
capabilities in the engine do not prove that every game scene enables them.
## Projection and coordinates
OMT angles are16384 units/revolution. Perspective0x1004E6E0 uses
`s=cot(fov/2)`, matrix entries `m00=s*height/width`, `m11=s`,
`m22=far/(far-near)`, `m23=1`, `m32=-near*far/(far-near)` with other perspective
entries zero except unused m33 initialized1. This is the positive-Z-forward,
0..1 depth form. The alternative0x1004E650 uses `(far+near)/(far-near)` and
`-2*near*far/(far-near)` for -1..1 depth. Matrix storage includes a trailing type
word at+0x40 beyond the16 floats. These are engine constructors; game-selected FOV,
near/far and projection mode remain to be recovered from viewport/layer setup.
The game uses **Y-up** world placement, while exported ASE files are3ds Max
coordinates; don't apply guessed axis changes to OMT geometry. The exact ASE
converter's rotation/UV policy must be confirmed against OMT geometry, not inferred
from application conventions. Vulkan requires handling viewport Y and winding
consistently. No claim of full handedness equivalence is made without a frame test.
## Implementation priorities and remaining evidence
Implement original geometry/UV/material colors, D3D0..1 projection, texture modulation,
depth and material culling/blending first. Add recovered fog and fixed-function
lights as actually required. Do not replace with PBR. Reuse original morph animation
data, not invented skeletal animation. Validate triangle order, UV orientation,
alpha, depth, filtering and camera against original before claiming visual fidelity.
Not yet recovered: complete material enum maps, game-selected sampler modes, light
values, FOV/clips, render sorting, alpha thresholds, animation timing and visual
reference captures. See asset report for archive model/material recovery.
## Projection follow-up
OMediaLayer ctor `0x1004D340`: projection mode3, FOV word+0x78=`0x0AAA`
(59.9853515625 degrees), near+0xC4=20, far+0xC0=3200. Game creates five layers
at `0x47664C` onward. Sky layer global0x509A38 far1,000,000 at `0x47682C`;
geometry globals0x509A30/0x509A3C. CLevel01BGame setup `0x44F5A0` sets far
10000 on both geometry layers. No game FOV writes were found by initial static
search; that is evidence for inherited FOV, not a proof of every possible path.
Primary renderer review additionally recovered null-material skipping and v2
polygon culling flags from DX draw_shape; see `../rendering.md`. The previous
white fallback for unresolved material18 incorrectly rendered invisible lab
proxy surfaces and is fixed. Full material state mapping remains incomplete.