Texel A field guide to 3D techniques

Multi-View Stereo (PatchMatch, COLMAP) × Radiosity (Hemicube Form Factors)

Progressive radiosity relighting on PatchMatch multi-view stereo rooms. Dense depth and normal maps recovered by PatchMatch MVS are clustered into planar architectural patches whose diffuse inter-reflection is solved by progressive radiosity, turning multi-view room photos into interactively relit global-illumination spaces.

Open in StudioReproduced23.3× · 0.722 ms

Multi-View Stereo (PatchMatch, COLMAP)Capture · Offlinein: photos, camera-posesout: depth, normals, point-cloudcompositeRadiosity (Hemicube Form Factors)Lighting · Offlinein: mesh, material-paramsout: texture

Verified proof

reproduced · 2026-12-01texel-lablicense MIT
Specimen render of PatchMatch MVS + progressive radiosity (left: noisy raw MVS capture, right: planar clustered radiosity relighting)
Cross-proof specimen. PatchMatch MVS + progressive radiosity (left: noisy raw MVS capture, right: planar clustered radiosity relighting). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing raw noisy PatchMatch multi-view stereo depth/normal points with frozen flat capture shading (left) against coplanar clustered room polygons relit interactively with progressive hemicube radiosity color bleeding from a moving glowing wall skylight (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · fuses noisy PatchMatch MVS depth/normals into coplanar polygons and solves interactive progressive radiosity bounce across the room

Show GLSL proof (178 lines)
const float P_RAD_BOUNCE = 1.25; // P Radiosity Bounce [0.2, 2.2, 0.05]
const float P_LIGHT_MOVE = 0.75; // P Emissive Panel Drift [0.0, 1.5, 0.05]
const float P_CELL_VIS = 0.25; // P Planar Element Grid [0.0, 1.0, 0.05]
const float P_MVS_NOISE = 0.80; // P Raw MVS Noise [0.1, 1.5, 0.05]

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.5);
  return fract(p.x * p.y);
}

float sdBox(vec3 p, vec3 b) {
  vec3 q = abs(p) - b;
  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}

// Architectural interior room: stepped blocks + colored side walls + ceiling skylight
vec2 mapRoom(vec3 p) {
  // Interior room box: x in [-1.6, 1.6], y in [-1.0, 1.3], z in [-2.2, 2.5]
  float dFloor = p.y + 1.0;
  float dCeil = 1.3 - p.y;
  float dLeft = p.x + 1.6;
  float dRight = 1.6 - p.x;
  float dBack = p.z + 2.2;

  float d = dFloor; float mat = 1.0;
  if (dCeil < d) { d = dCeil; mat = 2.0; }
  if (dLeft < d) { d = dLeft; mat = 3.0; }
  if (dRight < d) { d = dRight; mat = 4.0; }
  if (dBack < d) { d = dBack; mat = 5.0; }

  // Two architectural plinth blocks inside the captured room
  float b1 = sdBox(p - vec3(-0.55, -0.58, -0.95), vec3(0.42, 0.42, 0.42));
  if (b1 < d) { d = b1; mat = 6.0; }
  float b2 = sdBox(p - vec3(0.58, -0.35, -1.25), vec3(0.36, 0.65, 0.36));
  if (b2 < d) { d = b2; mat = 7.0; }
  return vec2(d, mat);
}

vec3 calcNormal(vec3 p) {
  vec2 e = vec2(0.003, -0.003);
  return normalize(
    e.xyy * mapRoom(p + e.xyy).x +
    e.yyx * mapRoom(p + e.yyx).x +
    e.yxy * mapRoom(p + e.yxy).x +
    e.xxx * mapRoom(p + e.xxx).x
  );
}

vec3 roomAlbedo(float mat) {
  if (mat < 1.5) return vec3(0.64, 0.56, 0.46);
  if (mat < 2.5) return vec3(0.74, 0.74, 0.76);
  if (mat < 3.5) return vec3(0.84, 0.24, 0.18);
  if (mat < 4.5) return vec3(0.16, 0.56, 0.68);
  if (mat < 5.5) return vec3(0.72, 0.70, 0.66);
  if (mat < 6.5) return vec3(0.78, 0.76, 0.72);
  return vec3(0.68, 0.64, 0.58);
}

