Skin shading: no pale band under the jaw, no seam at the pelvis (#308) #334

Manually merged
github merged 2 commits from gh-pr/334/head into gh-pr/334/base 2026-11-26 20:28:17 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-26 02:10 UTC · original
holdmysocks:issue-308-shading → master · +39 −11 · 8 files · 2 commits · merged 2026-11-26 02:26 UTC

Two skin rendering fixes for #308: the light band under Lucia's jaw, and the line at Jason's pelvis.

1. Light band under the jaw (shading)

  • The band shows in lit renders only. The albedo, normals and white-diffuse debug modes show no band, so the cause was a shading term.
  • The viewer estimated the share of the surroundings a surface mirrors with a rough Fresnel term. On rough surfaces seen edge-on, such as skin under the jaw, this came to about 2.5 times the game's value.
  • The viewer now uses the game's environment BRDF table instead (r (F90 - F0) + g F0 at (N.V, roughness), times the multi-scatter gain 1 + (1/g - 1) F0), as the game's standard lighting does.
  • Ped heads have no tangent stream, but the game's head programs still build a tangent frame and apply the face normal map with it. The viewer drew heads with their smooth vertex normals alone. Meshes without a tangent stream now get a UV0 tangent frame, so faces show their pores and folds.

2. Line at the pelvis (hiding)

  • The upper and lower body skins both carry the same strip of skin around the waist. In the viewer the two copies z-fought, which drew a ragged line where the two skin textures meet.
  • The second byte of the _REGION stream is a region in a second layer, shared by both halves. On the upper skin it marks this strip (region 10).
  • Both body items hide region 10 of that layer, so when the lower half is worn, the upper half's copy is hidden. The viewer now applies this.
  • The doc comment of _REGION in gltf.rs now describes the second byte.

Renders (viewer on the RTX 4080; before = current master build, after = this PR):

  • Jason, bare body, pelvis: the ragged z-fighting band is gone, and the skin runs on without a seam.
  • Lucia, bare body, pelvis: no seam. The torso also shows its normal detail now (navel, muscle).
  • Lucia's face, front and 3/4: the pale band under the jaw is mostly gone, and the face shows its normal map.
  • Raina, 3/4: she had the same pale rim on master, and it is gone. On Cal the change is the face and neck detail only.
  • Rancher, 3/4: looks the same.

Checked

  • cargo test --release -p sixng-gui: 45 passed, 2 ignored.

Not done

  • A faint rim stays at the jaw edge. It is the reflection of the surroundings seen past the neck. The game takes that reflection from screen-space traced reflections, which would see the neck there; the viewer has a plain environment, so it does not.
  • Only Jason and Lucia are player characters in the outfit list. Named characters with clothes do not show the pelvis line, but any body skin with these regions gets the fix.
**@⁠holdmysocks** on GitHub · 2026-11-26 02:10 UTC · [original](https://github.com/holdmysocks/SixNG/pull/334) `holdmysocks:issue-308-shading` → `master` · +39 −11 · 8 files · 2 commits · merged 2026-11-26 02:26 UTC Two skin rendering fixes for #308: the light band under Lucia's jaw, and the line at Jason's pelvis. **1. Light band under the jaw (shading)** - The band shows in lit renders only. The albedo, normals and white-diffuse debug modes show no band, so the cause was a shading term. - The viewer estimated the share of the surroundings a surface mirrors with a rough Fresnel term. On rough surfaces seen edge-on, such as skin under the jaw, this came to about 2.5 times the game's value. - The viewer now uses the game's environment BRDF table instead (r (F90 - F0) + g F0 at (N.V, roughness), times the multi-scatter gain 1 + (1/g - 1) F0), as the game's standard lighting does. - Ped heads have no tangent stream, but the game's head programs still build a tangent frame and apply the face normal map with it. The viewer drew heads with their smooth vertex normals alone. Meshes without a tangent stream now get a UV0 tangent frame, so faces show their pores and folds. **2. Line at the pelvis (hiding)** - The upper and lower body skins both carry the same strip of skin around the waist. In the viewer the two copies z-fought, which drew a ragged line where the two skin textures meet. - The second byte of the `_REGION` stream is a region in a second layer, shared by both halves. On the upper skin it marks this strip (region 10). - Both body items hide region 10 of that layer, so when the lower half is worn, the upper half's copy is hidden. The viewer now applies this. - The doc comment of `_REGION` in `gltf.rs` now describes the second byte. **Renders** (viewer on the RTX 4080; before = current master build, after = this PR): - Jason, bare body, pelvis: the ragged z-fighting band is gone, and the skin runs on without a seam. - Lucia, bare body, pelvis: no seam. The torso also shows its normal detail now (navel, muscle). - Lucia's face, front and 3/4: the pale band under the jaw is mostly gone, and the face shows its normal map. - Raina, 3/4: she had the same pale rim on master, and it is gone. On Cal the change is the face and neck detail only. - Rancher, 3/4: looks the same. **Checked** - `cargo test --release -p sixng-gui`: 45 passed, 2 ignored. **Not done** - A faint rim stays at the jaw edge. It is the reflection of the surroundings seen past the neck. The game takes that reflection from screen-space traced reflections, which would see the neck there; the viewer has a plain environment, so it does not. - Only Jason and Lucia are player characters in the outfit list. Named characters with clothes do not show the pelvis line, but any body skin with these regions gets the fix.
- Viewer shader: the share of the surroundings a surface mirrors now comes from the game's
  environment BRDF table with its multi-scatter gain, as its standard lighting does. The rough
  Fresnel estimate it replaces gave about 2.5 times too much on rough skin seen edge-on, which
  drew a pale band under characters' jaws.
- Meshes with no tangent stream (ped heads) get a UV0 tangent frame, so the face normal map
  is applied as the game's head programs do.
- The second byte of a body skin's _REGION stream is a region in a second layer. Both body
  halves carry the waist strip and both hide it there, so the upper half's copy now goes
  when the lower half is worn. The two copies no longer z-fight at the pelvis.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:28:16 +00:00
github manually merged commit a0fced7d2d into gh-pr/334/base 2026-11-26 20:28:17 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.