The core idea is depth-image-based rendering. For every image sample, the RGB image provides color
and the depth image provides a rough 3D position. A pixel coordinate \((u, v)\) is mapped to a point
on a proxy surface:
\[
\mathbf{p}(u,v) =
\begin{bmatrix}
(u - 0.5)a \\
0.5 - v \\
sD(u,v) + b
\end{bmatrix},
\]
where \(a\) is the image aspect ratio, \(D(u,v) \in [0,1]\) is the depth value, \(s\) is the depth
scale, and \(b\) is the depth bias. The color of this point is sampled directly from the original
image:
\[
\mathbf{c}(u,v) = I(u,v).
\]
The proxy mesh is then rendered from a virtual camera using a standard model-view-projection transform:
\[
\mathbf{x}_{clip} = PVM
\begin{bmatrix}
\mathbf{p}(u,v) \\
1
\end{bmatrix}.
\]
To reduce unnatural stretching, the mesh removes triangles whose depths differ too much. For a triangle
with vertex depths \(d_1,d_2,d_3\), the triangle is kept only if
\[
\max(d_1,d_2,d_3) - \min(d_1,d_2,d_3) \le \tau,
\]
where \(\tau\) is the depth tear threshold. This creates holes at strong depth discontinuities instead
of stretching foreground texture into the background.
Multi-View Blending (Quadrilinear Interpolation)
To expand beyond a single view, the system supports multi-slab light fields. For a given virtual camera orientation, the renderer selects the two closest input slabs. Let their angular distances from the virtual camera be \(d_1\) and \(d_2\). The blend weight \(w\) for the secondary slab is computed as:
\[
w = \frac{d_1}{d_1 + d_2}.
\]
The final pixel color \(C\) is an alpha-blended combination of the warped primary slab \(C_1\) and secondary slab \(C_2\):
\[
C = (1 - w)C_1 + w C_2.
\]
Combined with bilinear spatial filtering on each proxy mesh, this cross-slab angular blending results in a smooth quadrilinear interpolation as the camera rotates.
Vector Quantization (VQ) Compression
To manage memory efficiently when loading multiple RGB-D views, the system optionally employs Vector Quantization (VQ) texture compression. Instead of storing full 24-bit RGB colors, the image is divided into \(2 \times 2\) pixel blocks. Each block is assigned a single 8-bit index \(k\).
During rendering, the fragment shader decodes the color for a pixel at offset \((o_x, o_y) \in \{0,1\}^2\) within the block using a lookup into a 1D color codebook:
\[
\mathbf{c}(o_x, o_y) = \text{Codebook}[4k + 2o_y + o_x].
\]
This achieves a 12:1 compression ratio for the image data, drastically reducing GPU memory bandwidth while maintaining high visual fidelity.
Pipeline
graph TD
A["Input: Load single/multi-slab RGB-D views (VQ optional)"] --> B["Depth Conversion: Normalize depth values"]
B --> C["Proxy Mesh: Sample grid and displace vertices"]
C --> D["Artifact Reduction: Remove triangles at depth jumps"]
D --> E["Rendering & Blending: Decode VQ, warp, and blend slabs"]
E --> F["Interaction: ImGui camera & parameter updates"]
F -.->|Loop| A