Pre-integrated skin shading
Fakes skin subsurface scattering with a lookup texture of diffuse profiles integrated over a ring, indexed by N.L and surface curvature, so the soft terminator and red bleed appear in a single pass without screen-space blur.
Also known as pre-integrated subsurface scattering, curvature-based skin LUT
In the family Materials, BRDFs & texturing, subsurface scattering
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | Skin uses screen-space BaseMaterial3D.subsurf_scatter_enabled, not pre-integrated LUTs. |
| Unity | None found | HDRP uses screen-space Subsurface Scattering with diffusion profiles, not pre-integrated LUTs. |
| Unreal 5.7 | Built in | Material > Shading Model = Preintegrated Skin docs |
| Blender 5.2 | None found | Subsurface uses random-walk or Christensen-Burley. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Skin light bleeds across the terminator because light entering in the lit area scatters and leaves in the shadowed area. Penner precomputes this: for a sphere of radius r (curvature 1/r), integrate the lit diffuse falloff convolved with a skin diffusion profile around the ring, and store the result in a 2D LUT with N.L on one axis and curvature on the other. At runtime curvature comes from derivatives of the world normal over derivatives of position, or a baked map, and the LUT fetch replaces the Lambert term, giving red-tinted soft transitions on cheeks and noses. A second trick pre-integrates the shadow edge penumbra for skin in a 1D LUT. For normals, a blurred normal map is used for the diffuse and the sharp one for specular, with per-channel blurs simulating different scattering lengths (red wider than blue). Specular still uses a standard BRDF.
When to choose it
Reach for it when
- skin looks waxy or hard-edged at the terminator
- need cheap subsurface scattering for characters on mobile
- red bleed on shadow edge of faces
- cannot afford screen space blur for skin
- soft diffuse falloff depending on surface curvature
Choose it when characters need believable skin on mobile or at scale and a full-screen blur is unaffordable. Prefer Separable subsurface scattering when the budget allows screen-space blur and transmission (ears, thin regions). Prefer Christensen-Burley diffusion profile for offline or path-traced subsurface. For general materials with less critical bleeding, Oren-Nayar rough diffuse or wrap lighting suffices.
Field marks
- Curvature from screen-space derivatives is noisy and flickers on low-poly or normal-mapped skin
- Not shadow aware: light bleeding across shadow-map edges needs the separate shadow LUT
- Fixed profile and LUT cannot represent thin transmission such as ears or nostrils
- Sphere assumption makes flat regions with high-frequency normal detail look incorrectly soft
- Hard to tune per skin tone, as the LUT must be regenerated for each profile
Presets
Pre-integrated skin shading — curvature-driven RGB diffusion ring integral across the terminator
{
"CURVATURE": 1.15,
"SSS_STRENGTH": 0.9,
"SPECULAR": 0.45,
"ROUGHNESS": 0.36
}Show GLSL (129 lines)
const float CURVATURE = 1.15; // P
const float SSS_STRENGTH = 0.9; // P
const float SPECULAR = 0.45; // P
const float ROUGHNESS = 0.36; // P
float smin(float a, float b, float k) {
float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
return mix(b, a, h) - k * h * (1.0 - h);
}
// Sculptural organic form with broad low-curvature domes and tight high-curvature ridges
float mapOrganic(vec3 p) {
float a = iTime * 0.32;
mat2 r = mat2(cos(a), -sin(a), sin(a), cos(a));
p.xz = r * p.xz;
// Core cranial dome + sculpted cheek/nose/brow ridges for rich curvature variation
float head = length(p * vec3(1.08, 0.92, 1.02)) - 0.68;
float ridge1 = length(p - vec3(0.0, 0.02, 0.56)) - 0.16;
float ridge2 = length((p - vec3(0.0, 0.28, 0.46)) * vec3(0.65, 1.6, 1.2)) - 0.22;
float cheekL = length(p - vec3(-0.32, -0.08, 0.42)) - 0.24;
float cheekR = length(p - vec3( 0.32, -0.08, 0.42)) - 0.24;
float earL = length((p - vec3(-0.62, 0.02, -0.02)) * vec3(1.9, 0.72, 1.25)) - 0.19;
float earR = length((p - vec3( 0.62, 0.02, -0.02)) * vec3(1.9, 0.72, 1.25)) - 0.19;
float neck = length(vec2(length(p.xz - vec2(0.0, -0.08)) - 0.28, max(abs(p.y + 0.78) - 0.32, 0.0))) - 0.04;
float d = smin(head, ridge1, 0.14);
d = smin(d, ridge2, 0.16);
d = smin(d, min(cheekL, cheekR), 0.18);
d = smin(d, min(earL, earR), 0.10);
d = smin(d, neck, 0.18);
// Subtle pore-like micro-undulation
d += 0.004 * sin(p.x * 26.0) * sin(p.y * 26.0) * sin(p.z * 26.0);
return d;
}
vec3 calcNormal(vec3 p) {
vec2 e = vec2(0.0025, 0.0);
return normalize(vec3(
mapOrganic(p + e.xyy) - mapOrganic(p - e.xyy),
mapOrganic(p + e.yxy) - mapOrganic(p - e.yxy),
mapOrganic(p + e.yyx) - mapOrganic(p - e.yyx)
));
}
// Penner (SIGGRAPH 2011) pre-integrated skin ring convolution evaluated directly in RGB
vec3 preIntegratedSkinLUT(float nl, float curv) {
float theta = acos(clamp(nl, -1.0, 1.0));
float r = 1.0 / max(curv, 0.08);
// Multi-Gaussian skin diffusion profile (wider red radius than green/blue)
vec3 acc = vec3(0.0);
vec3 wSum = vec3(0.0);
const int N = 16;
for (int i = -N; i <= N; i++) {
float dTheta = float(i) * (1.85 / float(N));
float s = 2.0 * r * sin(abs(dTheta) * 0.5);
float s2 = s * s;
vec3 prof = vec3(
0.233 * exp(-s2 / 0.0128) + 0.455 * exp(-s2 / 0.22) + 0.312 * exp(-s2 / 1.45),
0.455 * exp(-s2 / 0.0128) + 0.410 * exp(-s2 / 0.09) + 0.135 * exp(-s2 / 0.36),
0.649 * exp(-s2 / 0.0128) + 0.280 * exp(-s2 / 0.04) + 0.071 * exp(-s2 / 0.15)
);
float lit = max(cos(theta + dTheta), 0.0);
acc += prof * lit;
wSum += prof;
}
return acc / max(wSum, vec3(1e-4));
}
float D_GGX(float nh, float a) {
float a2 = a * a;
float d = nh * nh * (a2 - 1.0) + 1.0;
return a2 / (3.14159265 * d * d + 1e-5);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec3 ro = vec3(0.0, 0.02, 2.35);
vec3 rd = normalize(vec3(uv, -1.55));
float t = 0.2;
bool hit = false;
for (int i = 0; i < 64; i++) {
float d = mapOrganic(ro + rd * t);
if (d < 0.002) { hit = true; break; }
t += d * 0.85;
if (t > 6.0) break;
}
vec3 bg = mix(vec3(0.04, 0.05, 0.075), vec3(0.11, 0.12, 0.16), clamp(uv.y + 0.5, 0.0, 1.0));
if (!hit) {
fragColor = vec4(pow(clamp(aces(bg), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
return;
}
vec3 p = ro + rd * t;
vec3 n = calcNormal(p);
// Screen-space geometric curvature |dN| / |dP| as in Penner 2011
float curv = clamp(length(fwidth(n)) / max(length(fwidth(p)), 1e-4), 0.25, 4.5) * max(CURVATURE, 0.05);
float lAng = 0.72 + 0.45 * sin(iTime * 0.5);
if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
lAng = (iMouse.x / iResolution.x - 0.5) * 3.14159;
}
vec3 L = normalize(vec3(sin(lAng), 0.38, cos(lAng)));
vec3 V = -rd;
float nl = dot(n, L);
vec3 lambert = vec3(max(nl, 0.0));
vec3 sssDiff = preIntegratedSkinLUT(nl, curv);
vec3 diffTerm = mix(lambert, sssDiff, clamp(SSS_STRENGTH, 0.0, 1.5));
vec3 skinAlbedo = vec3(0.84, 0.58, 0.46);
vec3 H = normalize(L + V);
float nh = max(dot(n, H), 0.0);
float ndv = max(dot(n, V), 0.01);
float fres = 0.028 + 0.972 * pow(1.0 - max(dot(V, H), 0.0), 5.0);
float r1 = clamp(ROUGHNESS, 0.08, 0.95);
// Dual-lobe oily skin specular
float spec = (0.75 * D_GGX(nh, r1 * r1) + 0.25 * D_GGX(nh, r1 * r1 * 0.22)) * fres * max(SPECULAR, 0.0) * max(nl, 0.0);
// Soft cool rim bounce + warm subsurface backlight
float backScatter = pow(clamp(dot(-L, V), 0.0, 1.0), 3.0) * pow(1.0 - ndv, 2.0) * clamp(curv * 0.4, 0.0, 1.0);
vec3 col = skinAlbedo * (diffTerm * vec3(1.65, 1.52, 1.38) + vec3(0.06, 0.08, 0.13)) + vec3(spec) * vec3(1.0, 0.95, 0.90) + vec3(0.85, 0.16, 0.06) * backScatter * SSS_STRENGTH;
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| pre-integrated-skin-shading-live | Tesla T4 1920x1080 | 48.2× baseline (heavy) · 1.59 ms / 1.62 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| pre-integrated-skin-shading-live | NVIDIA L4 1920x1080 | 38.5× baseline (heavy) · 0.613 ms / 0.632 ms · 2.6× faster on L4 | opengl-timer-query · Cross-architecture validation |
| pre-integrated-skin-shading-live | NVIDIA A100-SXM4-40GB 1920x1080 | 30.8× baseline (heavy) · 0.888 ms / 0.901 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
Crosses
- Curvature map generation for edge wear and masking: A baked curvature map replaces noisy derivative-based curvature as the LUT's second axis.
Sources
- primaryEric Penner. Pre-Integrated Skin Shading. advances.realtimerendering.com.Verified via live page · 2026-11-29
- secondaryEugene d'Eon, David Luebke. Chapter 14. Advanced Techniques for Realistic Real-Time Skin Rendering. developer.nvidia.com.Verified via live page · 2026-11-29