Vehicles: lamp colours from the light archetypes #84

Manually merged
github merged 1 commit from gh-pr/84/head into gh-pr/84/base 2026-11-26 20:08:37 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-23 22:10 UTC · original
holdmysocks:claude/lamp-colours → master · +212 −15 · 4 files · 1 commits · merged 2026-11-23 22:24 UTC

What

  • A vehicle lamp record (ba860a07) names a light set (066532dd) of a light archetype (ea42cb63). In the library the reference is the set name in the high half and the archetype's name hash in the low half; in the packs it is the archetype's 64-bit id.
  • The archetypes are ordinary archetypes of levels.rpf (82d6fc83: id at +0, name at +0x74) whose extension (7af058f7) holds named light sets (76402c3c) of lights (f54b227b) with a colour and an intensity. The vehicles' 55 light archetypes share one resource.
  • vehlights finds that resource by scanning levels.rpf's meta resources (about two minutes, once) and keeps the table in <work>/index/vehicle_light_archetypes.json. If the first resource found does not cover every archetype the lamps name, all resources are read.
  • vehicles.json is format 10: lights.lamp_lights gives each lamp bone [RRGGBB, intensity] (the set's brightest light). Lamp sets are also reached through the parts' link records (da592d57.dd466dfe).
  • Viewer: siren lamps and the ordinary lamps (head, tail, brake, indicators, interior ...) glow in their own colour instead of a fixed colour per kind.

Checked

  • Whole-game export: 19,799 of 19,808 lamps on 329 vehicles get a colour. Second run (table cached): 31 s.
  • The ambulance's three siren light sets resolve through the 64-bit id to one archetype and are white (ffffff, intensities 1000 / 2600 / 4000); its markers are amber and red. polmav has green (59ffac) navigation lamps.
  • Screenshots: comet7 tail bar and firetruk2 indicator lit in their colours; ambulance sirens white.
  • cargo test -p sixng-core -p sixng-gui: 156 passed.

Not decoded / not done

  • Whether the colour bytes are linear or sRGB: the viewer takes them as linear.
  • Intensity is exported but the viewer does not use it (every lit lamp is as bright as its kind).
  • Sets with several lights: only the brightest is kept.
  • Siren lamps that are white lights behind a coloured lens still look white: the lens colour is not in the lens mesh (a shared data texture, part id 255).
  • Correction to PR 81's text: 329 of 373 vehicle records get light data, not 339.
  • Flash type waveforms and the cycle length are still approximated (as in PR 81).
  • The first vehicle-data build after this change takes about two minutes longer (the levels.rpf scan).
**@⁠holdmysocks** on GitHub · 2026-11-23 22:10 UTC · [original](https://github.com/holdmysocks/SixNG/pull/84) `holdmysocks:claude/lamp-colours` → `master` · +212 −15 · 4 files · 1 commits · merged 2026-11-23 22:24 UTC ## What - A vehicle lamp record (`ba860a07`) names a light set (`066532dd`) of a light archetype (`ea42cb63`). In the library the reference is the set name in the high half and the archetype's name hash in the low half; in the packs it is the archetype's 64-bit id. - The archetypes are ordinary archetypes of levels.rpf (`82d6fc83`: id at +0, name at +0x74) whose extension (`7af058f7`) holds named light sets (`76402c3c`) of lights (`f54b227b`) with a colour and an intensity. The vehicles' 55 light archetypes share one resource. - `vehlights` finds that resource by scanning levels.rpf's meta resources (about two minutes, once) and keeps the table in `<work>/index/vehicle_light_archetypes.json`. If the first resource found does not cover every archetype the lamps name, all resources are read. - `vehicles.json` is format 10: `lights.lamp_lights` gives each lamp bone `[RRGGBB, intensity]` (the set's brightest light). Lamp sets are also reached through the parts' link records (`da592d57.dd466dfe`). - Viewer: siren lamps and the ordinary lamps (head, tail, brake, indicators, interior ...) glow in their own colour instead of a fixed colour per kind. ## Checked - Whole-game export: 19,799 of 19,808 lamps on 329 vehicles get a colour. Second run (table cached): 31 s. - The ambulance's three siren light sets resolve through the 64-bit id to one archetype and are white (ffffff, intensities 1000 / 2600 / 4000); its markers are amber and red. polmav has green (59ffac) navigation lamps. - Screenshots: comet7 tail bar and firetruk2 indicator lit in their colours; ambulance sirens white. - `cargo test -p sixng-core -p sixng-gui`: 156 passed. ## Not decoded / not done - Whether the colour bytes are linear or sRGB: the viewer takes them as linear. - Intensity is exported but the viewer does not use it (every lit lamp is as bright as its kind). - Sets with several lights: only the brightest is kept. - Siren lamps that are white lights behind a coloured lens still look white: the lens colour is not in the lens mesh (a shared data texture, part id 255). - Correction to PR 81's text: 329 of 373 vehicle records get light data, not 339. - Flash type waveforms and the cycle length are still approximated (as in PR 81). - The first vehicle-data build after this change takes about two minutes longer (the levels.rpf scan).
A lamp record names a light set of a light archetype: in the library by
the archetype's name hash, in the packs by its 64-bit id. The archetypes
are archetypes of levels.rpf whose extension holds named light sets of
lights with a colour and an intensity. vehlights finds their resource by
a scan of levels.rpf (about two minutes, once; kept in
<work>/index/vehicle_light_archetypes.json) and gives every lamp bone its
light as vehicles.json `lights.lamp_lights` (format 10). Lamp sets are
also reached through the parts' link records (dd466dfe), so vehicles
without light patterns of their own pack get them too.

Viewer: sirens and the ordinary lamps (head, tail, indicators ...) glow
in their own colour.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:08:36 +00:00
github manually merged commit d824608efe into gh-pr/84/base 2026-11-26 20:08:37 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.