Characters (Assets/Data/Player/<id>/<id>.alr)
Checked on the reference player character.
Model 0 is the body; model 1 is a small skinned
extra with its own 23-joint skeleton (the lower
back of the jacket) whose root joint sits
exactly on a model-0 joint (the upper back), so
it hangs off that joint. Model 0 also carries
shadow-volume buffers (format 0x07, shader
sshadowch; exported, see “Shadow
volumes”) and aura shells (0x0B,
saura, skipped), one per rigid body
part.
Winding
Skinned buffers (format 0x11, SWBOS) are
wound opposite to the stages: after the Z mirror
their outside faces are clockwise. The game
draws them one-sided; drawn double-sided, the
jacket’s inner lining covers the outer back
panel. pdconv reverses their triangles and
writes those materials
doubleSided: false. (Checked by
rendering with each cull mode: only this one
shows the whole back panel from behind and the
open jacket from the front.)
Vertex
format 0x11 (24 B), from the game’s own
SWBOS_vs.cso
The shader’s input signature is POSITION,
BLENDINDICIES, BLENDWEIGHT, TEXCOORD (no
normal); disassembled with a small DXBC reader
(.work, not in the repo).
| bytes | content |
|---|---|
| 0–11 | position, 3 × f32, already in the bind pose (model space) |
| 12–15 | UV, 2 × s16 / 32767 |
| 16–19 | BGRA8 unorm BLENDWEIGHT: byte
18 = weight 0, byte 17 = weight 1 (they sum to
1), byte 16 picks one of two light-colour
registers, byte 19 = a per-vertex term that
scales specular (low under the jacket and on the
soles) |
| 20–23 | 2 × u16 BLENDINDICIES:
vertex-shader constant registers |
- Skinning: blended matrix =
w0·M[i0] + w1·M[i1]; each M is three registers
(rows of a 3×4,
pos' = dot(row, pos) + row.w). - Registers → joints:
register 96 is the buffer’s own transform (its
transform_idxjoint, an identity placeholder for the body parts); registers 120 + 3k are palette slot k. - The palette is stored per index buffer, after the indices (aligned to 4): u32 0, u32 count, count × u8 joint index (padded to 4), then count × 64 + 32 bytes of matrices (identity in the file; runtime storage). This layout predicts the chunk size exactly for all 7 skinned buffers. Vertices weighted to a slot cluster just past their palette joint’s bind position.
- Model 0 has 6 skinned buffers (legs, torso, head, hair parts, jacket), each with its own palette (up to 22 joints).
Character
shading (SWBOS_ps.cso)
- Texture slot
texture_idxis the colour map. DXT1 alpha is a cut-out. normal_idx(BGRA5551) is an object-space normal map (decoded ×2−1). It is lit by light vectors that the vertex shader brings into bind space through the transposed skin matrix.- The two N·L terms index a 2D ramp texture (slot 3, not in the character file): toon shading. Plus a point light and a specular colour.
Skeleton
(0x3) in glTF
(pdconv --skeleton)
- Joint local transform = T(position) ·
Rz·Ry·Rx(rotation) · S(scale) (Esper-RE’s
transform_from_joint, cglmeuler_zyx). Mirrored into glTF as translation (x, y, −z) and quaternion (−x, −y, z, w). The TRS nodes match Esper-RE’s matrices to 1e-7. - All skinned models’ joints go into one skin.
The reference character has 101 + 23 joints
(armpose 11-14: that is the plain-named
file, which the battle never loads; the variant
files have 115 + 23, see “Pose mixer and the
character file the battle loads”). A
secondary model’s root joint (one with children)
hangs off a model-0 joint: the one whose
nameid equals the root’s id + 0xcb200. Root ids run 0x…9868 + 0x28·k and attach ids 0x…4a68 + 0x28·k, so k looks like an attach slot. In the reference character, model 1 (k = 0) lies exactly on model-0 joint 63. In the second converted character, 7 extra models (weapons, cables) use k = 0–3; two model-0 joints share the k = 0 id, and the nearer one is taken. Those roots sit 0.2–0.34 m from their joint; pdconv keeps that bind offset. As a fallback, a joint at the same bind position is used. The inverse bind matrices are the inverted mirrored bind-pose world matrices. - Joints 0–5 of model 0 are the identity
placeholders the six skinned buffers name as
transform_idx. No vertex has weight on register 96, so they stay unused. - Flag byte
unk1of the joint: 4 marks attach/placeholder nodes (shadow and aura parts hang off them). The other values (16–19, 48–51, 35) aren’t decoded yet.
Character animations (0x5)
- (armpose 11-14: the numbers in this section are the plain-named file’s; the variant files the battle loads have 130 slots and the root at joint 20, see “Pose mixer and the character file the battle loads”.)
- The header’s offset table has one slot per
animation before the first model (129 for a
player character). Esper-RE’s
alr_animations.hlists what each slot is; we only use the slot numbers (idle = 0, run = 12). - Each slot points at a run of 0x5 chunks, one per animated joint of model 0, ended by any other chunk. Translation keys come first, then rotation keys. No chunk has scale keys.
- Keys are absolute local values. They replace the joint’s bind translation or rotation; they are not deltas. That is why Esper-RE’s viewer has to drop the bind rotation of animated joints.
- Key layout: f32 frame + f32 components (sizes 8/12/16), or u8 frame + s16 components scaled by 2π/32767 (sizes 3/5/7, rotations only).
- Which axes a key stores is
in the header bytes Esper-RE calls
unknown_settings3(translation) andunknown_settings2(rotation, value − 7): 0 xyz, 1 xy, 2 xz, 3 yz, 4 x, 5 y, 6 z. Checked by comparing one-component and two-component keys with the joint’s bind position: e.g. code 3 keys equal the bind (y, z), code 5 keys move only the hip height. Missing axes are 0 (see “Key evaluation”; on pc00a the bind is 0 there anyway). - Root motion: the root joint has xz-translation keys (code 2). Idle and run barely move it. PdCharacter drops the track and plays in place (reactions use it as motion). Its index differs per model: joint 6 on pc00a (parentless, xz-only keys in all 129 animations), joint 0 on enm12a0 (parentless, xz-only keys in 127 of 130; its joint 6 is a body joint with xyz keys). PdCharacter.root_bone_of picks the parentless joint with the most xz-only (y = 0) tracks.
- Check:
godot/tests/anim_check.gd. With this convention the lowest foot stays at 0.000 m through the whole idle loop while the hips bob 0.95–0.99 m. In the run, the feet alternate between 0.00 m (contact) and up to 0.2 m. - Frame rate: 30 key frames
per second, decoded (“Animation playback rate”).
pdconv writes times at that rate
(
ANIM_FPS; Esper-RE assumes 24). Idle is 40 frames, run 19 (one stride pair).
Key evaluation (executable)
How the character animation player turns a frame number into joint values (seek 0x296930, evaluate 0x296ce0; our reading, PC exe 1.3.25854.2):
- Header bytes the evaluator reads: +0x08 length (float frames), +0x0C joint (matched to the joint record’s u16 at +0x26, which equals the joint’s index in every pc00a joint), +0x0E rotation key size, +0x10/+0x14/+0x18 translation/rotation/scale key counts, +0x1C rotation key type, +0x1D translation axis code, +0x1E translation key size (0 means 16).
- Key times are frame numbers, no time table and no per-animation fps or duration. Translation keys have a float frame. Rotation types 7–13 have a u8 frame, then u16 angles. Types 1–6 and 0 would have an s16 frame; no pc00a, enm12a0, pc02a or pc06a0 chunk uses them with keys (only types 7, 10–13 do). On pc00a every rotation channel has one key per frame (0..length).
- Rotation type → stored axes: 7 xyz, 8 xy, 9 xz, 10 yz, 11 x, 12 y, 13 z (type − 7 is the same code as translation: 1 xy, 2 xz, 3 yz, 4 x, 5 y, 6 z, else xyz).
- Missing axes are 0 in both paths, not the joint’s bind value. On pc00a and enm12a0 the bind is 0 on every missing axis; pc02a (1 channel) and pc06a0 (10) are the exceptions in the player set, and the event model evpc00a0 has 128 translation channels.
- Angles: one u16 step is a
turn / 32768. The quaternion uses a sine table
of 32768 entries per turn, and its startup code
draws a 64-segment circle by stepping the index
0x200 up to 0x8000. The order is x first, then
y, then z (the same as
gltf_quat_from_euler). - Interpolation: linear in frames between the two keys around the frame. Translations are lerped. Rotations are built as quaternions for both keys, then interpolated (0x28ed60). Past the last key the evaluator wraps (frame − length).
- Playback: each tick adds the play’s rate (+0xC8, 1.0 or the jump’s stretch) to the frame. A play can carry a frame range (+0xD4, +0xD8): once the frame reaches the start it loops between the two, or freezes at the start when they are equal. Every movement play passes −1 (no range), including the jump’s up and down.
- Check:
converter/tests/check_anim_keys.py <alr> <pdconv out>compares every exported channel with these rules (key time = frame / 30, no key dropped, first value with missing axes 0). pc00a 4946 channels, enm12a0 4153, pc02a 4156, pc06a0 5268: no mismatch.