latentspace.

Coarse-to-Fine SDF


  • A dense grid is mostly waste
    • A signed distance function (SDF) returns, for any point, the distance to the nearest surface, signed negative inside the shape and positive outside. The surface itself is the zero level set. Every figure below draws inside points red and outside points blue
    Measured on a watertight, normalised copy of the Stanford bunny, so every value shown is a real distance in model units. Samples run dark as their value nears zero and fade out as it grows, so the last panel leaves only a thin shell around the surface.

    • To extract a mesh, sample the function on an \(R \times R \times R\) grid of points, which bounds \((R-1)^3\) cells, and run marching cubes, which emits triangles in every cell whose corner signs differ. Cost is counted in points; refinement acts on cells
    • A sign change means two corners \(p_0\) and \(p_1\) lie on opposite sides, so the surface crosses the edge between them. Take a point on that edge as \(p(t) = p_0 + t(p_1 - p_0)\), assume the field varies linearly along it, \(v(t) = v_0 + t(v_1 - v_0)\), and solve for the zero:
      \[ 0 = v_0 + t(v_1 - v_0) \quad \Longrightarrow \quad t = \frac{v_0}{v_0 - v_1} \]
      The same \(t\) is solved from the two values and then spent on the position, \(p_0 + t(p_1 - p_0)\). The vertex therefore lands nearer the corner whose value is closer to zero, rather than at the midpoint
    Real signed distances at the eight corners of two cells taken from a \(16^3\) grid. On the single edge of panel 1 the crossing sits at \(t = 0.75\), not the midpoint, and every black dot is one such interpolated vertex.

    • The grid decides the cost: \(R = 128\) is 2,097,152 queries, and doubling \(R\) multiplies that by eight. When the SDF is a neural decoder, those queries dominate the whole reconstruction
    • A surface is 2D inside a 3D grid. Cost grows like \(R^3\), but the answer lives on \(O(R^2)\) cells, so almost every query reports empty space

  • Refine only near the surface
    • Start on a coarse grid and, at each finer level, evaluate only the cells the surface could pass through. The figure below runs the ladder \(4 \rightarrow 8 \rightarrow 16 \rightarrow 32 \rightarrow 64\) cells per axis
    • Only the coarsest level is ever sampled in full — all 125 points of the \(4^3\) grid. Every level after it sees just the corners of the cells its parent kept
    • Across the five levels that comes to 53,322 points, where sampling the finest grid in full would take \(65^3 =\) 274,625. The mesh it produces is identical to the dense one, vertex for vertex, at 14,706 triangles
    • What about the points nobody sampled? They inherit the value from the level above, so the grid stays complete and marching cubes runs on it unchanged
    A \(4^3\) grid around the bunny; grey is the dense \(64^3\) reference mesh. 1: 4 of the 125 points are red, and the outline marks the 20 cells that own one. 2: those 20 (solid) plus 42 within half a cell diagonal (light) — the margin that keeps parts thinner than one cell. 3: four levels at once, each at its own cell size — bigger and lighter the coarser the level. Only crossing cells are painted.