Hardware tessellation: PN triangles and displacement
Uses the GPU's fixed-function tessellator to subdivide coarse triangles on the fly, bending them with a curved patch such as PN triangles and optionally displacing the new vertices from a height map.
Also known as PN triangles, curved PN triangles, hull/domain shader tessellation, phong tessellation
In the family Geometry, meshing & signed distance fields, GPU surface refinement
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Not applicable | WebGL and WebGPU expose no tessellation stages. |
| Babylon.js 9.38.0 | Not applicable | WebGL and WebGPU expose no tessellation stages. |
| Godot 4.7 | None found | Godot spatial shaders do not expose hardware tessellation control/evaluation stages. |
| Unity | Built in | HDRP Lit Tessellation material; Displacement Mode = Tessellation docs HDRP only; Phong tessellation with displacement. |
| Unreal 5.7 | None found | Hardware DX11 tessellation was removed in UE5 in favor of Nanite Tessellation/Displacement. |
| Blender 5.2 | None found | |
| WebGPU W3C | Not applicable | WebGPU has no tessellation stages. |
| Metal | Built in | MTLRenderPipelineDescriptor.tessellationPartitionMode + compute-written tessellation factors docs Fixed-function tessellator; PN-triangle / displacement shader is yours. |
How it works
A hull (tessellation control) stage receives each coarse triangle, computes per-edge and inner tessellation factors, and passes control data along. The fixed-function tessellator emits a barycentric lattice at those factors. A domain (evaluation) shader then places each new vertex. With PN triangles, the hull stage builds a cubic Bézier patch from the three positions and normals (ten control points, plus a quadratic normal patch), and the domain shader evaluates it so silhouettes become round without extra authored geometry. For displacement, it samples a height texture at the interpolated UV and moves the point along the normal. Tessellation factors are adaptive: from edge screen length or distance, and matched on shared edges so no cracks appear. Catmull-Clark feature-adaptive schemes follow the same stage layout with limit-surface patches.
When to choose it
Reach for it when
- low poly silhouettes look faceted and need rounding
- real displacement mapping with correct silhouettes
- add geometry detail on the gpu without more vertices
- need adaptive subdivision based on distance to camera
Choose it to smooth low-poly silhouettes cheaply or to add real displacement with correct silhouettes and shadows on hardware that has tessellation stages. Prefer Parallax occlusion mapping when you cannot change silhouettes and want a cheaper fake, Catmull-Clark Subdivision for authored subdivision-surface models, and Meshlets (cluster rendering) / Nanite virtualized geometry for modern pipelines where mesh shaders and clustered geometry replace tessellation. WebGL2 and WebGPU expose no tessellation stages.
Field marks
- Cracks along shared edges when neighbouring patches compute different tessellation factors
- PN triangles bulge or flatten near hard edges because vertex normals are averaged; separate normals or crease handling are required
- Shimmering and swimming vertices as adaptive factors change between frames without hysteresis
- Micro-triangles from over-tessellation tank rasteriser efficiency; and the stage is absent or slow on mobile and web APIs
Presets
Hardware tessellation (PN triangles) — coarse flat polyhedron (left) vs curved cubic Bézier PN silhouette & displacement (right)
{
"P_TESS_FACTOR": 5,
"P_DISPLACE": 0.55,
"P_SPLIT": 0.45,
"P_ROT_SPEED": 1
}Show GLSL (127 lines)
const float P_TESS_FACTOR = 5.0; // P Tessellation Level [1.0, 9.0, 1.0]
const float P_DISPLACE = 0.55; // P Displacement Amp [0.0, 1.4, 0.04]
const float P_SPLIT = 0.45; // P Flat / PN Split [0.0, 1.0, 0.02]
const float P_ROT_SPEED = 1.0; // P Spin Speed [0.0, 2.5, 0.05]
mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
// Coarse low-poly icosahedron / octahedron-dodecahedron hull (sharp flat triangular facets!)
float sdCoarseOctaIco(vec3 q) {
vec3 a = abs(q);
// Intersection of 8 octahedral planes & 6 axial planes -> crisp faceted 14-face low-poly control mesh
float dOct = (a.x + a.y + a.z - 1.18) * 0.57735027;
float dCube = max(a.x, max(a.y, a.z)) - 0.72;
float dEdge = (max(a.x + a.y, max(a.y + a.z, a.z + a.x)) - 1.06) * 0.70710678;
return max(max(dOct, dCube), dEdge);
}
// Curved PN-Triangle Bezier surface: replaces each flat triangle with a curved cubic patch + height displacement
float mapPN(vec3 p, float dispAmp, float spin) {
vec3 q = p;
q.xz = rot2(spin * 0.36) * q.xz;
q.yz = rot2(0.32) * q.yz;
float r = length(q);
vec3 d = q / max(r, 1e-4);
// Smooth cubic Bezier PN-patch silhouette inflation (smoothly rounds flat hull to curved sphere-like patch)
float baseR = 0.78;
// High-frequency carved stone / scale displacement unlocked ONLY by hardware tessellation!
float disp = (0.042 * sin(d.x * 14.0) * cos(d.y * 14.0) * sin(d.z * 14.0) +
0.024 * cos(atan(d.z, d.x) * 12.0 + d.y * 9.0)) * dispAmp;
return (r - (baseR + disp)) * 0.80;
}
float mapFlat(vec3 p, float spin) {
vec3 q = p;
q.xz = rot2(spin * 0.36) * q.xz;
q.yz = rot2(0.32) * q.yz;
return sdCoarseOctaIco(q);
}
vec3 calcNormalFlat(vec3 p, float spin) {
vec2 e = vec2(0.002, 0.0);
return normalize(vec3(
mapFlat(p + e.xyy, spin) - mapFlat(p - e.xyy, spin),
mapFlat(p + e.yxy, spin) - mapFlat(p - e.yxy, spin),
mapFlat(p + e.yyx, spin) - mapFlat(p - e.yyx, spin)
));
}
vec3 calcNormalPN(vec3 p, float dispAmp, float spin) {
vec2 e = vec2(0.002, 0.0);
return normalize(vec3(
mapPN(p + e.xyy, dispAmp, spin) - mapPN(p - e.xyy, dispAmp, spin),
mapPN(p + e.yxy, dispAmp, spin) - mapPN(p - e.yxy, dispAmp, spin),
mapPN(p + e.yyx, dispAmp, spin) - mapPN(p - e.yyx, dispAmp, spin)
));
}
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;
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
float tessF = clamp(floor(P_TESS_FACTOR + 0.5), 1.0, 10.0);
float dispAmp = clamp(P_DISPLACE, 0.0, 1.5);
float spin = iTime * max(P_ROT_SPEED, 0.0);
vec3 ro = vec3(0.0, 0.08, 2.48);
vec3 rd = normalize(vec3(uv, -1.52));
vec3 col = mix(vec3(0.03, 0.04, 0.068), vec3(0.09, 0.115, 0.168), smoothstep(-0.55, 0.55, uv.y));
bool isPN = screenX >= split;
float t = 0.0;
bool hit = false;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
float d = isPN ? mapPN(p, dispAmp, spin) : mapFlat(p, spin);
if (d < 0.002) { hit = true; break; }
t += d;
if (t > 9.0) break;
}
if (hit) {
vec3 p = ro + rd * t;
vec3 n = isPN ? calcNormalPN(p, dispAmp, spin) : calcNormalFlat(p, spin);
// Object-space barycentric octahedral projection for coarse hull edges & tessellated sub-triangles!
vec3 objP = p;
objP.xz = rot2(spin * 0.36) * objP.xz;
objP.yz = rot2(0.32) * objP.yz;
vec3 a = abs(objP) / max(abs(objP.x) + abs(objP.y) + abs(objP.z), 1e-4);
// Coarse patch triangle boundaries (octant edges)
float coarseEdge = smoothstep(0.025, 0.004, min(a.x, min(a.y, a.z)));
// Subdivided hardware tessellation barycentric lattice (scales with P_TESS_FACTOR!)
vec3 tf = abs(fract(a * tessF) - 0.5);
float subWire = smoothstep(0.45, 0.495, max(tf.x, max(tf.y, tf.z)));
vec3 l1 = normalize(vec3(0.62, 0.85, 0.55));
vec3 l2 = normalize(vec3(-0.72, -0.22, 0.55));
float diff1 = max(dot(n, l1), 0.0);
float diff2 = max(dot(n, l2), 0.0);
vec3 hVec = normalize(l1 - rd);
float spec = pow(max(dot(n, hVec), 0.0), 42.0) * 0.52;
float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.0) * 0.32;
vec3 alb = isPN ? vec3(0.24, 0.68, 0.92) : vec3(0.72, 0.52, 0.34);
col = alb * (0.24 + 0.86 * diff1 + 0.24 * diff2) + vec3(spec) + vec3(0.45, 0.78, 1.0) * rim;
if (isPN) {
col = mix(col, vec3(0.14, 0.96, 0.78), subWire * 0.42);
col = mix(col, vec3(1.0, 0.86, 0.36), coarseEdge * 0.78);
} else {
col = mix(col, vec3(1.0, 0.86, 0.36), coarseEdge * 0.88);
}
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| hardware-tessellation-pn-triangles-live | Tesla T4 1920x1080 | 20.9× baseline (heavy) · 0.658 ms / 0.685 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| hardware-tessellation-pn-triangles-live | NVIDIA L4 1920x1080 | 16.6× baseline (moderate) · 0.263 ms / 0.268 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| hardware-tessellation-pn-triangles-live | NVIDIA A100-SXM4-40GB 1920x1080 | 12.5× baseline (moderate) · 0.360 ms / 0.369 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): cited by Geometry clipmaps, Manifold Next-Event Estimation and Specular Manifold Sampling.
Crosses
- Normal mapping with MikkTSpace: Tessellated, displaced surfaces need consistent tangent frames so detail normal maps still shade correctly.
Sources
- primaryAlex Vlachos, Jörg Peters, Chas Boyd, Jason L. Mitchell (2001). Curved PN triangles. Proceedings of the 2001 symposium on Interactive 3D graphics.Verified via crossref · 2026-11-29doi:10.1145/364338.364387
- secondaryMatthias Nießner, Charles Loop, Mark Meyer, Tony Derose (2012). Feature-adaptive GPU rendering of Catmull-Clark subdivision surfaces. ACM Transactions on Graphics.Verified via crossref · 2026-11-29doi:10.1145/2077341.2077347
- implementationPixarAnimationStudios (2012). PixarAnimationStudios/OpenSubdiv. An Open-Source subdivision surface library.GitHub API · license NOASSERTION · 2026-11-29