Capsules (skill / aura pickups)

Decoded from the Store build 1.3.25854.2 executable (addresses are its virtual addresses, image base 0x140000000) and Assets/Data/Map/st00.alr, the “system” stage that no arena uses directly. Read with Esper-RE’s ALR layout (models, materials, elements) plus our vertex-format notes below. converter/capsuleconv.py exports them (below).

Meshes. st00 models 4–12 are the capsules: each a sphere of radius 4.5 units (0.45 m) plus one or two shells (thin bands just at the sphere’s silhouette, r ≈ 4.4–4.8, the bright rim). Model 1 is a 20×20-unit quad with shader vkcolanim (the glow quad). The capsule shader names (vkCAP*, encoded as in every material) occur only in st00.

Orientation and size (branch effectfix). Each mesh hangs on a joint of the model’s skeleton chunk (0x3; joint = 0x40 bytes: pos, Euler rot, scale, then u16 flags at +0x24, u16 track at +0x26, s16 parent at +0x2A). The skeleton handler (0x140296190, chunk type 3 of the model draw table 0x140410608) builds each joint’s matrix from the parent’s and, for flag 0x200, replaces its rotation with the camera’s (the transposed view rotation at 0x1405a5ca0, unscaled): a billboard. In st00 the rims/shells of every capsule and the cores of models 4, 11 and 12 carry 0x200 (flags 0x204); the cores of models 5–10 and the sphere shell of model 9 carry only 0x4, so they are not camera-facing. Their world matrix is the capsule object’s +0x90 matrix: identity at the reset (0x14021b3d0), then turned about Y (0x1402906e0, angle units 0x8000 per turn) by slot × 90°; the draw (0x14021b840) only writes its translation (the slot position). There is no scale on the way: the reset matrix has none, every capsule joint’s bind transform is identity (pos 0, rot 0, scale 1), and st00 holds no animation chunks (0x5), so nothing animates the joints (the draw also samples its animation at time 0). The capsule is drawn at its mesh size: core radius 4.5 units. capsuleconv writes the flag per layer as "billboard".

Near-camera fade (0x140196c40, called by the draw with the object’s +0x78 and the slot position). Per viewing player an alpha byte at +0x78 + viewer·4 (reset 255) and a threshold at +0x80 = 100.0, compared with the squared distance from the camera position (0x14058bdf0, written by the camera code at 0x14012c144) to the capsule: within 10 units the alpha drops by 16 per call, otherwise it rises by 16, clamped to 0..255. Camera state 0x1404bc950 == 0 forces 255. At 0 the capsule is not drawn; at 255 it is drawn plainly; in between the draw sets the item flags 0xed000021 | alpha << 8 (blend bit 0 and stipple bit 5 both set, so the blend-colour override of the bind is skipped).

Stipple (the vkCAP* and stage pixel shaders’ StippleBuffer, 32 u32). The pixel shader discards pixel (x, y) unless bit (x & 31) of u32 (y & 31) is set. The bind (0x1402a5f60) enables it (render state 0x53) for items with flags & 0x21 == 0x21 and uploads 32 u32 from the table at 0x14057f420: level = (flags >> 11) & 31 = alpha >> 3, u32 index level·96 + a row offset. The table is built once at device setup (0x140292780): three blocks of 32 rows per level; for each block, levels 31 down to 0, start with all 1024 bits set, then while more than level² bits are set, clear the n-th set bit (in bit order), n = (rand() · bits left) >> 15. Each frame (0x140292d10) the row offset becomes (offset + 20 + (rand() · 31 >> 15)) & 63. rand() is the shared C runtime generator (see Deck), so the exact bit positions depend on its state at boot; the counts (level² of 1024 pixels) are fixed.

Which model. The capsule object (vtable 0x14048cae8, draw method 0x14021b840) picks an entry of the system model table at 0x140530390 (16-byte entries {model, animation}; the loader 0x1401d9510 clears 24 + 120 of them; INFERRED that it is filled from st00 in file order, the counts match, the fill loop at 0x1401d9254 wasn’t traced):

A child object at +0xd0 (vtable 0x14048cb20, draw 0x14021ba60) draws model 1 while the capsule is up (states 1/2) and model 0 while it waits, in the type color from the u32 table at 0x1402dca00 (one per type, RGB only, the high byte replaced by the owner == viewer flag). The HUD’s capsule icons (0x140151bfa) map the type through a second table at 0x1402f1278.

