Viewer: each vehicle part's own coat, with anisotropy, sheen and thin film (SIX-209) #280

Manually merged
github merged 18 commits from gh-pr/280/head into gh-pr/280/base 2026-11-26 20:24:05 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 14:26 UTC · original
holdmysocks:claude/viewer-special-finishes → master · +154 −11 · 2 files · 18 commits · merged 2026-11-25 14:36 UTC

SIX-209.

What

  • Each vehicle part now gets its own coat record in the viewer, not only the body paint. The records of all part ids go into the part ramp image (rows 768 to 1023, row 1024 for the body paint), so clear coat and flakes show on trim, carbon and interior parts too.
  • Three finishes from the record are drawn:
    • Anisotropy (useAnisotropy, anisotropyIntensity): the highlight is stretched along the surface tangent, and the mirror image of the surroundings bends the same way.
    • Sheen (sheenIntensity, sheenFade, sheenReflectance): the surface brightens towards the silhouette, like velvet.
    • Thin film (filmIOR, filmThickness, thickness taken as micrometres): the colour of the reflection turns with the viewing angle; the amount reflected and the paint colour stay as they were.
  • The record's base coat roughness stays on the body paint only. Other parts keep the roughness of their own surface.

Checked

  • Build and workspace tests pass (312; one new test for the coat row layout).
  • Before / after pictures and pixel differences of one sports car in several configurations:
    • A configuration with a thin-film paint (IOR 2.6, thickness 0.2): the red paint keeps its colour, and reflections shift to olive and green across the panels.
    • Default configuration: the body is unchanged; the steering wheel, dashboard, mirror, fuel cap and a rear panel change (4.5 % of pixels).
    • Close-up of a carbon-coated scoop surround (anisotropy 0.55 under a glossy clear coat): it keeps its dark look, with a faint streaked highlight.
  • A first version applied the base coat roughness override to every part. That turned the carbon part flat light grey, so it was limited to the body paint.
  • A first film version added the film's reflectance on top. That turned the red car teal, so it now only tints the reflection.

Not decoded / not done

  • How the game's shaders use these values is not decoded. These are standard models (anisotropic GGX with a bent reflection normal, a simple sheen lobe, single-layer interference) in their place.
  • The unit of film thickness is not known (micrometres is a guess), nor the meaning of sheen fade.
  • Only one vehicle was looked at in detail. Among the exported vehicles checked, special coats sit mostly on small parts (a few part ids per vehicle), and on the body paint in 1 of 158 configurations.
  • The Metal 4 renderer is untouched and was not compiled.
  • Not compared with the game.
**@⁠holdmysocks** on GitHub · 2026-11-25 14:26 UTC · [original](https://github.com/holdmysocks/SixNG/pull/280) `holdmysocks:claude/viewer-special-finishes` → `master` · +154 −11 · 2 files · 18 commits · merged 2026-11-25 14:36 UTC SIX-209. ## What - Each vehicle part now gets its own coat record in the viewer, not only the body paint. The records of all part ids go into the part ramp image (rows 768 to 1023, row 1024 for the body paint), so clear coat and flakes show on trim, carbon and interior parts too. - Three finishes from the record are drawn: - Anisotropy (`useAnisotropy`, `anisotropyIntensity`): the highlight is stretched along the surface tangent, and the mirror image of the surroundings bends the same way. - Sheen (`sheenIntensity`, `sheenFade`, `sheenReflectance`): the surface brightens towards the silhouette, like velvet. - Thin film (`filmIOR`, `filmThickness`, thickness taken as micrometres): the colour of the reflection turns with the viewing angle; the amount reflected and the paint colour stay as they were. - The record's base coat roughness stays on the body paint only. Other parts keep the roughness of their own surface. ## Checked - Build and workspace tests pass (312; one new test for the coat row layout). - Before / after pictures and pixel differences of one sports car in several configurations: - A configuration with a thin-film paint (IOR 2.6, thickness 0.2): the red paint keeps its colour, and reflections shift to olive and green across the panels. - Default configuration: the body is unchanged; the steering wheel, dashboard, mirror, fuel cap and a rear panel change (4.5 % of pixels). - Close-up of a carbon-coated scoop surround (anisotropy 0.55 under a glossy clear coat): it keeps its dark look, with a faint streaked highlight. - A first version applied the base coat roughness override to every part. That turned the carbon part flat light grey, so it was limited to the body paint. - A first film version added the film's reflectance on top. That turned the red car teal, so it now only tints the reflection. ## Not decoded / not done - How the game's shaders use these values is not decoded. These are standard models (anisotropic GGX with a bent reflection normal, a simple sheen lobe, single-layer interference) in their place. - The unit of film thickness is not known (micrometres is a guess), nor the meaning of sheen fade. - Only one vehicle was looked at in detail. Among the exported vehicles checked, special coats sit mostly on small parts (a few part ids per vehicle), and on the body paint in 1 of 158 configurations. - The Metal 4 renderer is untouched and was not compiled. - Not compared with the game.
The library's coat records (struct 2b84f07e: clear coat, flakes, film,
sheen, anisotropy) are read; a part set's paintHash and a configuration's
paint type parts give each part id its coat. model.json gets
part_colours.coat (records, per look, body paint). vehicle_parts.json
format 21, part colours export version 25.
Glossy surfaces had only a two-colour sky gradient to reflect, and models
floated over the grid.

