Ped decorations: place layers in the record's own UV #468

Manually merged
github merged 2 commits from github-bot/gh-468 into gh-pr/468/base 2026-11-27 06:34:30 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 06:03 UTC · original
holdmysocks:claude/tattoo-zone-385 → master · +50 −6 · 1 files · 2 commits · merged 2026-11-27 06:30 UTC

Part of #385. Independent of #460 (both bump the bake rule; this one to 6). Fixes the smeared chest tattoo on cs_mandy (looks 0, 1 and 4–7).

Cause

cs_mandy's outfits list two decoration records that use the same decal. The bake applied only each layer's own matrix, so both landed on the chest at slightly different sizes and overlapped. The records' region names (targets, joaat) are "left arm" and "right arm".

The record matrix

Each decoration record has a UV matrix of its own (6e8249bf, +32, three vec4 rows, the same layout as a layer's). The game's bake mesh shader (MSNC_VS_BakeDecorations) rasterises the part at the part UV times that matrix and hands that UV to the pixel shader. The layer's clip quad, U/V fold and matrix then all work in it. So:

  1. r = (u v 1) × R. Where r falls outside 0..1, the record draws nothing.
  2. Clip quad and fold on r.
  3. Decal UV = r × L.

Most records' R is the identity (unchanged here, head makeup included) or a uniform scale and offset that zooms into one region. Mandy's "left arm" record now lands on the forearm with the design's proportions, and the "right arm" record lands as a small mark by the hand. The chest is clear.

Confidence

  • High: the shader path (the rasterised UV is the record-matrix UV and is what the pixel shader reads) and the matrix's place in the record. The exe also scales the bake resolution by this matrix.
  • Medium: that the record-space UV is always the one the decal uses. The mesh shader can pass the raw UV instead when two of its constants differ, and those constants are not traced yet. The data supports the record space: the records labelled "left arm", "right arm" and "lower arm" land on the arm only this way. Without it, 79% of the records with a non-identity matrix would draw nothing at all.

Still left out

  • The mesh shader also reads a per-texel bit mask and keeps a texel only when the record's bit is set. It looks like a region mask ("left arm" reaching only left-arm texels). It is not implemented, and the body's UV0 overlaps both arms, so arm tattoos show on both arms.

Checked

  • cs_mandy looks 0, 1, 4, 5, 6, 7 in the viewer on the RTX 4080, default camera: no chest smear.
  • The record matrix on a whole catalogue scan: 1,920 identity matrices, 5,589 others.

Tests

  • The record matrix maps into its square first; outside it, nothing.
  • The existing placement, fold, ink and makeup tests.
**@⁠holdmysocks** on GitHub · 2026-11-27 06:03 UTC · [original](https://github.com/holdmysocks/SixNG/pull/468) `holdmysocks:claude/tattoo-zone-385` → `master` · +50 −6 · 1 files · 2 commits · merged 2026-11-27 06:30 UTC Part of #385. Independent of #460 (both bump the bake rule; this one to 6). Fixes the smeared chest tattoo on cs_mandy (looks 0, 1 and 4–7). ## Cause cs_mandy's outfits list two decoration records that use the same decal. The bake applied only each layer's own matrix, so both landed on the chest at slightly different sizes and overlapped. The records' region names (`targets`, joaat) are "left arm" and "right arm". ## The record matrix Each decoration record has a UV matrix of its own (`6e8249bf`, +32, three vec4 rows, the same layout as a layer's). The game's bake mesh shader (`MSNC_VS_BakeDecorations`) rasterises the part at the part UV times that matrix and hands that UV to the pixel shader. The layer's clip quad, U/V fold and matrix then all work in it. So: 1. `r = (u v 1) × R`. Where `r` falls outside `0..1`, the record draws nothing. 2. Clip quad and fold on `r`. 3. Decal UV = `r × L`. Most records' `R` is the identity (unchanged here, head makeup included) or a uniform scale and offset that zooms into one region. Mandy's "left arm" record now lands on the forearm with the design's proportions, and the "right arm" record lands as a small mark by the hand. The chest is clear. ## Confidence - High: the shader path (the rasterised UV is the record-matrix UV and is what the pixel shader reads) and the matrix's place in the record. The exe also scales the bake resolution by this matrix. - Medium: that the record-space UV is always the one the decal uses. The mesh shader can pass the raw UV instead when two of its constants differ, and those constants are not traced yet. The data supports the record space: the records labelled "left arm", "right arm" and "lower arm" land on the arm only this way. Without it, 79% of the records with a non-identity matrix would draw nothing at all. ## Still left out - The mesh shader also reads a per-texel bit mask and keeps a texel only when the record's bit is set. It looks like a region mask ("left arm" reaching only left-arm texels). It is not implemented, and the body's UV0 overlaps both arms, so arm tattoos show on both arms. ## Checked - cs_mandy looks 0, 1, 4, 5, 6, 7 in the viewer on the RTX 4080, default camera: no chest smear. - The record matrix on a whole catalogue scan: 1,920 identity matrices, 5,589 others. ## Tests - The record matrix maps into its square first; outside it, nothing. - The existing placement, fold, ink and makeup tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 06:07:35 +00:00
# Conflicts:
#	crates/sixng-core/src/peddeco.rs
github-bot changed target branch from master to gh-pr/468/base 2026-11-27 06:34:29 +00:00
github manually merged commit 22cdca1b92 into gh-pr/468/base 2026-11-27 06:34:30 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.