Slots. Per player 3 capsule slots of 0x48 bytes at 0x140584f80 + 0xd08 + (player·3 + k)·0x48: +0 player, +4 slot, +8 position f32[3], +0x14 state, +0x18 timer, +0x1c refill time (420 ticks), +0x20 skill id, +0x40 render object. Create 0x14021b270, reset 0x14021b3d0 (initial spin = slot × 90°), events 0x14021b4f0.

Placement (the rebuild: player.gd _orb_spot, points from layout.json spawn_sets[].players[].points). At battle start (0x14014ee70 / 0x14014f0f3, also 0x140148cb3) capsule k of a player sits at the player’s start record (CP00, 0x50 bytes) +0x14 + k·0xC, i.e. the three extra points of “Start positions”: ahead of the start along its facing, ~50 units apart, at start height. The start record index is (player + a per-match offset) mod the set’s count. The slot keeps that point unchanged (0x14014f0f3 copies the start record’s point to slot +8; no floor test), and the refill dust and the capsule are drawn at it. On st03 the points sit 9.5..12.9 units above the floor under them (converted collision); the dust’s rings are centred on their joints (all at the origin) and reach about 10 units down at full scale, so the forming sphere rests on the floor. (The rebuild drew the dust at the floor-snapped spot, which buried its lower half; it now uses the point as is.)

Deck, draw and slot states (branch capspawn; the rebuild: arsenal.gd, pd_rand.gd). Deck block at 0x140584f80: per player p a 100-int deck at +p·0x190 (only the first 30 are used), a second 100-int array at +(p+4)·0x190 set to −1 at battle start, the draw pointer at +0xC80 + p·4, a flag at +0xCC0 + p·4 (1 = this player’s deck is dealt locally), three preset cards at +0xCD0 + p·12 (filled from network messages when the flag is 0).

Refill: the capsule forming out of dust (branch capsuleform; the rebuild: converter/capsuleformconv.py, godot/scripts/combat/capsule_form.gd, arsenal.gd). Not an .eft effect: a system model with a joint animation, drawn by the slot’s child object.

Shaders (vkCAP*_ps.cso, disassembled like the stage shaders; t = texture slot, vc = vertex color):

Draw state (material bind 0x1402a6010; material record of the .alr material chunk): flags u32 at +0x0C: bit 4 = blend on, bit 9 = depth write, bit 7 = no cull (else cull back, 0x901), bit 2 = specular on; blend word u16 at +0x14 (high byte = src, low = dst factor, D3D numbering); texture indices u16 at +0x18/+0x1A/+0x1C and +0x1E = t3; specular bytes +0x34..+0x37 (B, G, R, power-ish w). Capsule cores: flags 0x0D (opaque, no depth write, culled, specular). Shells: flags 0x10011, one/one. Alpha-kill (PS cb0[23], texture-stage state 11 in setter 0x140020c40) is only set by HUD code (0x14011f…), so off for capsules. Address mode wrap (states 0/1 = 1); the vkCAP binds set linear filters (states 3/4 = 2). Textures are sampled raw (no sRGB conversion).

Depth and draw lists (capsuledepth). When a draw item is queued (0x140295616..0x1402957c7), bit 3 of its material flags picks the list: set (capsule cores, 0x0D) -> the per-shader bucket lists (256 buckets in shader registration order, items in queue order, flushed by 0x140298a90), drawn right after the frame sets depth test + write with LEQUAL (0x1401c7cd4 -> 0x14028e390); clear (the glow and the shells, 0x10011; the vkCAP04M4 core, 0x10001) -> a list kept sorted by a per-item key and drawn after the buckets. The material bind changes the depth state only for blended materials (flags bit 4; then bit 9 set: test + write, else test on, write off via 0x1402066a0), so the cores write depth like the stage and the glow and shells are depth-tested without writing. The material bind of the vkCAP04M4 core (0x10001, bit 4 clear) does not change the depth state; its own per-item draw function is untraced (UNTRACED: it may set depth itself). Each keyed-tree flush (0x140298e40, 0x140298f70, 0x1402990a0) sets depth test + write (mode 3, cached at 0x14054c9f8) once before its walk; the walk loop itself sets no depth state per item (the per-item draw functions it calls are untraced). If they don’t either, vkCAP04M4 writes depth only while no blended item has been drawn earlier in the same tree that frame; after one (a shell or glow, mode 2) it is test-only. Godot draws it test-only always (INFERRED: the usual case, since the key order is not decoded). Result: a near core hides the far capsule’s core, shells and glow; a capsule’s own glow only shows around its silhouette (as in Xbox footage). INFERRED: the queue reads the flag byte through a pointer whose record is not traced, and the sort key is taken as camera distance, far to near.