// Simple visibility shadow ray toward emissive panel or shooting element
float traceVis(vec3 ro, vec3 target) {
  vec3 diff = target - ro;
  float maxL = length(diff);
  vec3 rd = diff / max(maxL, 1e-4);
  float d = 0.04;
  for (int i = 0; i < 22; i++) {
    float h = mapRoom(ro + rd * d).x;
    if (h < 0.006) return 0.0;
    d += max(h, 0.04);
    if (d >= maxL - 0.08) return 1.0;
  }
  return 1.0;
}

// Progressive radiosity: direct skylight shooting + secondary colored wall/floor form-factor transfers
vec3 evalProgressiveRadiosity(vec3 wp, vec3 N, vec3 panelPos) {
  // 1. Primary emissive ceiling skylight shooting
  vec3 toP = panelPos - wp;
  float d2 = max(dot(toP, toP), 0.25);
  vec3 dirP = toP / sqrt(d2);
  float ff0 = max(dot(N, dirP), 0.0) * max(dot(vec3(0.0, -1.0, 0.0), -dirP), 0.0) / (d2 + 0.35);
  float vis0 = traceVis(wp + N * 0.03, panelPos);
  vec3 direct = vec3(3.6, 3.25, 2.75) * ff0 * vis0;

  // 2. Secondary progressive bounce from terracotta-red left wall, teal right wall, and warm floor
  vec3 leftShooter = vec3(-1.55, 0.15, -0.85);
  vec3 rightShooter = vec3(1.55, 0.15, -0.85);
  vec3 floorShooter = vec3(0.0, -0.96, -0.75);

  vec3 bounce = vec3(0.0);
  // Left crimson wall bounce
  vec3 vL = leftShooter - wp;
  float l2 = max(dot(vL, vL), 0.22);
  vec3 dL = vL / sqrt(l2);
  float ffL = max(dot(N, dL), 0.0) * max(dot(vec3(1.0, 0.0, 0.0), -dL), 0.0) / (l2 + 0.35);
  bounce += vec3(0.95, 0.22, 0.14) * ffL * 1.65;

  // Right teal wall bounce
  vec3 vR = rightShooter - wp;
  float r2 = max(dot(vR, vR), 0.22);
  vec3 dR = vR / sqrt(r2);
  float ffR = max(dot(N, dR), 0.0) * max(dot(vec3(-1.0, 0.0, 0.0), -dR), 0.0) / (r2 + 0.35);
  bounce += vec3(0.14, 0.66, 0.82) * ffR * 1.65;

  // Warm floor upward bounce
  vec3 vF = floorShooter - wp;
  float f2 = max(dot(vF, vF), 0.25);
  vec3 dF = vF / sqrt(f2);
  float ffF = max(dot(N, dF), 0.0) * max(dot(vec3(0.0, 1.0, 0.0), -dF), 0.0) / (f2 + 0.45);
  bounce += vec3(0.75, 0.58, 0.42) * ffF * 1.10;

  return direct + bounce * P_RAD_BOUNCE + vec3(0.10, 0.11, 0.13);
}

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 res = max(iResolution.xy, vec2(1.0));
  vec2 uvN = fragCoord / res;
  float splitX = iMouse.z > 0.0 ? clamp(iMouse.x / res.x, 0.05, 0.95) : 0.5;
  bool useRadiosity = uvN.x > splitX;

  vec2 p = (fragCoord - 0.5 * res) / res.y;
  float t = iTime;
  vec3 panelPos = vec3(sin(t * 0.72 * P_LIGHT_MOVE) * 0.75, 1.27, -0.85 + cos(t * 0.5 * P_LIGHT_MOVE) * 0.45);

  vec3 ro = vec3(sin(t * 0.22) * 0.22, 0.08, 1.95);
  vec3 rd = normalize(vec3(p.x * 1.15, p.y - 0.04, -1.35));

  float d = 0.05;
  float mat = -1.0;
  for (int i = 0; i < 64; i++) {
    vec2 h = mapRoom(ro + rd * d);
    if (h.x < 0.002) { mat = h.y; break; }
    d += h.x;
    if (d > 8.0) break;
  }

  vec3 col = vec3(0.05);
  if (mat > 0.0) {
    vec3 wp = ro + rd * d;
    vec3 N = calcNormal(wp);
    vec3 alb = roomAlbedo(mat);

    // Emissive skylight panel on ceiling
    bool onPanel = (mat > 1.5 && mat < 2.5) && abs(wp.x - panelPos.x) < 0.48 && abs(wp.z - panelPos.z) < 0.34;
    if (onPanel) {
      col = vec3(3.4, 3.05, 2.55);
    } else if (!useRadiosity) {
      // Left baseline: raw noisy PatchMatch MVS depth/normal points with frozen flat capture light & pinholes
      vec2 cell = floor((wp.xy + wp.zy) * 34.0);
      float jit = (hash21(cell) - 0.5) * P_MVS_NOISE;
      vec3 noisyN = normalize(N + vec3(jit, hash21(cell + 7.1) - 0.5, hash21(cell + 19.3) - 0.5) * 0.42 * P_MVS_NOISE);
      float staleLit = 0.35 + 0.55 * max(dot(noisyN, normalize(vec3(0.2, 0.9, 0.4))), 0.0);
      col = alb * staleLit;
      // Stereo occlusion dropout pinholes in corners
      float hole = step(0.88 - 0.08 * P_MVS_NOISE, hash21(floor(wp.xz * 26.0 + wp.y * 19.0)));
      col *= (1.0 - hole * 0.65);
    } else {
      // Right: coplanar clustered planar polygons relit by progressive radiosity
      vec3 rad = evalProgressiveRadiosity(wp, N, panelPos);
      col = alb * rad;
      // Optional clustered planar radiosity polygon grid overlay
      if (P_CELL_VIS > 0.01) {
        vec2 uvFace = abs(N.y) > 0.5 ? wp.xz : (abs(N.x) > 0.5 ? wp.zy : wp.xy);
        vec2 gf = abs(fract(uvFace * 2.5) - 0.5);
        float line = smoothstep(0.45, 0.49, max(gf.x, gf.y));
        col = mix(col, vec3(0.95, 0.92, 0.78), line * P_CELL_VIS * 0.42);
      }
    }
  }

  col = acesTone(col * 1.06);
  if (abs(fragCoord.x - splitX * res.x) < 1.0) col = vec3(0.95, 0.93, 0.89);
  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}

