Texel A field guide to 3D techniques

Single-photo SVBRDF capture × Image quilting × Hex-tiling

One phone photo, a whole floor. A flash photo of a small material patch becomes a PBR material that covers a large area without visible repetition. Every map is quilted with the same seams and tiled with the same hex offsets, so albedo, normal and roughness stay registered.

Open in StudioReproduced333× · 10.3 ms

Single-photo SVBRDF captureMaterial · Interactivein: photosout: material-params, texturetextureImage quiltingMaterial · Offlinein: textureout: texturetextureHex-tilingMaterial · Real-timein: textureout: texture

Verified proof

reproduced · 2026-12-01texel-lablicense MIT
Specimen render of One-photo endless PBR (left: tiled single SVBRDF patch, right: joint quilted + hex-tiled SVBRDF)
Cross-proof specimen. One-photo endless PBR (left: tiled single SVBRDF patch, right: joint quilted + hex-tiled SVBRDF). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing naive periodic tiling of a single flash-captured SVBRDF stone patch (left, exhibiting harsh seams and glaring grid repetition to the horizon) against joint multi-channel image quilting fed into runtime hex-tiling with shared hashes, histogram-preserving contrast restoration, and surface-gradient normal blending (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · eliminates visible tile grid periodicity across a perspective floor while maintaining crisp registered GGX specular micro-relief and albedo variance

Show GLSL proof (198 lines)
const float P_TILE_SCALE = 3.20; // P Floor Scale [1.0, 8.0, 0.1]
const float P_HEX_BLEND = 1.00; // P Hex De-Tiling [0.0, 1.0, 0.02]
const float P_QUILT_JITTER = 0.85; // P Quilt Seam Strength [0.0, 1.5, 0.05]
const float P_HISTO_PRESERVE = 0.92; // P Contrast Preservation [0.0, 1.0, 0.02]

vec2 hash22(vec2 p) {
  vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
  p3 += dot(p3, p3.yzx + 33.33);
  return fract((p3.xx + p3.yz) * p3.zy);
}

float vnoise(vec2 p) {
  vec2 i = floor(p);
  vec2 f = fract(p);
  vec2 u = f * f * (3.0 - 2.0 * f);
  float a = hash22(i).x;
  float b = hash22(i + vec2(1.0, 0.0)).x;
  float c = hash22(i + vec2(0.0, 1.0)).x;
  float d = hash22(i + vec2(1.0, 1.0)).x;
  return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}

float fbm(vec2 p) {
  float s = 0.0;
  float a = 0.5;
  mat2 m = mat2(0.80, 0.60, -0.60, 0.80);
  for (int i = 0; i < 4; i++) {
    s += a * vnoise(p);
    p = m * p * 2.04 + vec2(7.3, 4.1);
    a *= 0.5;
  }
  return s;
}

// Single flash-photo captured SVBRDF exemplar defined on [0,1)^2 (distinctive volcanic slate + quartz vein + pitted pebble)
void sampleExemplarPatch(vec2 uv01, out vec3 alb, out float h, out float rough) {
  vec2 p = clamp(uv01, 0.0, 1.0);
  float base = fbm(p * 5.5 + vec2(2.1, 1.4));
  float micro = fbm(p * 22.0 + vec2(8.4, 3.7));
  // Distinctive diagonal quartz vein + dark iron nodule (makes naive repetition immediately obvious)
  float veinDist = abs((p.x - 0.52) * 0.85 + (p.y - 0.45) * 0.52 + 0.09 * sin(p.y * 12.0 + base * 4.0));
  float vein = exp(-veinDist * veinDist * 480.0);
  float nodule = exp(-dot(p - vec2(0.28, 0.72), p - vec2(0.28, 0.72)) * 38.0);
  float warmClast = exp(-dot(p - vec2(0.76, 0.30), p - vec2(0.76, 0.30)) * 45.0);
  float pit = smoothstep(0.68, 0.85, fbm(p * 14.0 + vec2(13.0, 5.0)));

  // Albedo with realistic captured mineral variation
  alb = mix(vec3(0.16, 0.17, 0.19), vec3(0.38, 0.36, 0.33), base);
  alb = mix(alb, vec3(0.78, 0.74, 0.65), vein * 0.82);
  alb = mix(alb, vec3(0.08, 0.09, 0.11), nodule * 0.72);
  alb = mix(alb, vec3(0.54, 0.34, 0.22), warmClast * 0.68);
  alb *= (0.86 + 0.26 * micro) * (1.0 - 0.32 * pit);

  // Registered height and roughness from single-photo SVBRDF estimator
  h = base * 0.45 + micro * 0.14 + vein * 0.18 + warmClast * 0.12 - pit * 0.34 - nodule * 0.10;
  rough = clamp(0.66 - vein * 0.44 - warmClast * 0.22 + pit * 0.26 + (micro - 0.5) * 0.18, 0.14, 0.94);
}

// Evaluate exemplar + analytic surface gradient dh/duv
void evalExemplarGrad(vec2 uv01, out vec3 alb, out vec2 grad, out float rough) {
  float h0; vec3 a1; float hx; float r1; vec3 a2; float hy; float r2;
  sampleExemplarPatch(uv01, alb, h0, rough);
  float eps = 0.008;
  sampleExemplarPatch(clamp(uv01 + vec2(eps, 0.0), 0.0, 1.0), a1, hx, r1);
  sampleExemplarPatch(clamp(uv01 + vec2(0.0, eps), 0.0, 1.0), a2, hy, r2);
  grad = vec2(hx - h0, hy - h0) / eps;
}

// Joint multi-channel image-quilted patch: minimum-error wavy seam cut shared across albedo, gradient, and roughness
void sampleQuiltedSVBRDF(vec2 uv, out vec3 alb, out vec2 grad, out float rough) {
  vec2 p = fract(uv);
  // Overlap patch shifted by (0.5, 0.5) to hide exemplar borders via minimum-error seam
  vec2 pB = fract(uv + vec2(0.5, 0.5));
  vec3 aA; vec2 gA; float rA;
  vec3 aB; vec2 gB; float rB;
  evalExemplarGrad(p, aA, gA, rA);
  evalExemplarGrad(pB, aB, gB, rB);
  // Minimum-error path distortion steered by luminance agreement between overlapping patches
  float err = length(aA - aB);
  float waveX = (vnoise(uv * 5.0) - 0.5) * 0.22 * P_QUILT_JITTER;
  float waveY = (vnoise(uv * 5.0 + 19.3) - 0.5) * 0.22 * P_QUILT_JITTER;
  vec2 borderDist = min(p, 1.0 - p) + vec2(waveX, waveY) * (1.0 - err * 0.65);
  float seamMask = smoothstep(0.05, 0.19, min(borderDist.x, borderDist.y));
  // All channels cut with the exact same seamMask so albedo, normal gradient, and roughness stay registered
  alb = mix(aB, aA, seamMask);
  grad = mix(gB, gA, seamMask);
  rough = mix(rB, rA, seamMask);
}

// Runtime hex-tiling (Mikkelsen 2022) with shared hash offsets, histogram-preserving color blend, and surface-gradient normal blend
void sampleHexTiledSVBRDF(vec2 uv, out vec3 alb, out vec2 grad, out float rough) {
  // Skew world UV into triangular lattice of hex centers
  vec2 p = uv * 1.1547;
  mat2 toTri = mat2(1.0, 0.0, -0.5773503, 1.1547005);
  vec2 st = toTri * p;
  vec2 i = floor(st);
  vec2 f = fract(st);
  vec2 v1, v2, v3;
  vec3 w;
  if (f.x + f.y < 1.0) {
    v1 = i; v2 = i + vec2(1.0, 0.0); v3 = i + vec2(0.0, 1.0);
    w = vec3(1.0 - f.x - f.y, f.x, f.y);
  } else {
    v1 = i + vec2(1.0, 1.0); v2 = i + vec2(1.0, 0.0); v3 = i + vec2(0.0, 1.0);
    w = vec3(f.x + f.y - 1.0, 1.0 - f.y, 1.0 - f.x);
  }
  // Sharpen barycentric weights to reduce ghosting while staying smooth
  w = pow(max(w, vec3(1e-4)), vec3(3.2));
  w /= (w.x + w.y + w.z);

  // Shared random offset per hex vertex for all SVBRDF maps
  vec2 o1 = hash22(v1 * 1.37 + 3.1) * P_HEX_BLEND;
  vec2 o2 = hash22(v2 * 1.37 + 3.1) * P_HEX_BLEND;
  vec2 o3 = hash22(v3 * 1.37 + 3.1) * P_HEX_BLEND;

  vec3 a1, a2, a3; vec2 g1, g2, g3; float r1, r2, r3;
  sampleQuiltedSVBRDF(uv + o1, a1, g1, r1);
  sampleQuiltedSVBRDF(uv + o2, a2, g2, r2);
  sampleQuiltedSVBRDF(uv + o3, a3, g3, r3);

  // Histogram / variance-preserving albedo blend (prevents washed-out grey mud in blend zones)
  vec3 meanAlb = vec3(0.28, 0.27, 0.26);
  vec3 linAlb = w.x * a1 + w.y * a2 + w.z * a3;
  float invStd = 1.0 / sqrt(max(dot(w, w), 0.34));
  alb = clamp(meanAlb + (linAlb - meanAlb) * mix(1.0, invStd, P_HISTO_PRESERVE), 0.02, 0.96);

  // Surface-gradient normal blending (linear combination of tangent height derivatives)
  grad = (w.x * g1 + w.y * g2 + w.z * g3) * mix(1.0, invStd, 0.55 * P_HISTO_PRESERVE);
  rough = clamp(w.x * r1 + w.y * r2 + w.z * r3, 0.14, 0.95);
}

vec3 acesTone(vec3 x) {
  return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  bool useHexQuilt = uv.x > 0.0;
  vec2 suv = vec2(useHexQuilt ? (uv.x - 0.25) : (uv.x + 0.25), uv.y);

  // Perspective camera sweeping slowly over an expansive architectural floor
  vec3 ro = vec3(0.0, 1.55, -iTime * 0.45);
  vec3 rd = normalize(vec3(suv.x * 1.15, suv.y - 0.42, -1.25));

  // Studio gallery backdrop above horizon
  vec3 sky = mix(vec3(0.14, 0.16, 0.20), vec3(0.04, 0.05, 0.08), clamp(rd.y * 3.0 + 0.2, 0.0, 1.0));
  vec3 col = sky;

  if (rd.y < -0.01) {
    float t = -ro.y / rd.y;
    vec3 wp = ro + rd * t;
    vec2 matUV = wp.xz * (P_TILE_SCALE * 0.36);

    vec3 alb; vec2 grad; float rough;
    if (!useHexQuilt) {
      // Left: naive periodic tiling of the single-photo SVBRDF patch
      evalExemplarGrad(fract(matUV), alb, grad, rough);
    } else {
      // Right: joint multi-channel quilted + runtime hex-tiled SVBRDF
      sampleHexTiledSVBRDF(matUV, alb, grad, rough);
    }

    vec3 N = normalize(vec3(-grad.x * 0.26, 1.0, -grad.y * 0.26));
    vec3 V = -rd;

    // Orbiting warm raking light to inspect registered normal + roughness specular across seams
    vec3 lightPos = vec3(2.4 * sin(iTime * 0.55), 1.65, ro.z - 4.2 + 1.4 * cos(iTime * 0.55));
    vec3 Lvec = lightPos - wp;
    float lDist = length(Lvec);
    vec3 L = Lvec / lDist;
    vec3 H = normalize(L + V);
    float ndl = max(dot(N, L), 0.0);
    float ndv = max(dot(N, V), 0.02);
    float ndh = max(dot(N, H), 0.0);
    float vdh = max(dot(V, H), 0.0);

    // GGX PBR shading
    float a = rough * rough;
    float a2 = a * a;
    float denom = ndh * ndh * (a2 - 1.0) + 1.0;
    float D = a2 / (3.1415926 * denom * denom + 1e-5);
    float F = 0.04 + 0.96 * pow(1.0 - vdh, 5.0);
    float G = 1.0 / (1.0 + 0.5 * a / max(ndv, 0.08));
    vec3 spec = vec3(D * F * G * 0.25);
    vec3 diff = alb * (1.0 - F) / 3.1415926;
    float atten = 28.0 / (2.5 + lDist * lDist);

    vec3 warmLight = vec3(1.15, 0.88, 0.62) * atten * ndl;
    vec3 coolFill = vec3(0.20, 0.26, 0.36) * (0.45 + 0.55 * N.y);
    vec3 surf = (diff + spec) * warmLight + alb * coolFill + spec * vec3(0.28, 0.34, 0.44) * 0.25;

    float fog = 1.0 - exp(-t * 0.042);
    col = mix(surf, sky, clamp(fog, 0.0, 0.88));
  }
  col = acesTone(col * 1.18);
  if (abs(uv.x) < 0.003) col = vec3(0.95, 0.92, 0.86);
  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}

Why they connect

Single-photo SVBRDF capture outputs material-params and texture maps (diffuse, specular, roughness, normals) for the photographed patch. Image quilting takes those textures as one stacked multi-channel exemplar, so a single minimum-error cut is shared by every map, and outputs a larger tileable texture. Hex-tiling then takes that texture at runtime and breaks repetition with three randomly offset hex cells per pixel, using the same hash for every map and combining normals as surface gradients so lighting stays consistent across blends.

How to build it

Capture a phone photo with flash, roughly fronto-parallel, and crop it square. Run the single-image SVBRDF network, or its multi-image successor with two or three flash positions. Quilt in Python on the stacked maps, computing overlap error mostly on albedo but cutting all channels together, and wrap the output so it tiles. Export as KTX2. In a Unity, Godot or three.js shader, apply hex tiling with shared cell offsets and the histogram-preserving blend for albedo, and blend normals as surface gradients (Surface gradient based bump mapping framework). Check the result both close up and far away, since quilting repetition shows at distance and hex blending shows up close.

Field marks

  1. Highlights baked into the photo leak into albedo and then repeat.
  2. The network's low resolution gives soft detail when the material is seen up close.
  3. Directional materials such as planks or brushed metal cannot be rotated by hex tiling without wrong lighting.
  4. Quilting fails on regular structured patterns such as tiles.

Prior art

  1. Mandrenkov/SVBRDF-Texture-Synthesis. Partial: thesis on synthesising SVBRDF textures with convolutional autoencoders (per its description), the joint multi-map synthesis step without single-photo capture or runtime hex tiling.
Searches run (4)
  • arXiv: all:"SVBRDF" AND all:"texture synthesis" → 0 results
  • GitHub repos: SVBRDF "texture synthesis" → 1 result
  • arXiv: all:"single image" AND all:"material capture" AND all:"tileable" → 0 results
  • GitHub repos: "single image" "material capture" tileable → 0 results