{
 "id": "svbrdf-single-photo-capture",
 "title": "Single-photo SVBRDF capture",
 "aliases": [],
 "domain": "materials",
 "subdomain": "material capture",
 "stage": "material",
 "realtime": "interactive",
 "platforms": [
  "python",
  "cuda"
 ],
 "year_introduced": 2018,
 "inputs": [
  "photos"
 ],
 "outputs": [
  "material-params",
  "texture"
 ],
 "style": "photoreal",
 "dynamic": "static",
 "summary": "A rendering-aware CNN predicts diffuse, specular, roughness and normal maps from one flash-lit photo of a flat material sample. Gives an instant starting material from a phone picture.",
 "how_it_works": "Deschaintre et al. train a U-Net-like network with a global feature track that propagates image-wide context to every pixel, so highlights in one region inform appearance elsewhere. Training data are procedurally mixed SVBRDF maps rendered under a near-field flash light with a microfacet model. The loss is a mix of L1 error on predicted maps and a differentiable rendering loss comparing renders of predicted and ground-truth maps under random lighting, which resolves ambiguities where multiple maps explain the same photo. At inference the output is a set of four maps (diffuse albedo, specular albedo, roughness, normals) on a Cook-Torrance-GGX style model. A multi-image follow-up (Deschaintre 2019) accepts any number of photos with different light positions and pools features order-invariantly.",
 "when_to_use": "Choose it for quick material scanning of flat samples, or to seed PBR textures that artists refine. Prefer photometric stereo (`photometric-stereo`) or gantry-based capture when accuracy matters. Prefer `procedural-noise-texturing` for fully procedural materials. Use `normal-mapping-mikktspace` conventions for output normals.",
 "cost": {
  "class": "offline",
  "notes": "Single forward pass is fast (milliseconds on GPU) but the output is for authoring, not per-frame."
 },
 "failure_modes": [
  "Baked-in highlights and shadows leak into albedo when lighting is not near the training distribution",
  "Domain gap on real photos: glossy or anisotropic materials are mispredicted",
  "Output is limited to flat, tileable-ish samples; 3D structures confuse height and shading",
  "Resolution fixed by network input, producing blurry fine detail without upsampling"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/3197517.3201378",
   "type": "paper",
   "title": "Single-image SVBRDF capture with a rendering-aware deep network",
   "authors": [
    "Valentin Deschaintre",
    "Miika Aittala",
    "Fredo Durand",
    "George Drettakis",
    "Adrien Bousseau"
   ],
   "year": 2018,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/3197517.3201378",
   "ids": {
    "doi": "10.1145/3197517.3201378"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3197517.3201378",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3197517.3201378",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3197517.3201378",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3197517.3201378",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3197517.3201378",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "deschaintre2018single"
  },
  {
   "role": "primary",
   "key": "doi:10.1111/cgf.13765",
   "type": "paper",
   "title": "Flexible SVBRDF Capture with a Multi‐Image Deep Network",
   "authors": [
    "Valentin Deschaintre",
    "Miika Aittala",
    "Fredo Durand",
    "George Drettakis",
    "Adrien Bousseau"
   ],
   "year": 2019,
   "venue": "Computer Graphics Forum",
   "url": "https://doi.org/10.1111/cgf.13765",
   "ids": {
    "doi": "10.1111/cgf.13765"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/cgf.13765",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/cgf.13765",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/cgf.13765",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/cgf.13765",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1111/cgf.13765",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "deschaintre2019flexible"
  }
 ],
 "presets": [
  {
   "id": "svbrdf-single-photo-capture-live",
   "title": "Single-Photo SVBRDF Capture — flash-lit photo & predicted maps (left) vs relit reconstructed 3D material (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_FLASH_INT": 1.2,
    "P_RELIGHT_ANG": 0.65,
    "P_RELIEF": 0.9,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_FLASH_INT = 1.20; // P Flash Hotspot [0.4, 2.2, 0.1]\nconst float P_RELIGHT_ANG = 0.65; // P Relight Orbit [0.0, 2.0, 0.05]\nconst float P_RELIEF = 0.90; // P Normal Depth [0.2, 1.6, 0.05]\nconst float P_SPLIT = 0.48; // P Flash / Relit Split [0.0, 1.0, 0.02]\n\nfloat hash21(vec2 p) {\n  p = fract(p * vec2(127.1, 311.7));\n  p += dot(p, p + 34.5);\n  return fract(p.x * p.y);\n}\n\nfloat vnoise(vec2 p) {\n  vec2 i = floor(p);\n  vec2 f = fract(p);\n  f = f * f * (3.0 - 2.0 * f);\n  return mix(\n    mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x),\n    mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), f.x),\n    f.y\n  );\n}\n\nfloat fbm(vec2 p) {\n  float s = 0.0, a = 0.5;\n  for (int i = 0; i < 4; i++) {\n    s += a * vnoise(p);\n    p *= 2.03;\n    a *= 0.5;\n  }\n  return s;\n}\n\n// Underlying stone-and-patinated-copper tile SVBRDF maps\nvoid evalSVBRDF(vec2 uv, float relief, out vec3 alb, out vec3 tn, out float rough, out float specF0) {\n  vec2 tile = uv * vec2(4.0, 6.0);\n  float row = floor(tile.y);\n  tile.x += mod(row, 2.0) * 0.5;\n  vec2 id = floor(tile);\n  vec2 f = fract(tile) - 0.5;\n  float mortar = smoothstep(0.43, 0.48, max(abs(f.x), abs(f.y)));\n  float n1 = fbm(uv * 9.0 + id * 0.37);\n  float n2 = fbm(uv * 22.0 + 4.1);\n  float tileRnd = hash21(id);\n\n  vec3 stoneA = vec3(0.46, 0.26, 0.18);\n  vec3 stoneB = vec3(0.24, 0.38, 0.36);\n  vec3 tileCol = mix(stoneA, stoneB, smoothstep(0.35, 0.72, tileRnd + (n1 - 0.5) * 0.35));\n  alb = mix(tileCol * (0.72 + 0.55 * n2), vec3(0.22, 0.21, 0.19), mortar);\n\n  rough = clamp(mix(0.26 + 0.35 * (1.0 - n1), 0.88, mortar), 0.12, 0.95);\n  specF0 = mix(0.06 + 0.14 * smoothstep(0.55, 0.85, tileRnd), 0.02, mortar);\n\n  // Normal gradient from bevel + micro-relief\n  vec2 bev = smoothstep(0.36, 0.46, abs(f)) * sign(f);\n  float eps = 0.01;\n  float hx = fbm((uv + vec2(eps, 0.0)) * 18.0) - fbm(uv * 18.0);\n  float hy = fbm((uv + vec2(0.0, eps)) * 18.0) - fbm(uv * 18.0);\n  tn = normalize(vec3(-(bev.x * 0.85 + hx * 4.5) * relief, -(bev.y * 0.85 + hy * 4.5) * relief, 1.0));\n}\n\nfloat D_GGX(float ndh, float a) {\n  float a2 = a * a;\n  float d = ndh * ndh * (a2 - 1.0) + 1.0;\n  return a2 / max(3.1415926 * d * d, 1e-5);\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float sx = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool showRelit = sx >= split;\n\n  float flashPow = clamp(P_FLASH_INT, 0.2, 2.6);\n  float orb = iTime * max(P_RELIGHT_ANG, 0.0);\n  float relief = clamp(P_RELIEF, 0.1, 2.0);\n\n  vec3 col = vec3(0.05, 0.06, 0.08);\n\n  if (!showRelit) {\n    // Left: Flat phone flash-capture photo (top 68%) + CNN predicted SVBRDF map strip (bottom 32%)\n    float sy = fragCoord.y / max(iResolution.y, 1.0);\n    if (sy > 0.30) {\n      vec2 puv = vec2(sx / max(split, 0.05), (sy - 0.30) / 0.70);\n      vec3 alb, tn; float rough, f0;\n      evalSVBRDF(puv, relief, alb, tn, rough, f0);\n      // Co-located camera + point flash at center (0.5, 0.5, 0.55)\n      vec3 surfP = vec3(puv - 0.5, 0.0);\n      vec3 camP = vec3(0.0, 0.0, 0.58);\n      vec3 L = normalize(camP - surfP);\n      float dist2 = dot(camP - surfP, camP - surfP);\n      float ndl = max(dot(tn, L), 0.0);\n      float D = D_GGX(ndl, max(rough * rough, 0.05));\n      float atten = flashPow / max(dist2 * 1.9, 0.2);\n      col = (alb * ndl * 0.9 + vec3(D * f0 * 0.45)) * atten + alb * 0.06;\n    } else {\n      // Bottom CNN output map strip: Albedo | Normal | Roughness | Specular\n      float bx = (sx / max(split, 0.05)) * 4.0;\n      int idx = int(clamp(floor(bx), 0.0, 3.0));\n      vec2 muv = vec2(fract(bx), sy / 0.30);\n      vec3 alb, tn; float rough, f0;\n      evalSVBRDF(muv * 0.75, relief, alb, tn, rough, f0);\n      if (idx == 0) col = alb * 1.1;\n      else if (idx == 1) col = tn * 0.5 + 0.5;\n      else if (idx == 2) col = vec3(rough);\n      else col = vec3(f0 * 4.5);\n      // Crisp border between predicted maps\n      if (fract(bx) < 0.03 || fract(bx) > 0.97 || sy > 0.285) col = vec3(0.85, 0.88, 0.94);\n    }\n  } else {\n    // Right: Reconstructed SVBRDF relit on a 3D curved cylinder/sphere under orbiting directional + cool IBL\n    vec3 ro = vec3(0.18, 0.05, 2.20);\n    vec3 rd = normalize(vec3(uv - vec2(0.14, 0.0), -1.48));\n    col = mix(vec3(0.05, 0.07, 0.11), vec3(0.16, 0.22, 0.34), smoothstep(-0.3, 0.6, rd.y));\n\n    vec3 sc = vec3(0.18, 0.0, 0.0);\n    vec3 oc = ro - sc;\n    float b = dot(oc, rd);\n    float c = dot(oc, oc) - 0.62 * 0.62;\n    float disc = b * b - c;\n    if (disc > 0.0) {\n      float t = -b - sqrt(disc);\n      if (t > 0.05) {\n        vec3 p = ro + rd * t;\n        vec3 n = normalize(p - sc);\n        float phi = atan(n.z, n.x) + orb * 0.35;\n        float th = acos(clamp(n.y, -1.0, 1.0));\n        vec2 muv = vec2(phi / 3.14159, th / 1.57079);\n        vec3 T = normalize(vec3(-sin(phi), 0.0, cos(phi)));\n        vec3 B = cross(n, T);\n\n        vec3 alb, tn; float rough, f0;\n        evalSVBRDF(muv, relief, alb, tn, rough, f0);\n        vec3 wN = normalize(T * tn.x + B * tn.y + n * tn.z);\n        vec3 v = -rd;\n        vec3 L1 = normalize(vec3(cos(orb) * 0.85, 0.65, sin(orb) * 0.65 + 0.45));\n        vec3 L2 = normalize(vec3(-0.7, 0.35, 0.55));\n        vec3 H1 = normalize(L1 + v);\n        float ndl1 = max(dot(wN, L1), 0.0);\n        float ndl2 = max(dot(wN, L2), 0.0);\n        float ndh1 = max(dot(wN, H1), 0.0);\n        float ndv = max(dot(wN, v), 0.005);\n        float D = D_GGX(ndh1, max(rough * rough, 0.05));\n        float F = f0 + (1.0 - f0) * pow(1.0 - max(dot(v, H1), 0.0), 5.0);\n        vec3 spec = vec3(1.15, 1.05, 0.90) * (D * F / max(4.0 * ndv, 0.08)) * ndl1;\n        vec3 diff = alb * (vec3(1.25, 1.08, 0.88) * ndl1 + vec3(0.32, 0.52, 0.85) * ndl2 * 0.65 + vec3(0.12, 0.16, 0.22));\n        col = diff + spec;\n      }\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(sx - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "svbrdf-single-photo-capture",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:27.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6416,
      "std": 0.1439,
      "min": 0.1014,
      "max": 0.9628
     },
     "image": "/specimens/svbrdf-single-photo-capture-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "photometric-stereo",
  "ggx-trowbridge-reitz",
  "normal-mapping-mikktspace"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/materials/svbrdf-single-photo-capture.json"
 },
 "solves": [
  "want pbr maps from one phone photo of a surface",
  "need quick material scan of flat sample",
  "no rig for capturing roughness and normals",
  "seed a texture set artists can refine"
 ],
 "authority": "Deschaintre et al., 2018",
 "url": "https://texelatlas.vercel.app/t/svbrdf-single-photo-capture/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 20.25,
  "tier": "heavy",
  "p50_ms": 0.6663,
  "p95_ms": 0.6902,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "svbrdf-single-photo-capture-live",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 17.64,
   "tier": "moderate",
   "p50_ms": 0.2804,
   "p95_ms": 0.2819,
   "speedup_x": 2.38,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 14.86,
   "tier": "moderate",
   "p50_ms": 0.4279,
   "p95_ms": 0.4291,
   "speedup_x": 1.56,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}