Core math (vkCAP02 / vkCAP02M2; PS c0 = (0, 0, 1/124, 0.5) at 0x1402f8790): n = 2(t1 − .5) + 2(t2 − .5), n += (1 − n·n)·n·0.5; k = S'·n + 0.5 (cS1_COLp.w); hemi = sat(sat(k)·sky + (1 − k)·ground); lit = sat(sat(L'·n)·cDL_COL)·va + hemi·va; spec = sat(va·cSPECULAR·sat(n·H')^8); out = lit·t0 + spec, alpha c0.z. The vertex shader builds the tangent-space light, hemisphere axis and half vector h = normalize(normalize(eye − p) − L) as (v·T, v·B, −v·N), packed ×0.5 + 0.5; T, B, N from the vertex (formats 0x03 / 0x1D: normal @12, tangent @24, binormal @28, signed 11:11:10). Lights (0x1402a7880, slots filled by 0x1402a7a00 from the globals 0x14057f3d0..e8, default 0x1405ad9d0): light[1] → c3 cDL_COL; light[0] → c6/c7 sky / ground (w 0.5); light[2] → c5; c2 cSPECULAR = bytes (+0x36, +0x35, +0x34) × light rgb × 2/255 (0x1402f7c68), w = byte +0x37 (via 0x1402a75e0). Model 4’s core is a billboard with its pole toward the camera. (capsuleview) The eye (VS c15, named cEYEPOS in the shader’s reflection data) is written together with c14 by 0x1402a58a0, which every model draw calls with the joint matrix it also uses for c20 (e.g. 0x14029c11b): it multiplies that matrix by the view matrix (0x1405a5ca0) into P and stores c15 = (−(t·P_row0), −(t·P_row1), −(t·P_row2), 1) with t = P’s translation row, i.e. the camera position in the joint’s own frame (the inverse of a rigid matrix; exact for the capsules, whose matrix has no scale), and c14 = P’s third column with w = the draw’s float argument + a constant (not used by the vkCAP shaders). For a billboard joint the matrix is the billboarded one, so the eye, like the light, is fixed in that frame. The Godot shader’s eye, the camera origin through the inverse model-view, is the same point. The light values are stage light set 0 (see “Stage light script”, light records), with the vectors in the game’s order.

Normal maps of the cores (capsulelook-fix2). The two bump textures (t1, t2) are texture format 0x0C, which the exe’s format switch (0x1400bcb27) creates as BC1 (DXT1, DXGI format 71) and uploads as stored: no channel swap, no conversion. pdconv’s DXT1 decode matches the raw blocks texel for texel. The pixel shader reads them as plain RGB, maps each channel with ×2 − 1, adds the two maps and renormalises the sum with one Newton step using c0.w = 0.5 (0x1402f8790, read). It does not rebuild z from x and y, and the sum is not clamped. The maps are not the usual pale-blue ones: in the 64² and 128² maps the texels lie close to the line red + green ≈ 1 and blue is near 0 (a few texels reach about 0.5), so one map decodes to about (s, −s, −1) and the sum’s z is near −2.

Why the cores shade the way they do (capsulelook-fix, corrected in capsulelook-fix2). The vertex shader packs the light as (−L·T, −L·B, L·N), with L the record’s vector (the direction the light travels) and T, B, N the raw model-space vertex vectors. So with the bump n = (a, b, c) the directional term is sat(−L · (a·T + b·B − c·N)): tangent-space z points into the surface, and a map texel with blue ≈ 0 (c ≈ −1) is an outward normal. The unclamped sum has n·n ≥ 4. Wherever n·n > 3 the renormalising factor 1 + (1 − n·n)/2 is negative, so the step turns the normal inward. Over random pairs of texels from the two maps that is about two thirds of the pairs, and the mean directional term for a light straight onto the surface is about 0.14 instead of about 0.55 when the sum is held in [−1, 1]. The hemisphere term k = n·S + 0.5 flips the same way. That gives the dark, patchy cores and their hard lit/unlit patches, with the lit patches often on the side away from the light. The PC shaders do this as decoded. It is not a converter error, and the PC build is drawn this way. The light record’s vectors are uploaded unchanged (0x1402a7490; the record’s +0x20 is a start-up copy of the script’s vector), and the vertex data is in model space (c20 = matrix-stack top × view-projection, 0x1402a57c0), so the light works in the object’s own frame. Two things make the shading move as the camera turns, and neither is a separate fresnel or rim layer. (1) The specular term (n·H)⁸ uses the half vector between the light and the direction to the eye, per vertex: on the cores that are not billboards (models 5–10) it is the only view-dependent part. It is bright where the bumped normal faces between eye and light and falls off towards the silhouette, where the surface turns away from the eye, so the rims look darker and the bright patches slide as the camera moves (red: specular bytes R 159, G 52 on model 5). (2) The billboard cores (models 4, 11, 12) turn with the camera, but the light turns with them (object frame), so their diffuse and hemisphere patches stay put on screen; only the specular term and the scrolling maps move. The vertex alpha multiplies the whole lit colour; on model 4 it falls to about 0.1–0.25 at both poles, so the centre of the camera-facing disc is darker (the dark swirl centre).

UV scroll: c90/c91 = frame counter (0x14057f398, +1.0 per call at 0x1401c77fc in 0x1401c7630, wraps at 4e6) × element floats, + offsets. vkCAP02/02M2 (0x14023c440): raw_f[4..9], c91.zw = 0, no offset. vkCAP04M4 (0x14023d210): raw_f[4..11]. vkCAP01 (0x14023bf80): 8 speeds + offsets. vkCAPM2A and M2MM2/M2AM2 (0x14023cc80): 4 speeds + offsets. Offsets: the floats at element body +0x30..+0x4C, then raw_m[0..3]. The M2A draw (0x14023c760) re-billboards its matrix. INFERRED: the counter steps 30 times a second.

Glow (vkcolanim, model 1): PS sat(t0(uv)·t1(u, uv2.y)·c0.rgb), alpha c0.w = 1/255. Draw 0x140235820: when raw_f[2] == 1 the colour is [0x140533488]+0x48 and the time [0x14057f41c]; a colour with high byte 0 (not own) draws white with blend 0x3001 (zero/inv_src_color, darkening). u = max(0, time − raw_f[1]) / (raw_f[0] − raw_f[1]) (st00: raw_f = 60, 0, 1). The caller 0x14021ba60: states 1/2 → model 1, colour = type colour | own << 24, time = object +0x90 (reset at state 1, 0x14021ba54, +1 per update, 0x14021ba48); state 0 (refilling) → model 0 with time (refill − timer)·420/refill. tex_003’s top row is a flash (0 → 1 by u ≈ 0.15, fading to ~0 at 1). INFERRED: u clamped (t1’s address mode not confirmed: neither the draw nor the material bind sets sampler states 0/1), VS c0.x = 0. (capsulelook-fix) After the material bind the draw sets the sampler filters itself (0x1402358e1..0x140235942): stage 0 linear (states 3/4 = 2, mip state 5 = 1), stage 1 (the flash texture) point (states 3/4/5 = 1). Culling is the material bind’s (glow material flags 0x10011, bit 7 clear: back faces culled). The near-camera fade does not reach the glow: the capsule draw sets the child’s draw flag (+0x98 = 1) before its fade test, and only its own model draw runs with the stipple item flags, which it clears again at 0x14021b9be; the child draws in its own pass (0x14021ba60) with no stipple. So the glow stays when the capsule fades out.

Vertex formats (element format byte; offsets in bytes):

Format Size Layout
0x03 32 pos, packed normal@12, uv@16, color@20, tangent@24, binormal@28
0x1D 36 as 0x03 + uv2@32
0x15 24 pos, uv@12, color@16, uv2@20
0x17 32 pos, uv@12, color@16, more uvs @20/24/28
0x09 20 pos, uv@12, color@16

Material entries carry the texture at +0x18, a normal map at +0x1A and a second one at +0x1C (effectconv exports them as normal, normal2).

Converter. capsuleconv.py <st00.alr> <out>/capsule [--exe PDUWP.exe] [--pdconv PATH] (run on the data machine) writes capsule.json (format pd-capsule, version 1: own type → model, enemy {aura, skill}, glow, type_colors read from the executable, and per model its layers: shader, scroll, mesh arrays, extra UV sets, texture names) plus the PNGs those layers use (via pdconv --textures). godot/scripts/combat/capsule_look.gd builds the look from it; orb.gd falls back to its built-in bubble without the directory.

Before this, the capsule was looked for in Assets/Data/System/aura.alr (one 32×32 texture, no model), Assets/Data/Effect/ (eft0600–0609 are the aura wisps around a character, not the capsule) and the effect shaders; none of them is the capsule.