Skin translucency: the game's subsurface profiles, shaded and exported #483

Manually merged
github merged 1 commit from github-bot/gh-483 into gh-pr/483/base 2026-11-27 18:13:18 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 18:04 UTC · original
holdmysocks:people-skin-translucency → master · +220 −21 · 7 files · 1 commits · merged 2026-11-27 18:12 UTC

Part of #392: ped skin translucency, from the game's own subsurface profiles.

What was found

  • Profile file. The skin lighting reads a per-entity translucency profile from a table that the engine fills from a metadata file (data-file type 355, .zmt). No meta resource or carved PSO has that layout. The file is a data.rpf PSO that only the table of contents reaches (toc-extract). The game executable's parser table (exeschema) gives its layout:
    • root struct a0ec2837: an array of 73bc6e91 records plus two floats;
    • each record: name, scatterColor, scatterDistance, a thickness range, an exponent and a kind enum.
  • Ten profiles. Three names are recovered: skin_default, eye_default and animal_default. Four unnamed records are copies of skin_default.
  • Radii. d = max((byte / 255)^2 x scatterDistance, 1e-5) per colour channel, from the engine's table builder. For skin_default that is 1.5, 0.025 and 0.004 mm for red, green and blue, with a thickness of 0.5 to 40 mm and an exponent of 1.3. So thin skin passes red light only.
  • Per light. The game adds 0.17182 T (2 + 0.75 / (1.25 + L.V)^1.5) to the diffuse light, times the light colour and a shadow term, with no N.L. T is the Burley-style transmittance through that thickness.

What changed

  • skinspec: the SssProfile type with its radii, thickness and transmittance, and the SKIN_DEFAULT values. extras.skin_spec.translucency now records the profile.
  • Export. Where a skin spec map has translucent pixels, the export bakes <spec>_sss.png and the material gets KHR_materials_diffuse_transmission from it:
    • RGB: the colour of the transmittance;
    • alpha: the factor, 2 x 0.17182 x max(T), which is the term without its angle part.
  • Viewer. It shades the game's per-light term for the sun.

Not traced

  • Which profile slot a ped draws with. The engine sets it per entity at run time. The profile name map is only read when the file loads, and the writer of the slot is not found. Ped skin takes skin_default.
  • The two per-ped detail values (record 3b316b01 +0x74 and +0x30). They are still taken as 1; no static writer was found.

Checked

  • sixng-core tests: 389 pass, including a new profile test. sixng-gui tests: 57 pass. The release build is OK.
  • cs_jason export. Its hand and foot spec maps have red of at most 1/255, so a thickness of about 40 mm and no transmission. The export writes none for them. The teeth do get the extension.
  • Viewer. The cs_jason render on the RTX 4080 is unchanged and shows no faults.
**@⁠holdmysocks** on GitHub · 2026-11-27 18:04 UTC · [original](https://github.com/holdmysocks/SixNG/pull/483) `holdmysocks:people-skin-translucency` → `master` · +220 −21 · 7 files · 1 commits · merged 2026-11-27 18:12 UTC Part of #392: ped skin translucency, from the game's own subsurface profiles. ## What was found - **Profile file.** The skin lighting reads a per-entity translucency profile from a table that the engine fills from a metadata file (data-file type 355, `.zmt`). No meta resource or carved PSO has that layout. The file is a data.rpf PSO that only the table of contents reaches (`toc-extract`). The game executable's parser table (`exeschema`) gives its layout: - root struct `a0ec2837`: an array of `73bc6e91` records plus two floats; - each record: `name`, `scatterColor`, `scatterDistance`, a thickness range, an exponent and a kind enum. - **Ten profiles.** Three names are recovered: `skin_default`, `eye_default` and `animal_default`. Four unnamed records are copies of `skin_default`. - **Radii.** `d = max((byte / 255)^2 x scatterDistance, 1e-5)` per colour channel, from the engine's table builder. For `skin_default` that is 1.5, 0.025 and 0.004 mm for red, green and blue, with a thickness of 0.5 to 40 mm and an exponent of 1.3. So thin skin passes red light only. - **Per light.** The game adds `0.17182 T (2 + 0.75 / (1.25 + L.V)^1.5)` to the diffuse light, times the light colour and a shadow term, with no N.L. `T` is the Burley-style transmittance through that thickness. ## What changed - `skinspec`: the `SssProfile` type with its radii, thickness and transmittance, and the `SKIN_DEFAULT` values. `extras.skin_spec.translucency` now records the profile. - **Export.** Where a skin spec map has translucent pixels, the export bakes `<spec>_sss.png` and the material gets `KHR_materials_diffuse_transmission` from it: - RGB: the colour of the transmittance; - alpha: the factor, `2 x 0.17182 x max(T)`, which is the term without its angle part. - **Viewer.** It shades the game's per-light term for the sun. ## Not traced - **Which profile slot a ped draws with.** The engine sets it per entity at run time. The profile name map is only read when the file loads, and the writer of the slot is not found. Ped skin takes `skin_default`. - **The two per-ped detail values** (record `3b316b01` +0x74 and +0x30). They are still taken as 1; no static writer was found. ## Checked - `sixng-core` tests: 389 pass, including a new profile test. `sixng-gui` tests: 57 pass. The release build is OK. - **cs_jason export.** Its hand and foot spec maps have red of at most 1/255, so a thickness of about 40 mm and no transmission. The export writes none for them. The teeth do get the extension. - **Viewer.** The cs_jason render on the RTX 4080 is unchanged and shows no faults.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:07:55 +00:00
github-bot changed target branch from master to gh-pr/483/base 2026-11-27 18:13:16 +00:00
github manually merged commit 485876f829 into gh-pr/483/base 2026-11-27 18:13:18 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.