Vehicle export with its livery: stickers as decal meshes in the GLB (SIX-248) #450

Manually merged
github merged 2 commits from github-bot/gh-450 into gh-pr/450/base 2026-11-27 05:12:00 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 04:04 UTC · original
holdmysocks:claude/livery-export → master · +561 −8 · 8 files · 2 commits · merged 2026-11-27 05:11 UTC

What

A vehicle can now be exported with its livery (SIX-248). Until now stickers, hand-placed ones and the game's own brands, were only drawn in the viewer; a vehicle from sixng vehicle had none.

  • sixng vehicle <name> --livery [FILE]: reads a livery file as the viewer's Liveries panel saves it. Without a file name it takes the one the viewer keeps for the vehicle (<work>/liveries/<vehicle>.json).
  • Liveries panel, File menu: "Export the vehicle as GLB…": writes the vehicle in the configuration shown with the stickers as they are now (saved or not), on a worker thread. A copy of the livery goes beside the GLB as <name>.livery.json. Scripted: --livery-export FILE.glb.

How a sticker is written (new module vehlivery): glTF has no sticker layer, so each sticker becomes a mesh of its own.

  • The faces of its zones are cut where the sticker lies: the mesh UV of the sticker's UV set goes through the sticker's six numbers, and each face is clipped to the picture's square 0..1. Nothing outside the picture is covered and the picture is not repeated.
  • One primitive per sticker and model, in the node of the model it lies on (the vehicle or a fitted part), with the joints and weights of the faces under it, so it follows a door.
  • Lifted off the surface along the normal: 0.8 mm, and 0.2 mm more per sticker, so a later sticker lies on top of an earlier one.
  • Its own material: the picture (livery_<file>_<n>.png beside the GLB) with alpha blending and a clamped sampler; opacity and a picture's tint go to the base colour factor. A colour mask is written as a picture in its three colours, by the rule of the viewer's shader.
  • The numbers used are the game's own transform for a game-placed sticker (game_uv), else the ones the viewer drew a hand-placed sticker with when the file was saved (shader_uv). All four UV sets are available.
  • The model's own decal meshes (shader 389206d1) take no stickers, as in the viewer.
  • The result lists per sticker the models it lies on with triangle counts, and what was left out and why (hidden, no numbers, picture not found, covers nothing).

The GLB writer gets a second, clamped sampler for materials marked extras.clamp.

Checked

  • Box truck (benson with its box), three hand-placed stickers saved for PR 186, by the CLI: 600, 422 and 431 triangles on the box (two stickers) and the cab door. Imported in Blender 5.3 and rendered with Eevee: all three are where the viewer shows them, the second lies on top of the first where they overlap, no flicker against the wall.
  • The same truck with the game's dairy brand (BENSON_BRAND_BAUMHARDERDAIRY), put on and exported from the viewer by script: six stickers, all on the third UV set and all colour masks. In Blender the banner is on the box side and the logo on the cab door, in the brand's colours.
  • The viewer's export of the three hand-placed stickers gives a GLB of the same size as the CLI's, and the panel reports "3 of 3 sticker(s)".
  • Three new unit tests in vehlivery: a sticker is cut out of the faces under it (area, place of its corner, lift, skin, zones, the skip rule); stickers go to the model they name and later ones lie higher; a mask takes its colours.
  • cargo test -p sixng-core -p sixng-gui: 367 and 53 pass. cargo build --release -p sixng-cli -p sixng-gui without warnings.

Not decoded / not done

  • The viewer's export writes a configuration of the vehicle. Your own choice of parts ("custom") is not carried over; the first configuration is exported then, and the menu says so.
  • A hand-placed sticker needs the numbers the viewer wrote on save. A livery file written by hand without shader_uv is reported as left out.
  • Dirt, wear and the paint's coat do not cover the stickers: they are plain pictures at roughness 0.45.
  • Overlapping stickers rely on the 0.2 mm step. Blender draws them in the right order; a program that neither sorts blended faces nor tests depth may not. The viewer itself, opening such a GLB as a plain model, drew the two overlapping stickers in the wrong order.
  • Tried on one vehicle only (the truck, with a part and the body). A car and curved panels were not exported.
  • Not tried by hand with a mouse (the menu entry and its file dialog); the scripted step runs the same code.
  • The BeamNG export does not use this yet.
  • Screenshots are not attached (they show game assets); they were handed to the user directly.
