Vehicles: tyres, lamp lenses, reflectors and lamps get their own classes #22
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!22
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/22/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 01:32 UTC · original
holdmysocks:claude/vehicle-materials→master· +134 −16 · 10 files · 1 commits · merged 2026-11-23 01:38 UTCWhat was wrong
Opening a car in the model viewer showed tyres with red and black rings, flat dark headlights and taillights, and body-coloured lamp housings. None of it was a texture decode fault; the materials were classified wrongly.
diffusetexonstandard_vehicle_2lyr_tyre_instis the engine-default white, so the exporter fell back to the material's only sRGB texture, slot19df25d7. That is a 128x256 palette of colour bands shared by the two-layer vehicle shaders, not a colour map.standard_vehicle_alphawas forced opaque, so the lens covers hid the lamps behind a flat olive panel. Their colour texture is one constant colour with the opacity in alpha.standard_vehicle_2lyr_reflectorwas classed as car paint.standard_vehicle_emissive*shaders were classed opaque, and the viewer lit emissive materials from the first colour slot rather thanemissivetex.What changed
19df25d7is never a base colour (rolepalette).classification.stand_in("rubber","chrome"or null) names it; the viewer takes the metallic and roughness factors from the GLB.standard_vehicle_alphaisglass, blended by the colour texture's alpha.standard_vehicle_emissive*isemissive. A shader with its ownemissivetexlights from that map, in the GLB (emissiveTexture) and in the viewer. An emissive material with no texture no longer keepsemissiveFactorin the GLB.Checked
cargo test -p sixng-core: 79 pass, including a newvehicle_classestest.baller2_hirendered in the rebuilt viewer from the front and the rear: dark tyres on both sides, see-through glass and lenses, lit lamps.Not checked, not changed
baller2was rendered. Other vehicles and the map views were not.emissivetexwhen they have one.standard_vehicle_2lyrmaterial still takes the body colour, interior and trim included. That needs the palette lookup, which is not decoded.Tyres rendered with red and black rings: their diffusetex is the engine-default white, so the exporter fell back to the only sRGB texture of the material, slot 19df25d7. That is a 128x256 palette of colour bands shared by the two-layer vehicle shaders, not a colour map. It is now never a base colour, and the tyre shader (standard_vehicle_2lyr_tyre_inst) gets a dark rubber stand-in. Lamp lenses (standard_vehicle_alpha) were forced opaque and hid the lamps behind a flat olive panel; they are glass now, blended by the colour texture's alpha. Lamp reflectors (standard_vehicle_2lyr_reflector) were painted with the body colour; they are chrome. The standard_vehicle_emissive* shaders are emissive, and a shader with its own emissivetex lights from that map in the GLB and in the viewer. An emissive material with no texture no longer glows flat white in the GLB. classification.stand_in ("rubber", "chrome" or null) names the stand-in surface; the viewer takes its metallic and roughness factors from the GLB. Viewer: mirrored instances (right-hand wheels) had inverted normals, because their triangles wind the other way; the vertex shader passes the mirror sign. Cached vehicle exports from before this change are exported again when opened. Not changed: every standard_vehicle_2lyr material still takes the body colour (interior, trim), since the palette lookup is not decoded. The Metal renderer ignores the stand-in factors.