Golf ball: a dimple bump map on a sphere
The golf-ball dimple height field from the bump map explorer is turned into a tangent-space normal map (RGB) with the height in alpha. The sphere can be lit with those normals alone (bump mapping), or its vertices can also be pushed in by the height map (displacement mapping). The dimple field can be laid out in rings fitted to the sphere, or naively as one uniform lattice in (u, v).
- Mapping. u is longitude and v is latitude (v = 0 at the north pole), so one texture covers the whole ball. The tangent frame comes straight from the sphere: T points east, N is the surface normal and B = N × T points south, so v increases along B and the frame is right-handed, as in the explorer.
- Rings vs naive. The explorer's dimples sit on one hexagonal lattice in (u, v). On a sphere that lattice is stretched 2:1 east–west (u covers 2π, v only π) and squeezed together toward the poles, so the dimples become ellipses that shrink to slivers. Rings fixes this: each ring of dimples has a number of dimples proportional to the sine of its latitude, so the dimples stay about the same size everywhere. Tint the dimples by ring to see the structure. The profile is the explorer's cap, sqrt(1 − d²), in both.
- Displacement. The vertex shader reads the height from the texture and moves each vertex of a 512 × 256 mesh inward along the normal by depth × (1 − height). Unlike bump mapping this changes the silhouette: lower the camera and zoom in, and raise the depth to see the dimpled edge. "Vertices only" derives the normals from height differences at the mesh spacing, so the shading is limited by the mesh, which is why the normal map is still useful on top of displacement.
- Normals. Slopes are computed from the height differences in physical units (the east–west texel is 2π sin θ / width wide, the north–south one π / height), so the dimple shading is the same at every latitude. Edges wrap in u and clamp in v.
- Shading. Diffuse and Blinn-Phong specular in tangent space, a cheap occlusion term from the stored height, a faint sky reflection, and a Toksvig-style widening of the highlight where mip filtering has shortened the normal.
- Limits. With displacement off the edge of the ball stays a smooth circle, because bump mapping changes only the lighting.