- shader: `environment(d, blur)` replaces the gradient for reflections: sky
  from horizon to zenith, a glow around the sun, a sharp horizon and a
  ground of asphalt lit by the sun and the sky (never brighter than the
  horizon sky). The horizon, the gradient and the glow widen with the
  roughness of the reflecting surface. `sky(d)`, the background, adds the
  sun's disc; reflections leave it to the direct specular term.
- shader: `ambient(n)`: as before for surfaces that face up or sideways;
  surfaces that face down take the light the ground sends back.
- renderer: `Renderer3D::ground`, a soft shadow on the ground under the
  model: two blurred rounded boxes from the model's bounds (one under it,
  a wider one pushed away from the sun). Not a shadow map. Shaded mode
  only, drawn after the opaque surfaces.
- model view: sets the shadow for models up to 40 m, and puts the ground
  (grid and shadow) under the tyres of a vehicle on its wheels; the grid
  used to sit at the body's lowest point and cut through the wheels.

No change to the frame uniforms or the paint and specular code.
The part reference modifier (51aab7c1) was read by the field names type
and data; data is not a built-in name, so without the name dictionary no
reference was followed and 1,202 configurations got other part colours.
The part_colours.coat block indexed a JSON map by key, which panics when the key is missing: shared library parts and models without a body paint coat have none of the four. Read them with get.
The paint finish 'as stored' now draws a second, clear layer over the
paint with the coat's intensity and roughness, takes the base coat
roughness from the coat when it overrides it, and scatters the base
highlight with the coat's flake orientation and size.

Film, sheen and anisotropy are not drawn.
A vehicle part's metalness and roughness lie between the low and the high
of its surface record, by the red and green of the material's
lyr0materialatex. Export and viewer used one blend per model (the map's
mean, packed in the vertex colour alpha).

Export: model.json part_colours.surfaces lists each part id's low and high
per look (and per part patch). part_colours_version 26.

Viewer: the part ramp image gets 256 more rows with those values and is
bound on every part material; where a material has its material map, the
shader blends per pixel. Materials without the map, the body paint (paint
finish and coat) and the wear layer are as before.
The coat records of all part ids go into the part ramp image (rows 768..,
row 1024 for the body paint), so parts other than the body paint get their
clear coat and flakes too. Anisotropy stretches the highlight along the
surface tangent, sheen brightens towards the silhouette, and a thin film
turns the colour of the reflection with the viewing angle. The record's
base coat roughness stays on the body paint only.

How the game's shaders use these values is not decoded; these are
standard models in its place.
# Conflicts:
#	crates/sixng-gui/src/model_view.rs
#	crates/sixng-gui/src/shader.wgsl
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:24:03 +00:00
github manually merged commit 3b4b757cca into gh-pr/280/base 2026-11-26 20:24:05 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.