Tattoos: mask layers fade or cut the layer before them #507

Manually merged
github merged 2 commits from github-bot/gh-507 into gh-pr/507/base 2026-11-27 21:21:45 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 21:09 UTC · original
holdmysocks:claude/tattoo-masks-385 → master · +106 −20 · 2 files · 2 commits · merged 2026-11-27 21:19 UTC

Part of #385: tattoo mask layers.

A decoration layer with flag 0x4 isn't drawn itself. It masks the layer before it in the same record. This was decoded from the game's bake pixel shader (PS_BakeDecorations). After it works out a layer's coverage, the shader looks at the next layer in the record. If that layer has bit 0x4, the shader:

  • samples that layer's decal alpha a at its own UV (its layer matrix, applied to the record-space UV);
  • inverts it (1 - a) when flag 0x80000000 is set;
  • multiplies the coverage by 1 - (1 - a) x opacity, using the mask layer's opacity;
  • continues the loop after the mask, so the mask is never drawn.

In the data, all 720 layers with this bit come right after an ordinary layer in their record. Until now the bake drew them as layers (the 206 with ink, in their ink colour) or dropped them as uncoloured masks. They now fade or cut the tattoo they belong to. For example, cs_lori's roses come out partly faded where their masks say so.

What changes:

  • peddeco::masked pairs each layer with the mask that follows it, within one record.
  • bake applies the mask factor to the layer's coverage.
  • The export's record notes describe the rule, and the bake rule version is bumped so cached textures are made again.

Tests cover pairing (a mask opening a record is drawn as a layer), the mask factor with and without inversion, and a masked bake.

Still open on #385: what flag bits 0x8 and 0x10 do (the bake shader doesn't test them), the per-texel region mask, Lucia's script-applied set and the tone override.

**@⁠holdmysocks** on GitHub · 2026-11-27 21:09 UTC · [original](https://github.com/holdmysocks/SixNG/pull/507) `holdmysocks:claude/tattoo-masks-385` → `master` · +106 −20 · 2 files · 2 commits · merged 2026-11-27 21:19 UTC Part of #385: tattoo mask layers. A decoration layer with flag 0x4 isn't drawn itself. It masks the layer before it in the same record. This was decoded from the game's bake pixel shader (`PS_BakeDecorations`). After it works out a layer's coverage, the shader looks at the next layer in the record. If that layer has bit 0x4, the shader: - samples that layer's decal alpha `a` at its own UV (its layer matrix, applied to the record-space UV); - inverts it (`1 - a`) when flag 0x80000000 is set; - multiplies the coverage by `1 - (1 - a) x opacity`, using the mask layer's opacity; - continues the loop after the mask, so the mask is never drawn. In the data, all 720 layers with this bit come right after an ordinary layer in their record. Until now the bake drew them as layers (the 206 with ink, in their ink colour) or dropped them as uncoloured masks. They now fade or cut the tattoo they belong to. For example, cs_lori's roses come out partly faded where their masks say so. What changes: - `peddeco::masked` pairs each layer with the mask that follows it, within one record. - `bake` applies the mask factor to the layer's coverage. - The export's record notes describe the rule, and the bake rule version is bumped so cached textures are made again. Tests cover pairing (a mask opening a record is drawn as a layer), the mask factor with and without inversion, and a masked bake. Still open on #385: what flag bits 0x8 and 0x10 do (the bake shader doesn't test them), the per-texel region mask, Lucia's script-applied set and the tone override.
From the bake pixel shader: a layer with flag 0x4 is not drawn; its decal
alpha (inverted with 0x80000000) at its own UV scales the previous layer's
coverage by 1 - (1 - a) x opacity, within one record.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:11:10 +00:00
github-bot changed target branch from master to gh-pr/507/base 2026-11-27 21:21:44 +00:00
github manually merged commit b723e58f91 into gh-pr/507/base 2026-11-27 21:21:45 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.