Vehicles: part colours from the part sets and the material palette #59
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!59
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/59/head"
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-23 17:12 UTC · original
holdmysocks:claude/vehicle-colours→master· +438 −12 · 12 files · 1 commits · merged 2026-11-23 17:20 UTCInteriors, trim and mechanical parts of vehicles were drawn with a grey stand-in. This reads the game's per-part colours and writes them into the export and the viewer.
What is read
f14244fd, its own0x7aresource inpacks.rpf; 338 found) names a colour record and a surface record for each of the 256 ids. 319 vehicle models link to a set through a 64-bit name in their variation sets and one mod element.data.rpfholds the records: colour recordsf1379639(colour, mode, palette row) and surface records9e4de959(roughness range through307f162c).19df25d7, 128 x 256, the same on every vehicle) is real data: each row is one material's ramp from dark to bright. Paint rows are black in the file and filled by the game.Colour byte order
Colours of type
0x15have red in the low byte. The library's 151 named colours begin with GTA IV's car colour list only when read that way. Configuration body colours and paint lists were read with red and blue swapped;vehicles.jsonnow writes real ARGB plus the stored value (format4).Changes
vehcolour(sets, library, links; cached in<work>/index/vehicle_parts.json).COLOR_0holds each vertex's colour on a white base;classification.stand_inispartson those materials.COLOR_0alpha 254 marks the primary body paint, 0-100 is roughness x 100, 101-201 the same on parts taken as metal.Checked
Not decoded
0caef606in the library, with part id groups6225734f, channel bindings501ff112, colour and surface assignmentsb94308f5). Interior and trim choices per configuration are not applied; every vehicle shows its default table.The two-layer vehicle materials (body, interior, mechanical parts) were drawn with one paint colour or a grey stand-in. Each vertex carries a part id (0-255) in its vertex colour alpha; this reads what gives an id its colour: - A part set (f14244fd, its own 0x7a resource in packs.rpf, 338 found): two 256-entry tables, a colour record name per part id (8b464cf4.2efff0ae[i].4f9f7603) and a surface record name (578f6a03.4e3e21e7[i].8576d517). Its name is a 64-bit value carried by the vehicle's variation sets (fc1c7000) and one of its mod elements (77f2b89e); 319 models link to a set. - A library (one 0x7a resource in data.rpf): colour records f1379639 (colour, mode adb52ec3, palette row c8313558) and surface records 9e4de959, whose 2cc72f7c names a 307f162c record with roughnessLow and roughnessHigh. - The material palette texture (slot 19df25d7, 128 x 256, the same on every vehicle) is not a placeholder: a row is one colour record's ramp, dark to bright. Rows of fixed materials (mode 3: rubber, plastics, leathers, chrome) are stored; paint rows are black in the file and filled by the game. Colours of type 0x15 have red in the low byte: the library's 151 named colours (4ce375e6) begin with GTA IV's car colour list only when read that way. Configuration body colours and paint lists were read with red and blue swapped; vehicles.json now writes them as real ARGB plus the stored value ("format" 4). - New module vehcolour: reads the sets, the library and the links, cached in <work>/index/vehicle_parts.json. - Export: meshes of materials that bind the palette get GLB COLOR_0 = the colour of each vertex's part id (the middle of the palette row for fixed materials, the record's colour for paints) on a white base; classification.stand_in "parts" replaces "trim" and car_paint there. COLOR_0 alpha 254 marks the primary body paint, 0-100 is the surface's mean roughness x 100, 101-201 the same on parts taken as metal. model.json gets part_colours and part_colours_version. - Viewer: the primary paint follows the Car paint colour, parts take their roughness; older cached vehicle exports are exported again. Checked in the viewer on comet7, buffalo6, ambulance and bison4 (seats, dash, carpet, bumpers, body and roof). 137 core tests pass. Not decoded: what picks the column of a palette row; the modifier records a configuration lists (0caef606 in the library with 6225734f part id groups, 501ff112 channel bindings, b94308f5 colour and surface assignments), so interior and trim choices per configuration are not applied and every vehicle shows its default table; metalness (a bright neutral row on a smooth surface is taken as metal, an inference); the second layer's colour; colour record modes 4 and 5; rim, tyre and weapon colours. The Metal renderer shows the colours without the paint swap or per-part roughness. No motorcycle or boat was checked.