Viewer: fabric tile gradient and a tint-mask layer on clothing #117

Closed
github-bot wants to merge 6 commits from gh-pr/117/head into gh-pr/117/base
Owner

@⁠holdmysocks on GitHub · 2026-11-24 04:36 UTC · original
holdmysocks:claude/fabric-render → master · +249 −42 · 10 files · 6 commits · closed without merging

What this changes

  • Fabric tile and gradient (wgpu renderer). A clothing material with a garment preset gets the tile of its main sub-material: the tile's material map is sampled on the second UV set at tilescale and tilerotation, and its green channel runs the game's three-stop gradient over the base colour (fabric_gradient in the shader: 0.1 x value; the colour; saturation x 0.55 at value x 0.55 + 0.45).
  • One tint-mask layer. The layer of that sub-material that changes the colour most (mean mask x opacity x tint alpha) is drawn over it: its mask texture at its own scale and rotation, the invert bit, its tint through the same gradient. On opaque materials the layer is limited to its own sub-material (base texture alpha for materialid garments, vertex tint alpha for per-vertex ones).
  • Main sub-material. The one covering most texels of the materialid map, or most vertices.
  • Per-vertex colours from #116 are kept, inside the same loop; the shade map now stays grey with a gain on the base factor, so shades above mid grey are not clipped before the tint multiplies in.
  • Material uniform grows by three vectors and the material bind group by two textures (tile, mask). glb::Material gets fabric: Option<Fabric>; LookPart and PartFx carry the preset id; matlib::Library::load reads every library file once (first outfit: a few seconds).
  • README: the viewer sentence of the materials row.

What was checked

  • Screenshots with --gpu radeon of the lead character's first outfit: denim shorts with a black belt, copper buckle and rivets and pale rolled hems, a black top, black and white trainers; no artefacts at normal distance, a fine regular pattern on the denim at very close range.
  • The second UV set has one scale on every mesh of a garment looked at (about 6 m per UV unit), which is what a tiling UV needs; the builder applies tilescale to it without another factor.
  • Tile material maps looked at have green near mid grey (0.40 to 0.48), so the gradient leaves the base colour close to what it was.
  • Layer blend against the items' colour tags (3,484 tagged presets with layers, mean masks): no shift overall (72.0 before, 72.5 after), and the invert bit helps where it is set (79.1 with it against 90.4 without on one group, 75.8 against 85.0 on another).
  • cargo test -p sixng-core: 148 passed. cargo check -p sixng-gui and a release build pass.

What is not done / not known

  • Metal renderer (macOS): not changed and not compiled here. It only gets fabric: None in its two material constructors; clothing keeps the flat colours there.
  • One tile and one layer per material: other sub-materials share the main one's tile and their own layers are not drawn. No tile normal map, no second to fourth layer, no pattern, stitch, dirt or sheen layers.
  • Whether the tiling density matches the game is not verified against a reference image.
  • A layer or tile whose scale the library leaves to the game's defaults is skipped (the defaults file was not found in any indexed archive).
  • The glTF export is unchanged.
**@⁠holdmysocks** on GitHub · 2026-11-24 04:36 UTC · [original](https://github.com/holdmysocks/SixNG/pull/117) `holdmysocks:claude/fabric-render` → `master` · +249 −42 · 10 files · 6 commits · closed without merging ## What this changes - **Fabric tile and gradient (wgpu renderer).** A clothing material with a garment preset gets the tile of its main sub-material: the tile's material map is sampled on the second UV set at `tilescale` and `tilerotation`, and its green channel runs the game's three-stop gradient over the base colour (`fabric_gradient` in the shader: 0.1 x value; the colour; saturation x 0.55 at value x 0.55 + 0.45). - **One tint-mask layer.** The layer of that sub-material that changes the colour most (mean mask x opacity x tint alpha) is drawn over it: its mask texture at its own scale and rotation, the invert bit, its tint through the same gradient. On opaque materials the layer is limited to its own sub-material (base texture alpha for `materialid` garments, vertex tint alpha for per-vertex ones). - **Main sub-material.** The one covering most texels of the `materialid` map, or most vertices. - Per-vertex colours from #116 are kept, inside the same loop; the shade map now stays grey with a gain on the base factor, so shades above mid grey are not clipped before the tint multiplies in. - Material uniform grows by three vectors and the material bind group by two textures (tile, mask). `glb::Material` gets `fabric: Option<Fabric>`; `LookPart` and `PartFx` carry the preset id; `matlib::Library::load` reads every library file once (first outfit: a few seconds). - README: the viewer sentence of the materials row. ## What was checked - Screenshots with `--gpu radeon` of the lead character's first outfit: denim shorts with a black belt, copper buckle and rivets and pale rolled hems, a black top, black and white trainers; no artefacts at normal distance, a fine regular pattern on the denim at very close range. - The second UV set has one scale on every mesh of a garment looked at (about 6 m per UV unit), which is what a tiling UV needs; the builder applies `tilescale` to it without another factor. - Tile material maps looked at have green near mid grey (0.40 to 0.48), so the gradient leaves the base colour close to what it was. - Layer blend against the items' colour tags (3,484 tagged presets with layers, mean masks): no shift overall (72.0 before, 72.5 after), and the invert bit helps where it is set (79.1 with it against 90.4 without on one group, 75.8 against 85.0 on another). - `cargo test -p sixng-core`: 148 passed. `cargo check -p sixng-gui` and a release build pass. ## What is not done / not known - **Metal renderer (macOS): not changed and not compiled here.** It only gets `fabric: None` in its two material constructors; clothing keeps the flat colours there. - One tile and one layer per material: other sub-materials share the main one's tile and their own layers are not drawn. No tile normal map, no second to fourth layer, no pattern, stitch, dirt or sheen layers. - Whether the tiling density matches the game is not verified against a reference image. - A layer or tile whose scale the library leaves to the game's defaults is skipped (the defaults file was not found in any indexed archive). - The glTF export is unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:11:04 +00:00
github-bot closed this pull request 2026-11-26 20:11:04 +00:00
Author
Owner

@⁠holdmysocks on GitHub · 2026-11-24 05:53 UTC · original

Superseded by #128, rebuilt on master after #122: the bake keeps colour and layers, and only the close-up weave of the main sub-material stays in the shader.

**@⁠holdmysocks** on GitHub · 2026-11-24 05:53 UTC · [original](https://github.com/holdmysocks/SixNG/pull/117#issuecomment-7123373971) Superseded by #128, rebuilt on master after #122: the bake keeps colour and layers, and only the close-up weave of the main sub-material stays in the shader.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.