Viewer: the game's screen-space hair blur #439

Manually merged
github merged 2 commits from github-bot/gh-439 into gh-pr/439/base 2026-11-27 03:15:34 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 02:37 UTC · original
holdmysocks:hair-blur → master · +397 −0 · 4 files · 2 commits · merged 2026-11-27 03:13 UTC

The game softens strand hair on screen with a small blur of the lit colour, run after its upscaler (effect hair_resolve, techniques SingleDrawBlurLow*). This ports it to the model viewer.

What the game does

  • A pixel is blurred when a resolved strand pixel lies in its 3 x 3 neighbourhood. There is no depth or edge stop on the taps.
  • The kernel is a 3 x 3 Gaussian with weights 1 / exp(-1/(2s²)) / exp(-1/s²) for centre / edge / corner. The result replaces the pixel.
  • s = s_far + (s_near - s_far) x sat(0.0002 x H / z). H is the target height in pixels; z is the view depth of the nearest strand pixel.
  • The two sigmas come from one strength x, which is the constant 1.0 on the game's main path: s_near = clamp(x, 0.1, 2) and s_far = clamp((0.3 + 0.2 sat(H/720 - 1)) x, 0.1, s_near).
  • The upscale variants (5 x 5, 7 x 7) are the same blur after an upscaled output. The viewer has no upscaler, so it uses the 1 x variant.
  • The time-cycle values hair_blur_strength and hair_blur_depth_fade are not read by the executable. hair_quality biases the strand-LOD budget controller only; it has no effect at its shipped value.

In the viewer

  • New module hairblur.rs.
  • The strands are drawn again over the main pass's depth with an equal test, into a 4x multisampled mask (strand share and depth). So only pixels where a strand is the kept surface count.
  • The resolved HDR colour is then blurred before tone mapping.
  • SIXNG_HAIR_BLUR=0 turns it off; SIXNG_HAIR_BLUR=mask shows the mask in red.
  • Not done: the Metal 4 renderer.

Checked

  • Mandy (cs_mandy) at the indoor game-frame angle, same build with the blur off and on.
  • High-frequency detail of her ends falls from 6.8 to 3.9 (mean horizontal gradient).
  • Skin, face and background are unchanged (max difference 0).
  • The mask covers hair, brows and lashes only.
  • Strand edges are softer and the crossing lines dimmer. The ends still look more stranded than the game frame, so this closes part of the gap, not all of it.

Confidence

  • High: the kernel, the gate, the sigma formula and the main-path strength. The programs are short and were read in full; the CPU maths was read once.
  • Medium: that the stencil class the game tests marks the resolved strand pixels. Its writer is not found.
**@⁠holdmysocks** on GitHub · 2026-11-27 02:37 UTC · [original](https://github.com/holdmysocks/SixNG/pull/439) `holdmysocks:hair-blur` → `master` · +397 −0 · 4 files · 2 commits · merged 2026-11-27 03:13 UTC The game softens strand hair on screen with a small blur of the lit colour, run after its upscaler (effect `hair_resolve`, techniques `SingleDrawBlurLow*`). This ports it to the model viewer. **What the game does** - A pixel is blurred when a resolved strand pixel lies in its 3 x 3 neighbourhood. There is no depth or edge stop on the taps. - The kernel is a 3 x 3 Gaussian with weights 1 / exp(-1/(2s²)) / exp(-1/s²) for centre / edge / corner. The result replaces the pixel. - s = s_far + (s_near - s_far) x sat(0.0002 x H / z). H is the target height in pixels; z is the view depth of the nearest strand pixel. - The two sigmas come from one strength x, which is the constant 1.0 on the game's main path: s_near = clamp(x, 0.1, 2) and s_far = clamp((0.3 + 0.2 sat(H/720 - 1)) x, 0.1, s_near). - The upscale variants (5 x 5, 7 x 7) are the same blur after an upscaled output. The viewer has no upscaler, so it uses the 1 x variant. - The time-cycle values `hair_blur_strength` and `hair_blur_depth_fade` are not read by the executable. `hair_quality` biases the strand-LOD budget controller only; it has no effect at its shipped value. **In the viewer** - New module `hairblur.rs`. - The strands are drawn again over the main pass's depth with an equal test, into a 4x multisampled mask (strand share and depth). So only pixels where a strand is the kept surface count. - The resolved HDR colour is then blurred before tone mapping. - `SIXNG_HAIR_BLUR=0` turns it off; `SIXNG_HAIR_BLUR=mask` shows the mask in red. - Not done: the Metal 4 renderer. **Checked** - Mandy (`cs_mandy`) at the indoor game-frame angle, same build with the blur off and on. - High-frequency detail of her ends falls from 6.8 to 3.9 (mean horizontal gradient). - Skin, face and background are unchanged (max difference 0). - The mask covers hair, brows and lashes only. - Strand edges are softer and the crossing lines dimmer. The ends still look more stranded than the game frame, so this closes part of the gap, not all of it. **Confidence** - High: the kernel, the gate, the sigma formula and the main-path strength. The programs are short and were read in full; the CPU maths was read once. - Medium: that the stencil class the game tests marks the resolved strand pixels. Its writer is not found.
The game softens strand hair with a 3 x 3 Gaussian on the lit colour
(effect hair_resolve, SingleDrawBlurLow), after its upscaler. A pixel is
blurred when a resolved strand pixel lies in its 3 x 3; there is no depth
or edge stop. Sigma runs from s_far to s_near by sat(0.0002 H / z), with
s_near = 1 and s_far = 0.3 + 0.2 sat(H / 720 - 1) at the strength the
game passes (1.0).

The viewer draws the strands again over the main pass's depth with an
equal test into a multisampled mask (strand share and depth). It then
blurs the resolved colour before tone mapping. SIXNG_HAIR_BLUR=0 turns it
off; SIXNG_HAIR_BLUR=mask shows the mask.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:42:28 +00:00
github-bot changed target branch from master to gh-pr/439/base 2026-11-27 03:15:33 +00:00
github manually merged commit 2f82a79960 into gh-pr/439/base 2026-11-27 03:15:34 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.