Commit Graph
5 Commits
Author SHA1 Message Date
xcdoge 045cc96172 #549:官方场景偏暗 —— 把两个手调增益改回官方语义(直射光 intensity、烘焙光强 lightRange)
问题(#549):3D 棋盘按战场显示官方场景后,整体比官方实机明显偏暗、发闷。只取棋盘区域做量化:官方截图
平均 RGB 152.4/125.8/92.3(亮度 129.0),本项目 98.8/89.4/65.0(亮度 89.7)。

原因:官方场景材质的两个增益是当初照截图手调的猜值(代码注释里自己标了 [ASSUMED]):

  export const SCENE_LIGHT = Object.freeze({ range: 8.0, ambient: 0.2, direct: 0.8, indirect: 0.4 });

而官方数据是(从客户端场景包里 dump 出来的真值,见下):

  scene.json light = { dir: [0.36121, 0.44604, 0.81889], color: [1.0, 0.9312, 0.87131], intensity: 1.1 }
  Light「Mainlight (1)」: m_Type=1(Directional) m_Intensity=1.1 m_BounceIntensity=1.5
  lightRange = 8.0

- direct 0.8 ⇒ 直射光 = lin(color) × (1.1 × 0.8) = 0.88,比官方的 1.1 暗 20%;
- indirect 0.4 ⇒ 烘焙间接光被乘成 lightRange × 0.4 = 3.2,而 lightmap 的语义是"贴图 1.0 = lightRange 的线性光"
  (scenes.py:`L = 5^2.2 · A^2.2 · RGB`,PNG 存 (L / lightRange)^(1/2.2)),所以 indirect 必须为 1 才等于官方烘焙值,
  0.4 等于把间接光压掉 60%。片元里的 `pow(lm.rgb, 2.2) * uLmScale` 与 `uLightColor * N·L * shade` 正是这两项。

改动:`SCENE_LIGHT` 的 direct / indirect 改回 1(= 场景自己的值,与那段注释原本的描述一致),并把注释改成
说明它们为什么必须是 1、以及低于 1 会相对官方渲染变暗(#549)。

实测(同一 m04 场景、同一相机,只取棋盘区域求平均):

  官方截图            亮度 129.0
  改前                亮度  89.7(−30%)
  改后                亮度 103.3(−20%)

顺手排除的两个猜想(都量过,都不是原因):

- 雾:官方 RenderSettings 是 m_Fog = False,而 scene.js 给场景挂了 T.Fog(0x0c1114, 17, 36)。A/B 实测雾开/关
  亮度 95.3 / 95.4 ⇒ 在本视角下没有影响(相机在 near 以内),本次不动它。
- 焦点暗角:官方场景材质也套了棋盘的 focusMask(框外 × uFocusDim = 0.72)。A/B 实测去掉后 103.3 → 106.6(+3%),
  因为本视角的焦点框覆盖了大部分棋盘;官方场景本身没有这种衰减,但它是棋盘的既有玩法表现,留待单独确认,本次不改。

证据来源:`.cache/official-scenes/<version>/scenes/.../level_<stage>.ab` 用 UnityPy(配合 tools/local-extract/aklz4.py
注册的 LZ4AK 解码器)dump 出的 Light 与 RenderSettings;以及仓库自己的 tools/local-extract/scenes.py 里 lightmap 的
RGBM 编码定义。

测试:node --test test/render/board3d-scene.test.js test/render/board3d.test.js test/render/boardart.test.js(见 PR)。
2026-10-12 23:33:58 +08:00
sganggs d482fbb8ba 0.2.5-dev: official battlefield scenes on the 3D board — a local fetch / extract step for the season scene bundles, per-field scene rendering with the metal board as fallback, the full bundle can include the extracted scenes and setup can fetch them (--scenes); nothing official is stored in the repository (PR #533 by @andrew05060414, ported; the owner's decision of 2026-10-12); golden: unchanged 2026-10-12 14:59:20 +08:00
Andrew Wang b92a0bf3c2 local-extract: derive the board normal map from both layouts a client holds — BC5 (R = X) and DXT5nm (A = X, R = 1), read as Unity unpacks them (x = R·A); a client with the older map_autochess bundle got Z = 0 everywhere and a grey 3D board 2026-10-11 19:30:10 -04:00
Cartethyia f6f5ed50cd A special terrain tile explains itself on a tap, and 活性源石 is one material on both boards (GitHub #184) (#185)
Tapping a 活性源石 / 沼泽 / 深水区 / 排气格栅 / gate / teleport tile opens a read-only card with that stage's own terrain numbers (the boss-prep board picks the board tile once, through prepXf.toBoard); the 2D atlas cell and the 3D shader now share one 活性源石 palette and recipe and draw to the tile edge. Contributed by @Convey123.
2026-10-06 14:08:18 +08:00
sganggs 01a44cd288 卫戍协议:盟约 web remake — initial import
Online co-op browser remake of Arknights' Stronghold Protocol: Alliance
(client-simulated combat, official waves/bonds/items/strategies, 3D board,
facing wheel, operator loadout, official emotes, deployment scripts).
2026-09-29 16:21:31 +08:00