How does prediction work?

The main sampling algorithm in the render cache is reactive.  It examines the current image and decides where additional samples were most needed.  The chosen sample location are then passed to the underlying renderer for computation.  The directed sampling is very important because the number of new samples that can be computed per frame is limited and generally far smaller than the number of pixels.  However there is always at least one frame of latency between when the samples are requested and when they can be computed and returned by the renderer.  Thus if a new region becomes visible, there will be no data to estimate that part of the image until at least one frame later.  This can be a problem especially when large new regions are becoming visible every frame (for example when rotating the camera rapidly).

The answer is request at least some sparse new data for new regions a few frames before they become visible.  The predictive sampling algorithm uses a predicted camera (typically 2 to 3 frames ahead) to perform a fast, low-resolution projection of the point cloud in order to look for regions that are likely to become visible soon and contain no data.  Once identify it requests a sparse set of new samples that those regions (they can be filled in with dense data via the standard sampling technique once they do become visible).  This method gives a good tradeoff of predictively filling in most soon to be visible regions sparsely without incurring too much expense.

Instructions

  1. Start the render cache program from the button on the main page.  It will start by showing a simple environment with  7 spheres.
  2. Select "Load Loft Model" from the Scene menu.
  3. Turn on the "Clear First" checkbox in the Options panel.  This causes pixels to be cleared to black between frames so that it is easy to identify which regions could not be estimated due to a lack of data.
  4. Turn off the "Use Prediction" checkbox in the Options panel to disable predictive sampling.  Notice that the framerate increases somewhat.  There is a cost associated with the predictive sampling, so disabling it speeds up the framerate.
  5. Position your mouse over the middle of the image and press the spacebar to start rotation mode.  Move the mouse toward the right edge of the image until the camera is rotating rapidly.  Notice that there is a black region at the right edge, where new regions are just becoming visible, but no shading points have been computed for them yet.
  6. Stop rotating (by pressing the spacebar again), re-enable predictive sampling (by checking "Use Prediction" in the Options panel), and try rotating the camera rapidly again.  There is no longer a black region without data, because the render cache is now requesting samples for these regions a few frames before they become visible.
  7. Try repeating this experiment using different display modes.  The "Raw Points" mode will show the shaded points without doing any interpolation to fill the gaps between them.  The "Occupancy" mode shows which pixels had a point map to them (green) and which pixels had no data (blue).  This mode shows how the point density starts low when a region becomes visible and then increases over time.
  8. You can directly view the predicted occupancy (as opposed to the current point occupancy) by choosing "Pred. Occupancy" from the Display pull-down box.  Regions predicted to have no points are shown in black, while those containing data are shown in white.  Because the predicted occupancy image is lower in resolution, each of its pixels is displayed as a 4x4 block.
  9. You can see the sample locations being requested based on the predicted occupancy image by selecting "Pred. Requests" from the Display pull-down box.  Notice that samples are only requested for regions predicted to contain no points and that the requested samples are sparse.

Sample Images

without prediction
Camera rotation example without predictive sampling.  The black on the right is newly visible regions for which we have not yet computed any shading samples.

with prediction
Camera rotation example with predictive sampling.  There is no black band on the right because some samples are being requested a few frames before they are needed.