Viewer: clear-coat loss and the edge bump on worn paint #405
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!405
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-405"
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-26 19:54 UTC · original
holdmysocks:wear-coat-edge→master· +85 −3 · 2 files · 6 commits · merged 2026-11-26 21:17 UTCWorn paint in the viewer now loses its clear coat and gets the game's edge bump. Builds on PR 401 (it includes that commit; merge 401 first).
What the game does (shader and packer, read from the code)
weight × 10 × b/255off the clear coat (shader at 03278 and 0332c). Herebis part record +56 byte 3 =trunc(25.5 × aa7d4fbd), a float of the age record (fe5d32e7+0xf0). The rancher's age records use 0, 1 or 2, so the most worn areas lose their whole clear coat.edge(sat(M_R + M_G + M_B))at each point, withedge(x) = sat((x - start) / (end - start)).0.01 × (edge there − edge here) / (L + 1e-4) × edgeIntensityto the tangent-space normal, only where the levels sum above 0.487f0f4c, linked from the wear preset by7f1fe0a2) is packed by rva 0x1a0d7a0 into part record +40: f16 of edgeIntensity, thentrunc(255 × edgeStart)andtrunc(255 × edgeEnd)in bytes 2 and 3.Changes
part_wearpacks the edge record's intensity, start and end, and the clear-coat loss byte into coat-row columns 69 to 72.wear_level_sumandwear_edge.textureSampleGradsamples, with the derivatives taken in uniform control flow, added in the part's tangent frame.coat.x -= (W1 + W3) × 10 × b/255.Tests
part_wearandprimertests pass (2). A new case checks the edge bytes (0.275 / 0.05 / 0.8 → 70, 12, 204) and the clear-coat byte (2 → 51).Approximations
Not drawn yet
The dust/bleach/scratch mask, and the per-vehicle amounts I[0x220]/I[0x224].