Files
mtgodot-poc/test/shear-bones-survey.md
shenandClaude Sonnet 5 47baf6c0c6 Metin2 game client (P0–P11) + mobile asset pipeline
Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
  phases, EntityStore world model, ~all GC/CG headers. char create/delete,
  private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
  quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
  char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
  token), system-option + game-option + ESC system menu, private-shop 39-grid,
  party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
  dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.

Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.

Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).

ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
2026-08-31 20:02:12 +09:00

38 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Shear-bone survey (Godot GPU-skinning viability)
`tools/anim_probe <model.gr2> <anim.gr2>` — for every bone, the parent-relative
local that would be fed to `Skeleton3D::set_bone_pose`, its shear, and the error
of a `T·R(quat)·S` round-trip (= what Godot's GPU vertex skinning keeps after it
orthonormalizes the bone matrix before upload). High round-trip error = that bone
**collapses on the GPU (Skeleton3D) path once an animation moves it**.
Probed with `pc/warrior/action/dance_1.gr2` (retarget by bone name; unmatched
bones sit at bind, so their numbers reflect the model's rest rig).
| model | shear bones | worst TRS err | worst minDet | GPU-skin viable? |
|---|---|---|---|---|
| `warrior_cheongrin` | **7** (`bone_front_01..04`, `Bone_shoulder_01..04`) | 0.94 | 0.065 (6.5% squash) | ❌ collapses (`dance_1` animates these) |
| `assassin` | 0 | — | — | ✅ |
| `sura_lord` | **16** (`Bone05/06`, `Bone14..27`) | **1.52** | **0.0024** (0.24% squash) | ❌❌ severe |
| `shaman_lord` | 0 | — | — | ✅ |
## Takeaways
- The shear/non-uniform-scale is **baked into the rest rig** of these cloth/plate
helper bones (metrics are constant across the animation clock). Static bind pose
survives because `skin_matrix ≈ I` there; any animation that moves a shear bone
breaks it on GPU skinning.
- **`sura` is unusable on Godot's built-in GPU skinning** — 16 bones, one squashed
to 0.24%. It's a core class, so this isn't a corner case.
- `assassin` / `shaman` are clean — GPU skinning would be fine for them.
- **Done (2026-08-29)**: the custom skinning vertex shader is implemented —
`m2_material.cpp` `SRC_SKIN` does LBS with the full per-bone 4×3 matrices from an
RGBAF texture (`Metin2Model::gpu_skin` fills it each frame), no `Skeleton3D`, no
orthonormalization. `MTGODOT_GPUSKIN=1` now routes here (the old broken
`set_bone_pose` path is deleted). warrior `dance_1` GPU render == CPU render
(`test/compare-shots/*.gpu.png`). CPU LBS stays the default; GPU is for crowds
(Phase 2 bench).
Re-run for a full race sweep (incl. monsters, NPCs, mounts) before Phase 2 to
size the shader work and catch any rig that also needs >4 bone influences.