Viewer: the paint shader's HSV colour step (albedo multiply / screen, sun bleach) #413
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!413
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-413"
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 21:37 UTC · original
holdmysocks:wear-colour-step→master· +135 −6 · 4 files · 11 commits · merged 2026-11-27 02:01 UTCThe viewer now draws the paint shader's colour step: darkening, lightening and sun bleaching in HSV, with each surface's own amounts. Builds on PR 410 (it includes that branch; merge 410 first).
What the game does (read from the shader, the packer and the library)
Where the bytes come from. The shader reads bytes 1, 2, 3 of surface record +28. The packer (rva 0x37766a0) copies 8 bytes into surface record +24..+31 from the run-time object of a
307f162crecord (object +0x28):2cc72f7clink.174770cclink.The fields. Besides metalness and roughness low and high, a
307f162crecord has three floats. Their name hashes match:sunBleachScreen(d3d2bcd6)albedoMultiply(4b19d0cb)albedoScreen(de1ccc51)These match the shader's use of bytes 1, 2, 3: a bleach screen, a multiply and a screen. Most records hold 0.75, 0.135 and 0.135.
The step (shader 05160 to 0540c):
gr = (1 - paletteWeight) * (2 * (lyr0diffusetex.g - 0.5) + detail).paletteWeightis the share of the colour taken from palette rows: W1·W2 + the primer + the base when it reads a row.V *= 1 - |gr|·mulandS = 1 - (1 - |gr|·mul)(1 - S).V = 1 - (1 - V)(1 - gr·scr)andS *= 1 - gr·scr.sgn:q = sgn · (per-layer dust gains · weights) · bleach,V = 1 - (1 - q)(1 - V)andS *= 1 - q.Changes
vehcolour,export):surface_toneper look: 12 hex digits per part id (bleach, multiply and screen of the first layer, then of the second, ×255 rounded), with a note.Tests
vehcolourtests pass (9). They include new checks oftone_tableand of the per-layer lookup.part_wearandcoattests pass.Not done
detailterm added to the green's offset is not added (0 here).