Repository navigation
Description
Summary
Add scripts/pbr_uv_observations.py: a standalone utility that takes (frames, poses, mesh with UVs) and produces a per-texel multi-view observation tensor — every texel maps to the list of pixel samples that observed it across input views, with view directions, linear radiance values, and visibility flags.
This is the input to any UV-space inverse-rendering pipeline (Lambert+SH baseline fit, GGX optimization, environment-light estimation) but is independent of the BRDF model itself. Standalone — no training-time changes.
Split from #11 Stage 2.5a — the prerequisite data structure.
Motivation
UV-space inverse rendering requires T → [(view_dir, radiance, visibility)] for each texel T. mini-mesh currently has no such pipeline step. Per-texel observation gathering is the photogrammetric analogue of a ray bundle in volumetric methods, and it's the reusable substrate for:
- Lambert + SH exposure baseline (Stage 2.5a)
- GGX dielectric fitting (separate issue)
- AO bake (separate issue)
- Per-view environment lighting estimation (separate issue)
Building this once means subsequent BRDF / lighting work is purely numerical, no I/O.
Pipeline
inputs: frames/*.png + transforms.json + mesh.obj/ply (with UVs, xatlas atlas)
↓
rasterize each view (z-buffer for visibility)
↓
per-pixel-of-frame: backproject → barycentric on visible triangle → texel UV
↓
per-texel: append (view_dir, observed_radiance_linear, visibility)
↓
output: observations.h5 (sparse / variable-length per-texel)
Tasks
- CLI:
python scripts/pbr_uv_observations.py --frames <dir> --transforms transforms.json --mesh mesh.obj --uv-resolution 2048 --output observations.h5 - Rasterizer:
nvdiffrastGPU path when available (feat(docker): Add nvdiffrast to Docker image for faster texturing #7), CPU fallback viatrimesh/pyrender - Linearize sRGB → linear before storing
- Sparse storage: HDF5 with chunked + compressed variable-length per-texel arrays, or fixed-K reservoir sampling for memory cap
-
--max-samples-per-texel(default 32) - Visibility: depth-test against the rasterized z-buffer (excludes self-occlusion)
- Unit test on synthetic Blender scene: textured sphere + 8 cameras → verify texel coverage and view-dir distribution
- Smoke test on
assets/example reconstruction
Validation criteria
- Mean observed color per texel matches direct mesh-projective texturing within tolerance
- Visibility correctly excludes back-facing / occluded observations
- Memory: 2048² atlas with K=32 samples fits in ≤8 GB on disk (HDF5 chunked+compressed)
Non-goals
- BRDF fitting (separate issue)
- Lighting estimation (separate issue)
- Differentiable rendering (consumes the output)
References
- Waechter, Moehrle, Goesele, Let There Be Color! Large-Scale Texturing of 3D Reconstructions, ECCV 2014
- Lempitsky, Ivanov, Seamless Mosaicing of Image-Based Texture Maps, CVPR 2007
- nvdiffrast documentation
Related
- feat(export): PBR-ish texture extraction and BRDF-aware training #11 — parent PBR tracking issue (Stage 2.5a prerequisite)
- feat(docker): Add nvdiffrast to Docker image for faster texturing #7 — nvdiffrast Docker (GPU rasterization speedup)
Activity