Fix model track-group movement and RGB destination-alpha blending

This commit is contained in:
shen
2026-09-30 08:13:29 -07:00
parent f345bd5d3b
commit 905f23f135
16 changed files with 367 additions and 72 deletions
@@ -0,0 +1,25 @@
# Bear animation group binding
40250 `EterGrnLib/ModelInstanceUpdate.cpp::UpdateTransform` delegates to
`GrannyUpdateModelMatrix`; that gameplay caller remains unchanged. ModelInstanceMotion
binds controls through `GrannyPlayControlledAnimation`.
The real packed bear model is named Bip01. Both `bear/02.gr2` (walk) and `03.gr2`
(run) contain Hedra first, Bip01 second. Hedra has zero accumulation; Bip01 has
the translation in the corresponding unchanged MSA (-93.25 and -299.89 Y).
The previous adapter exposed a count of two with one public group pointer, flattened
bone binding across groups, and always accumulated the first group's translation.
The reader now preserves each group's name, placement, accumulation, text tracks,
and flattened-track range. Runtime controls match the model name, excluding morph
groups, and use only the selected group for bone binding and root accumulation.
`tests/port/port_granny_root_motion_test.cpp` loads those assets through PackBackend
and the runtime APIs used by the live client. It checks both public groups, rotated
root displacement across a loop boundary, inverse displacement, and stationary Hedra.
The same test linked with HEAD's previous GrannyRuntime fails six assertions; the
updated runtime passes. Desktop and `MT_TEST_MOBILE=1` login-flow regressions pass.
Native macOS renderer and Android debug APK builds pass.
This is narrow evidence for constant-extracted motion. VDA extraction and complete
Windows Granny output equivalence remain unverified; the aggregate contract stays PARTIAL.
@@ -0,0 +1,36 @@
# Assassin gungsin / 魅影 destination-alpha blending
The original skilldesc identifies 魅影 as skill 32, gungsin. The unchanged PC/PC2
MSA files attach gungsintanyeong start/end/blow effects. Base and grade-four start/end
MSE particles use SRCALPHA (5) / DESTALPHA (7), with MODULATE color operation.
EffectInstance and ParticleSystemInstance match the reference except include casing;
their state order, emission, asset colors, and textures remain unchanged.
RecordingDevice exposes an X8R8G8B8 back buffer and R5G6B5 GPU shadow targets.
Both have implicit destination alpha 1. Vulkan stores the scene in RGBA and the
previous pipeline incorrectly used the stored, draw-modified alpha for DESTALPHA.
This attenuated the background, including zero-alpha opaque scene pixels.
`src/host/blend_state.h` normalizes DESTALPHA to ONE, INVDESTALPHA to ZERO, and
SRCALPHASAT to ZERO for RGB targets before creating the Vulkan blend pipeline.
Ordinary source-alpha, additive, and color blend factors remain unchanged. This
helper applies only to the currently supported recorded RGB targets; future actual
alpha render targets must retain their own destination-alpha semantics.
Focused CTest `host.blend_state` passes. The GPU regression command is:
```sh
python3 tests/host/rgb_target_blend_test.py build/native/src/port/host_blend_state_test build/release/src/host/mt_native_render
```
It draws an opaque zero-alpha background followed by a SRCALPHA/DESTALPHA overlay,
reads the native renderer's BMP pixel, and checks RGB (128,128,160). The old native
executable fails with (0,64,128); the updated executable passes. This exercises
actual Vulkan blending, not just the mapping helper.
Native fake-server skill inspection used `--py-exec` to select the main instance,
set assassin race 1 and armor 0, then `chr.PushOnceMotion(chr.MOTION_SKILL+2,0.0)`.
Screenshots at 8 and 30 frames show bright particles and were inspected. These
timed screenshots are not a deterministic Windows visual oracle. Android debug
APK builds successfully; physical Android GPU and live-server skill-grade checks
remain unverified. The aggregate render contract stays PARTIAL.
+2
View File
@@ -642,3 +642,5 @@
{"date": "2026-09-30", "unit": "UserInterface/UserInterface.cpp", "action": "port", "evidence": "ApplicationSetErrorString/ApplicationStringTable_Initialize verbatim + port.app_loop; Main ADAPTED to PythonBoot; Win32 entry/launcher options N_A"}
{"date": "2026-09-30", "unit": "ScriptLib/PythonUtils.cpp", "action": "port", "evidence": "already verbatim (udiff: MSVC cast + perf counters); mapped"}
{"date": "2026-09-30", "unit": "ScriptLib/Resource.cpp", "action": "port", "evidence": "verbatim 40250 (was a rewrite that also registered .png); ctest 29/29, screenshot unchanged"}
{"date": "2026-09-30", "unit": "EterGrnLib/ModelInstanceUpdate.cpp", "action": "fix-platform-adapter", "evidence": "2026-09-30: native Granny adapter now selects the model-named track group, preserving all group metadata and limiting bone binding to that group. Real packed bear walk/run (auxiliary Hedra before Bip01) fail with the previous runtime and pass in tests/port/port_granny_root_motion_test.cpp. See audit/evidence/2026-09-30-bear-root-motion.md."}
{"date": "2026-09-30", "unit": "EffectLib/ParticleSystemInstance.cpp", "action": "fix-platform-adapter", "evidence": "XRGB destination alpha semantics fixed in Vulkan pipeline; focused mapping + GPU pixel regression; original particle logic unchanged; desktop/mobile login regressions and Android build pass."}
+13 -4
View File
@@ -1902,9 +1902,13 @@
"project/mob_view_test.gd",
"project/motion_event_payload_test.gd",
"project/motion_registry_test.gd",
"project/hit_view_test.gd"
"project/hit_view_test.gd",
"tests/port/port_granny_root_motion_test.cpp"
],
"last_test_result": "PASS: PC playersettingmodule motion registry (registration order/weights), HORSE parent fallback, knockdown/stand-up early-return, MSA MotionDuration authority, LoopData skill timing, motion event payloads, and hot clip/MSA cache reuse regressions passed; NPC/full RaceData/event-consumer parity remains PARTIAL"
"last_test_result": "PASS: PC playersettingmodule motion registry (registration order/weights), HORSE parent fallback, knockdown/stand-up early-return, MSA MotionDuration authority, LoopData skill timing, motion event payloads, and hot clip/MSA cache reuse regressions passed; NPC/full RaceData/event-consumer parity remains PARTIAL",
"commands": [
"2026-09-30: ctest --test-dir build/native -R port.granny_root_motion --output-on-failure PASS; HEAD GrannyRuntime linked against the same packed-asset test FAIL (zero root displacement). audit/evidence/2026-09-30-bear-root-motion.md"
]
},
"remaining": [
"扩展已接入的 PC playersettingmodule registry 快照,对比 NPC motlist、horse/wedding/skill 的每个 motion key 和缺失 key 失败语义",
@@ -3860,9 +3864,14 @@
"project/motion_event_payload_test.gd",
"project/motion_event_visibility_test.gd",
"project/net_world_motion_event_test.gd",
"project/motion_event_warp_test.gd"
"project/motion_event_warp_test.gd",
"tests/host/blend_state_test.cpp",
"tests/host/rgb_target_blend_test.py"
],
"last_test_result": "PASS"
"last_test_result": "PASS",
"commands": [
"2026-09-30: host.blend_state PASS; python3 tests/host/rgb_target_blend_test.py build/native/src/port/host_blend_state_test build/release/src/host/mt_native_render PASS (128,128,160); previous executable FAIL (0,64,128). Native gungsin motion screenshots inspected; Android APK build PASS. audit/evidence/2026-09-30-gungsin-blending.md"
]
},
"remaining": [
"type 4/6 的生产分支和专用字段消费;type 9 WARP 已接入但远端目标生命周期仍待 live 验证",
@@ -56,7 +56,8 @@
"status": "PORTED",
"impl": [
"src/port/EffectLib/EffectInstance.cpp:CEffectInstance::OnRender"
]
],
"note": "2026-09-30: reference statements remain verbatim apart from include case. Native Vulkan adapter now interprets destination alpha as 1 on recorded X8R8G8B8/R5G6B5 targets; gungsin start/end particles use SRCALPHA/DESTALPHA. Focused mapping and actual GPU pixel regression fail before/pass after. See audit/evidence/2026-09-30-gungsin-blending.md."
},
"CEffectInstance::SetGlobalMatrix": {
"status": "PORTED",
@@ -44,7 +44,8 @@
"status": "PORTED",
"impl": [
"src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::OnRender"
]
],
"note": "2026-09-30: reference statements remain verbatim apart from include case. Native Vulkan adapter now interprets destination alpha as 1 on recorded X8R8G8B8/R5G6B5 targets; gungsin start/end particles use SRCALPHA/DESTALPHA. Focused mapping and actual GPU pixel regression fail before/pass after. See audit/evidence/2026-09-30-gungsin-blending.md."
},
"CParticleSystemInstance::OnSetDataPointer": {
"status": "PORTED",
@@ -20,7 +20,8 @@
"status": "PORTED",
"impl": [
"src/port/EterGrnLib/ModelInstanceUpdate.cpp:CGrannyModelInstance::UpdateTransform"
]
],
"note": "2026-09-30: native Granny adapter now selects the model-named track group, preserving all group metadata and limiting bone binding to that group. Real packed bear walk/run (auxiliary Hedra before Bip01) fail with the previous runtime and pass in tests/port/port_granny_root_motion_test.cpp. See audit/evidence/2026-09-30-bear-root-motion.md."
},
"CGrannyModelInstance::Deform": {
"status": "PORTED",