Why they connect

Multi-View Stereo (PatchMatch, COLMAP) estimates per-pixel depth and oriented plane normals via randomized plane hypotheses and spatial propagation across calibrated views, outputting dense depth, normals, and a fused point cloud. The hop to Radiosity (Hemicube Form Factors) is composite: merge coplanar depth-normal samples into a coarse patch mesh (estimating patch diffuse reflectance by dividing out initial ambient illumination or using median chromaticity), compute patch-to-patch visibility form factors via hemicube rasterization, and iterate progressive refinement Radiosity (Hemicube Form Factors) so moving virtual skylights or glowing panels cast soft view-independent color bleeding across the reconstructed room.

How to build it

Run a 3-iteration PatchMatch MVS depth/normal solver (using photometric NCC cost + neighbor plane propagation and perturbation) across multi-view images, then fuse consistent points into planar quads or simplified triangle patches (500-2000 elements). Assign each patch an unshot radiosity buffer and reflectance rho_i. For each iteration, pick the patch with highest unshot energy, render a 5-face hemicube of patch IDs from its centroid to evaluate discrete delta-form-factors F_ij, distribute bounce energy delta_B_j = rho_j * B_unshot_i * F_ij * (A_i / A_j), and interpolate converged patch radiosities smoothly across vertices for interactive walkthroughs.

Field marks

  1. Depth noise and missing occluded regions in PatchMatch MVS create tiny pinholes in the patch mesh that leak false radiosity between rooms.
  2. Glossy surfaces violate both PatchMatch photometric constancy and Lambertian radiosity assumptions, injecting dark or oversaturated reflectance patches.
  3. Coarse patch tessellation produces blocky shadow edges on floors unless substructured around shadow discontinuities or blended with sharp direct shadows.
  4. Hemicube aliasing misses small, intense emissive patches unless hemicube resolution or analytical direct-light shooting is used.

Prior art

No prior art found on 2026-12-01.

Searches run (2)
  • arXiv: all:"PatchMatch" AND all:"radiosity"
  • GitHub repos: "patchmatch" radiosity