Stickers: texture export by id (sixng stickers) and the sticker zone in the viewer's vertices #172

Manually merged
github merged 9 commits from gh-pr/172/head into gh-pr/172/base 2026-11-26 20:15:14 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 15:51 UTC · original
holdmysocks:claude/livery-textures → master · +152 −3 · 7 files · 9 commits · merged 2026-11-24 16:42 UTC

What

First step of a custom livery editor in the viewer (stickers placed on a vehicle by hand). This PR gives the editor its two inputs; nothing is drawn yet.

  • Sticker textures by id. New command sixng stickers -o <out>: writes <out>/vehicles/stickers.json, the list of every sticker record of the vehicle library and packs (name hash, texture id, the three colours, mask flag, aspect class, and the record's fields as read). With --textures every sticker texture is decoded to <out>/vehicles/stickers/<64-bit id>.png. --name <regex> filters by name hash or texture id; --id <hex> writes one texture.
  • Core functions for the viewer: vehstickers::sticker_list, vehstickers::sticker_png(game, id, dir) (decodes one texture into dir, which works as a cache: a file that is there is kept) and vehstickers::parse_texture_id.
  • Sticker zone in the viewer's vertices. The viewer's loader reads _COLOR1 (PR 162) and keeps its fourth byte, the sticker zone, per vertex (Vertex::zone[0]). When fitted parts are merged into a vehicle (a truck's box or bed), each vertex also gets the number of the part it came from (Vertex::zone[1], the part's place in assembled_from, from 1), because zones are numbered per model. The vertex buffer layout passes it at location 14; no shader reads it yet. A vertex grows from 76 to 80 bytes.

Found on the way

  • A sticker record's flag 54ec9205 marks a colour mask texture. Of 8,415 records it is true on 6,116 that have colours and on 1 that has none, false on 1,791 without colours and on 507 with. Mask textures looked at are opaque (alpha 254 to 255) with red, green and blue as the cover of three colours; the others have colours and an alpha channel of their own.
  • The three mask colours are the record's named fields colorRed, colorGreen and colorBlue. The colours that PR 168 writes to liveries.json are colorRed, the field 9dbbd803 (the same value, ffd9e0e5, on 7,995 of 8,415 records) and colorGreen; colorBlue is left out there. Not changed in this PR.

Checked

  • One run on the full install: 8,415 sticker records, 6,663 distinct texture ids, 6,449 textures written in 57 s, 214 ids in no texture store (one of them is id 0). 616 MB of PNG.
  • Two textures opened and looked at: a 2048 x 512 picture with alpha and a 512 x 512 three-channel mask; both decode cleanly.
  • --id writes one texture in 0.2 s; a second call keeps the file.
  • cargo build --release -p sixng-cli -p sixng-gui passes without warnings; the new unit test passes.
  • The viewer opens benson_hi with its box as before (screenshot compared by eye).

Not decoded / not done

  • No sticker record has a name in the game's name list, so stickers are known by hash only.
  • The 214 texture ids that are in no store are not explained.
  • Sticker records' other fields (718a6bbb, ec4371eb, 92dd759a, aa79df8a, b35f9888, layer, the emissive and glass values) are passed through as read, not interpreted.
  • Vehicle models exported before PR 162 have no _COLOR1 in their cached GLB; the viewer reads zone 0 for them until they are exported again. The next PR handles that for the editor.
  • The Metal renderer (macOS, feature metal4-poc) was not built here.
**@⁠holdmysocks** on GitHub · 2026-11-24 15:51 UTC · [original](https://github.com/holdmysocks/SixNG/pull/172) `holdmysocks:claude/livery-textures` → `master` · +152 −3 · 7 files · 9 commits · merged 2026-11-24 16:42 UTC ## What First step of a custom livery editor in the viewer (stickers placed on a vehicle by hand). This PR gives the editor its two inputs; nothing is drawn yet. - **Sticker textures by id.** New command `sixng stickers -o <out>`: writes `<out>/vehicles/stickers.json`, the list of every sticker record of the vehicle library and packs (name hash, texture id, the three colours, mask flag, aspect class, and the record's fields as read). With `--textures` every sticker texture is decoded to `<out>/vehicles/stickers/<64-bit id>.png`. `--name <regex>` filters by name hash or texture id; `--id <hex>` writes one texture. - Core functions for the viewer: `vehstickers::sticker_list`, `vehstickers::sticker_png(game, id, dir)` (decodes one texture into `dir`, which works as a cache: a file that is there is kept) and `vehstickers::parse_texture_id`. - **Sticker zone in the viewer's vertices.** The viewer's loader reads `_COLOR1` (PR 162) and keeps its fourth byte, the sticker zone, per vertex (`Vertex::zone[0]`). When fitted parts are merged into a vehicle (a truck's box or bed), each vertex also gets the number of the part it came from (`Vertex::zone[1]`, the part's place in `assembled_from`, from 1), because zones are numbered per model. The vertex buffer layout passes it at location 14; no shader reads it yet. A vertex grows from 76 to 80 bytes. ## Found on the way - A sticker record's flag `54ec9205` marks a **colour mask** texture. Of 8,415 records it is true on 6,116 that have colours and on 1 that has none, false on 1,791 without colours and on 507 with. Mask textures looked at are opaque (alpha 254 to 255) with red, green and blue as the cover of three colours; the others have colours and an alpha channel of their own. - The three mask colours are the record's named fields `colorRed`, `colorGreen` and `colorBlue`. The `colours` that PR 168 writes to `liveries.json` are `colorRed`, the field `9dbbd803` (the same value, `ffd9e0e5`, on 7,995 of 8,415 records) and `colorGreen`; `colorBlue` is left out there. Not changed in this PR. ## Checked - One run on the full install: 8,415 sticker records, 6,663 distinct texture ids, 6,449 textures written in 57 s, 214 ids in no texture store (one of them is id 0). 616 MB of PNG. - Two textures opened and looked at: a 2048 x 512 picture with alpha and a 512 x 512 three-channel mask; both decode cleanly. - `--id` writes one texture in 0.2 s; a second call keeps the file. - `cargo build --release -p sixng-cli -p sixng-gui` passes without warnings; the new unit test passes. - The viewer opens `benson_hi` with its box as before (screenshot compared by eye). ## Not decoded / not done - No sticker record has a name in the game's name list, so stickers are known by hash only. - The 214 texture ids that are in no store are not explained. - Sticker records' other fields (`718a6bbb`, `ec4371eb`, `92dd759a`, `aa79df8a`, `b35f9888`, `layer`, the emissive and glass values) are passed through as read, not interpreted. - Vehicle models exported before PR 162 have no `_COLOR1` in their cached GLB; the viewer reads zone 0 for them until they are exported again. The next PR handles that for the editor. - The Metal renderer (macOS, feature `metal4-poc`) was not built here.
Mesh stream 12 (RGBA8) was dropped. It is now decoded and written to the GLB as _COLOR1. On vehicle bodies its fourth byte is the sticker zone a livery's layout records list (box side walls, front wall, cab doors).
New core module vehstickers; sixng vehicles also writes <out>/vehicles/liveries.json. Work in progress: the layout reader is not yet checked against the game (the packs index is being rebuilt at version 6).
The layout file's groups are the elements of its root record and its field names are hashed with their capitals. Brands are counted once per vehicle.
# Conflicts:
#	crates/sixng-cli/src/main.rs
#	crates/sixng-core/src/vehstickers.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:15:13 +00:00
github manually merged commit 26edab554f into gh-pr/172/base 2026-11-26 20:15:14 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.