Skin F0: the engine's albedo window, decoded #455

Manually merged
github merged 13 commits from github-bot/gh-455 into gh-pr/455/base 2026-11-27 06:00:29 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 04:37 UTC · original
holdmysocks:people-skin-window → master · +928 −125 · 19 files · 13 commits · merged 2026-11-27 05:55 UTC

Part of #392 (the skin follow-ups to #446). Stacked on #446; merge that first.

What the engine does. Both skin pixel programs, the studio one and the deferred one, scale F0 by a window on the albedo's brightness: saturate((max(r, g, b) - lo) / (hi - lo)) on the linear albedo. lo and hi are at +0x6c0 / +0x6c4 of the per-frame buffer 6e8725e4. The engine fills them every frame (fn ff0120) from two constants in .data: sRGB 5 and 20 out of 255, so lo = 0.0015176 and hi = 0.0069954 linear. They do not depend on time of day. Only near-black albedo loses its specular, so on skin the factor is 1.

Changes

  • Viewer: the skin F0 is multiplied by the window.
  • GLB: extras.skin_spec.albedo_window records lo, hi and the rule. glTF has no equivalent, so the specular factor stays as it was.
  • skinspec: ALBEDO_LO, ALBEDO_HI and albedo_window(), with a test that the bounds are the sRGB decode of 5 and 20.
  • README: the skin paragraph no longer says the window is "taken as 1".

Checks

  • sixng-core tests: 357 passed.
  • sixng-gui tests: 53 passed.
  • Release build is clean.
  • The viewer renders Lucia on the RTX 4080 with no shader errors.
**@⁠holdmysocks** on GitHub · 2026-11-27 04:37 UTC · [original](https://github.com/holdmysocks/SixNG/pull/455) `holdmysocks:people-skin-window` → `master` · +928 −125 · 19 files · 13 commits · merged 2026-11-27 05:55 UTC Part of #392 (the skin follow-ups to #446). Stacked on #446; merge that first. **What the engine does.** Both skin pixel programs, the studio one and the deferred one, scale F0 by a window on the albedo's brightness: `saturate((max(r, g, b) - lo) / (hi - lo))` on the linear albedo. `lo` and `hi` are at +0x6c0 / +0x6c4 of the per-frame buffer `6e8725e4`. The engine fills them every frame (fn ff0120) from two constants in `.data`: sRGB 5 and 20 out of 255, so lo = 0.0015176 and hi = 0.0069954 linear. They do not depend on time of day. Only near-black albedo loses its specular, so on skin the factor is 1. **Changes** - Viewer: the skin F0 is multiplied by the window. - GLB: `extras.skin_spec.albedo_window` records lo, hi and the rule. glTF has no equivalent, so the specular factor stays as it was. - `skinspec`: `ALBEDO_LO`, `ALBEDO_HI` and `albedo_window()`, with a test that the bounds are the sRGB decode of 5 and 20. - README: the skin paragraph no longer says the window is "taken as 1". **Checks** - sixng-core tests: 357 passed. - sixng-gui tests: 53 passed. - Release build is clean. - The viewer renders Lucia on the RTX 4080 with no shader errors.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:42:15 +00:00
github-bot changed target branch from people-skin-shading to master 2026-11-27 05:17:37 +00:00
# Conflicts:
#	README.md
#	crates/sixng-core/src/skinspec.rs
#	crates/sixng-gui/src/shader.wgsl
github-bot changed target branch from master to gh-pr/455/base 2026-11-27 06:00:28 +00:00
github manually merged commit 8ad7e76a2c into gh-pr/455/base 2026-11-27 06:00:29 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.