1. A method for generating a virtual image of a range space from a first input image of the range space and a second input image of the range space, the method comprising: discretizing the range space into a plurality of layers; for each layer of the plurality of layers: warping the first input image to the layer; warping the second input image to the layer; and for each pixel in the virtual image, determining a matching score based on the warped first input image and the warped second input image; and for each pixel in the virtual image: determining a layer with a best matching score; and determining a color of the pixel in the layer with the best matching score.