Viewer: wear layers with the colour-range samples and vertex colours; the primer layer behind a switch #305
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/holdmysocks--SixNG!305
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/305/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@holdmysocks on GitHub · 2026-11-25 19:08 UTC · original
holdmysocks:primer-layer→master· +209 −14 · 8 files · 5 commits · merged 2026-11-25 19:43 UTCStacked on #301; merge that first. After it merges, this PR's diff contains only the changes below.
What
Two commits:
The primer wear layer (layer B), behind a switch that is off by default. For each part id, the primer terms from its wear preset go into the coat row of the part ramp image (columns 25 to 33):
primerStart/primerEndwindow;primerPalette, the middle of its low and high values).The shader draws layer B where the first layer is not. The switch is a "primer layer" checkbox, or
--primeron the command line. As in the game, both layers are packed only when v0 > 0.1.The colour-range samples and the vertex colours, for both layers.
Decoded the sample builder (rva 0xc7b660). At load, each colour range record (
3539c333) gets 50 samples, seeded by sample index + record name. Each value islo + rand × (hi − lo):minRed..maxBlue(+0x0c..+0x11)minTile→maxTile(f16)The offsets come from f16 9ded6508 / 5310cf44. As the code reads, a negative offset leaves 0, even though the data mostly stores −0.1.
Both layers now use the middle of their range's samples:
The level per channel is
sat(v_c × (scale × mask + bias))^((1/gamma)²), as in the shader. Columns 34 to 45 hold the bias and gamma values.v_cis the vertex colour: GLB_COLOR0rgb, which is the shader's vA/vB/vC. On the paint parts it is a sparse per-vertex wear mask (mostly 0).For the primer, the first channel is
sat(vA − (vB + vC) × cross).Fix: the primer's own mask is material parameter
640111c6. The shader's texture 19 is material slot 20, in the same way as its texture 10 is slot 11 (b9f4bdac). It is not7bace7bd.Checked
cargo test -p sixng-gui: 36 pass.part_wear_from_the_configurationnow also covers the range middles, bias, gamma and the no-range fallback.Not decoded / not done