In this paper, we describe a data structure and an algorithm to accelerate the table lookup step in example-based multiimage photometric stereo. In that step, one must find a pixel of a reference object, of known shape and color, whose appearance under different illumination fields is similar to that of a given scene pixel. This search reduces to finding the closest match to a given -vector in a table with a thousand or more -vectors. Our method is faster than previously known solutions for this problem but, unlike some of them, is exact, i.e., always yields the best matching entry in the table, and does not assume point-like sources. Our solution exploits the fact that the table is in fact a fairly flat 2-D manifold in -dimensional space so that the search can be efficiently solved with a uniform 2-D grid structure.