fix(render): match Ngi32 camera matrices

This commit is contained in:
2026-07-18 15:58:24 +04:00
parent fea984ddf5
commit a59f16d6b5
3 changed files with 34 additions and 25 deletions
+22 -14
View File
@@ -1398,13 +1398,14 @@ RVA `0x7030` exactly builds the row-major D3D7 projection from renderer FOV
```text
[ cos(f/2), 0, 0, 0 ]
[ 0, h/w * cos(f/2), 0, 0 ]
[ 0, 0, z/(z-n), sin(f/2) ]
[ 0, 0, -n*z/(z-n), 0 ]
[ 0, w/h * cos(f/2), 0, 0 ]
[ 0, 0, sin(f/2)*z/(z-n), sin(f/2) ]
[ 0, 0, -sin(f/2)*n*z/(z-n), 0 ]
```
The sine in the homogeneous-W term is intentional: after the D3D perspective
divide the diagonal has the expected cotangent scale. RVA `0x9450` applies a
The sine in the depth scale and homogeneous-W term is intentional: after the
D3D perspective divide the diagonal has the expected cotangent scale and the
depth range remains finite. RVA `0x9450` applies a
specific axis permutation/sign change and translated dot products to selector
0 before the view `SetTransform`; it is not merely the generic affine inverse.
@@ -1562,23 +1563,30 @@ hashes промежуточных buffers. Без такой трассиров
[materials](../reference/materials.md), [Texm](../reference/texm.md) и
[render frame](../reference/render-frame.md).
### Live AutoDemo: видимый результат пока не достигнут
### Live AutoDemo: empty frame устранён, но parity ещё не достигнут
Read-only `PrintWindow` capture работающего GOG AutoDemo даёт полноценный
оригинальный кадр (terrain, варбот и близкая geometry), поэтому теперь есть
безвводный source для будущего visual comparison. Текущий полный static-Vulkan
preview нельзя описывать как видимую сцену: хотя он загружает 8 TMA objects,
66 MSH components и 67 descriptors, его изображение состоит только из clear
color. Validation остаётся `0/0`, но это доказывает корректность GPU lifecycle,
а не совпадение с оригинальным renderer.
preview раньше состоял только из clear color. Validation `0/0` тогда доказывал
только GPU lifecycle, но не совпадение с original renderer.
Новая CPU-диагностика применяет к тем же source vertices ту же row-major D3D7
matrix, которую GLSL получает как column-major push constant. Для свежего
captured Ngi32 camera (`viewport 1024x768`, near `5`, far `700`, FOV `1.3`)
она насчитала `clip_visible_vertices=0`. Следовательно, current empty frame не
объясняется texture selection, face culling (baseline state already disables
it) или Vulkan validation: следующий исследовательский шаг — восстановить
точный live camera transform/clip-space boundary.
она насчитала `clip_visible_vertices=0`. Последующая сверка с
`Ngi32!sub_10009450` и `sub_10007030` нашла два literal translation defects:
Y translation view matrix должна быть `-(m23*m22 + m13*m12 + m03*m02)`, а
projection использует `width/height` и множитель `sin(fov/2)` в обоих depth
coefficients. После исправления того же capture диагностировал
`clip_visible_vertices=938`, а `PrintWindow` native Vulkan window показал
реальную rasterized terrain/model geometry. Это исключает прежний empty-frame
барьер; face culling и texture selection не были его причиной.
Получившийся кадр всё ещё явно не похож на оригинал: geometry сосредоточена у
границы и material/terrain representation грубая. Значит, следующие задачи —
camera timing/selection, source model-node transforms, terrain material phases,
lighting и visibility, а не объявление pixel parity.
Параллельно bridge для legacy-camera path теперь переводит только высоту
`Land.msh` в world units с масштабом `1/32`: raw AutoDemo heights