**@⁠holdmysocks** on GitHub · 2026-11-27 04:04 UTC · [original](https://github.com/holdmysocks/SixNG/pull/450) `holdmysocks:claude/livery-export` → `master` · +561 −8 · 8 files · 2 commits · merged 2026-11-27 05:11 UTC ## What A vehicle can now be exported with its livery (SIX-248). Until now stickers, hand-placed ones and the game's own brands, were only drawn in the viewer; a vehicle from `sixng vehicle` had none. - **`sixng vehicle <name> --livery [FILE]`**: reads a livery file as the viewer's Liveries panel saves it. Without a file name it takes the one the viewer keeps for the vehicle (`<work>/liveries/<vehicle>.json`). - **Liveries panel, File menu: "Export the vehicle as GLB…"**: writes the vehicle in the configuration shown with the stickers as they are now (saved or not), on a worker thread. A copy of the livery goes beside the GLB as `<name>.livery.json`. Scripted: `--livery-export FILE.glb`. How a sticker is written (new module `vehlivery`): glTF has no sticker layer, so each sticker becomes a mesh of its own. - The faces of its zones are cut where the sticker lies: the mesh UV of the sticker's UV set goes through the sticker's six numbers, and each face is clipped to the picture's square 0..1. Nothing outside the picture is covered and the picture is not repeated. - One primitive per sticker and model, in the node of the model it lies on (the vehicle or a fitted part), with the joints and weights of the faces under it, so it follows a door. - Lifted off the surface along the normal: 0.8 mm, and 0.2 mm more per sticker, so a later sticker lies on top of an earlier one. - Its own material: the picture (`livery_<file>_<n>.png` beside the GLB) with alpha blending and a clamped sampler; opacity and a picture's tint go to the base colour factor. A colour mask is written as a picture in its three colours, by the rule of the viewer's shader. - The numbers used are the game's own transform for a game-placed sticker (`game_uv`), else the ones the viewer drew a hand-placed sticker with when the file was saved (`shader_uv`). All four UV sets are available. - The model's own decal meshes (shader `389206d1`) take no stickers, as in the viewer. - The result lists per sticker the models it lies on with triangle counts, and what was left out and why (hidden, no numbers, picture not found, covers nothing). The GLB writer gets a second, clamped sampler for materials marked `extras.clamp`. ## Checked - Box truck (`benson` with its box), three hand-placed stickers saved for PR 186, by the CLI: 600, 422 and 431 triangles on the box (two stickers) and the cab door. Imported in Blender 5.3 and rendered with Eevee: all three are where the viewer shows them, the second lies on top of the first where they overlap, no flicker against the wall. - The same truck with the game's dairy brand (`BENSON_BRAND_BAUMHARDERDAIRY`), put on and exported from the viewer by script: six stickers, all on the third UV set and all colour masks. In Blender the banner is on the box side and the logo on the cab door, in the brand's colours. - The viewer's export of the three hand-placed stickers gives a GLB of the same size as the CLI's, and the panel reports "3 of 3 sticker(s)". - Three new unit tests in `vehlivery`: a sticker is cut out of the faces under it (area, place of its corner, lift, skin, zones, the skip rule); stickers go to the model they name and later ones lie higher; a mask takes its colours. - `cargo test -p sixng-core -p sixng-gui`: 367 and 53 pass. `cargo build --release -p sixng-cli -p sixng-gui` without warnings. ## Not decoded / not done - The viewer's export writes a configuration of the vehicle. Your own choice of parts ("custom") is not carried over; the first configuration is exported then, and the menu says so. - A hand-placed sticker needs the numbers the viewer wrote on save. A livery file written by hand without `shader_uv` is reported as left out. - Dirt, wear and the paint's coat do not cover the stickers: they are plain pictures at roughness 0.45. - Overlapping stickers rely on the 0.2 mm step. Blender draws them in the right order; a program that neither sorts blended faces nor tests depth may not. The viewer itself, opening such a GLB as a plain model, drew the two overlapping stickers in the wrong order. - Tried on one vehicle only (the truck, with a part and the body). A car and curved panels were not exported. - Not tried by hand with a mouse (the menu entry and its file dialog); the scripted step runs the same code. - The BeamNG export does not use this yet. - Screenshots are not attached (they show game assets); they were handed to the user directly.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:04:43 +00:00
github-bot changed target branch from master to gh-pr/450/base 2026-11-27 05:11:57 +00:00
github manually merged commit 3646ced6cd into gh-pr/450/base 2026-11-27 05:12:00 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.