Expand description
GPU skinning shared by the viewer and the game: the ModelSkinLayout vertex attributes, the
bone palette uniform and its WGSL. The original’s NormalSkin_*vs programs blend four bones
from a palette of transforms (tc_transform, c41, four rows per bone).
Constants§
- MAX_
BONES - Bones per palette: the original’s
tc_transformis 208 constants fromc41, four per bone (NormalSkin_vs), so 52; the largest shipped skeleton has 22, a mod’s may have more. - PALETTE_
BYTES - Bytes of one palette (
MAX_BONEScolumn-major 4x4 matrices); a multiple of 256 so palettes can be addressed with dynamic uniform offsets. - SKIN_
WGSL - WGSL for the palette at
@group(2) @binding(0)and the four-bone blend.
Functions§
- palette_
matrices - The palette as
MAX_BONESmatrices (identity padded; extra bones are dropped with a warning). - skin_
layout - The palette’s bind group layout;
dynamicpalettes are addressed per instance by offset. - skinned_
attributes ModelSkinLayout(32-byte vertices): i16x4 position (/512), i16x4 texcoords, unorm8x4 normal, 4 unused bytes, unorm8x4 weights, u8x4 bone indices, at shader locations 0..4.