Vehicles: the second layer of part surfaces (wear), with a wear control in the viewer #138

Manually merged
github merged 3 commits from gh-pr/138/head into gh-pr/138/base 2026-11-26 20:12:43 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 12:08 UTC · original
holdmysocks:claude/wear-layer → master · +103 −11 · 6 files · 3 commits · merged 2026-11-24 12:16 UTC

Built on #137 (per-pixel palette): this branch contains its commit. Merge #137 first; the diff here then shrinks to the wear layer.

What

Every vehicle surface record (9e4de959) names a second layer: a colour record (5cffe5e0) and a material record (174770cc, a 307f162c like the first layer's). Until now only the first layer was read. The second layer is what shows where the first is worn: rust brown under paint, grey under bare metal, dark under plastics, mostly rough and not metallic.

  • Part tables (vehicle_parts.json, format 18): each part id gets wear_row, wear_rough and wear_metal.
  • Export: model.json part_colours.wear (per look, 256 x 8 hex digits: palette row, roughness, metalness). Part colours version 20. The GLB is unchanged.
  • Viewer: a "wear" slider (0 to 1, default 0) and --wear. A part material blends towards its second layer where the blue channel of its layer detail texture is high. The rows of the second layer go in the lower half of the part ramp image from #137.

Numbers

  • 757 surface records, all with a second layer; 92 distinct pairs of colour and material.
  • The most common second layer (201 surfaces) is palette row 251 of slice 3 (brown) with roughness 0.65 to 1.0, not metallic. The body paint surface has row 255 of slice 3 (brown), same material.

Checked

  • Renders of four vehicles with wear 0 and wear 1, same camera. With wear 1 the mule's wooden deck shows weathered patches (6,995 pixels differ by more than 12 of 255), the benson's box 2,533, the tow truck 634, the rebel 363. With wear 0 the picture is the one from #137.
  • cargo test -p sixng-core vehcolour passes.

Not decoded / not done

  • How much of the second layer the game shows, and what drives it (a vehicle's condition, its age, a per-vehicle value), is not known. That is why the default is 0 and the amount is a slider.
  • That the blue channel of the layer detail texture is the mask is an inference from how it looks (bright on edges and scratches, mean 21 of 255). Each surface also names two parameter records (038e1179, 6c3ddabc, struct cf980e6f, about 20 floats) that probably shape the blend; they are not read.
  • Body panels bind no layer detail texture, so they show no wear here.
  • The Metal renderer is unchanged.
**@⁠holdmysocks** on GitHub · 2026-11-24 12:08 UTC · [original](https://github.com/holdmysocks/SixNG/pull/138) `holdmysocks:claude/wear-layer` → `master` · +103 −11 · 6 files · 3 commits · merged 2026-11-24 12:16 UTC Built on #137 (per-pixel palette): this branch contains its commit. Merge #137 first; the diff here then shrinks to the wear layer. ## What Every vehicle surface record (`9e4de959`) names a second layer: a colour record (`5cffe5e0`) and a material record (`174770cc`, a `307f162c` like the first layer's). Until now only the first layer was read. The second layer is what shows where the first is worn: rust brown under paint, grey under bare metal, dark under plastics, mostly rough and not metallic. - Part tables (`vehicle_parts.json`, format 18): each part id gets `wear_row`, `wear_rough` and `wear_metal`. - Export: `model.json` `part_colours.wear` (per look, 256 x 8 hex digits: palette row, roughness, metalness). Part colours version 20. The GLB is unchanged. - Viewer: a "wear" slider (0 to 1, default 0) and `--wear`. A part material blends towards its second layer where the blue channel of its layer detail texture is high. The rows of the second layer go in the lower half of the part ramp image from #137. ## Numbers - 757 surface records, all with a second layer; 92 distinct pairs of colour and material. - The most common second layer (201 surfaces) is palette row 251 of slice 3 (brown) with roughness 0.65 to 1.0, not metallic. The body paint surface has row 255 of slice 3 (brown), same material. ## Checked - Renders of four vehicles with wear 0 and wear 1, same camera. With wear 1 the mule's wooden deck shows weathered patches (6,995 pixels differ by more than 12 of 255), the benson's box 2,533, the tow truck 634, the rebel 363. With wear 0 the picture is the one from #137. - `cargo test -p sixng-core vehcolour` passes. ## Not decoded / not done - How much of the second layer the game shows, and what drives it (a vehicle's condition, its age, a per-vehicle value), is not known. That is why the default is 0 and the amount is a slider. - That the blue channel of the layer detail texture is the mask is an inference from how it looks (bright on edges and scratches, mean 21 of 255). Each surface also names two parameter records (`038e1179`, `6c3ddabc`, struct `cf980e6f`, about 20 floats) that probably shape the blend; they are not read. - Body panels bind no layer detail texture, so they show no wear here. - The Metal renderer is unchanged.
A part without a colour of its own reads a row of the material palette at the column the green channel of the layer detail texture gives per pixel. The export writes the palette (vehicle_palette.png) and the palette row of each part id per look (part_colours.rows, version 19); the viewer builds an image with one row per part id for the look shown and reads it per pixel. COLOR_0 and looks keep the row at the texture's mean green.
Every surface record names a second colour and material, which shows where the first layer is worn. The part tables keep it per part id (wear_row, wear_rough, wear_metal, format 18), the export lists it per look (part_colours.wear, version 20), and the viewer blends towards it where the layer detail texture's blue is high, by a wear amount the user sets (default 0).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:12:41 +00:00
github manually merged commit 44b1c2077f into gh-pr/138/base 2026-11-26 20:12:43 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.