A reprojective driving simulator makes the view from a shifted car position by taking a recorded frame and its depth map, lifting every pixel into 3D and projecting it into the new camera. Pixels of the new view that no source pixel lands on are holes: things the original camera never saw, which must be inpainted and become artifacts. The further the new pose is from the recorded one, the more holes, which is why such simulators keep the shift small. Measure it.
Cameras use the pinhole model with intrinsics : a pixel (column, row) with depth is the 3D point in camera coordinates ( right, down, forward). Moving the camera by a translation (no rotation) puts the point at in the new camera, which sees it at divided by its third coordinate.
hole_fraction(depth, K, t)
depth: (H, W) positive depths. K: 3 x 3. t: length-3 translation of the new camera.int(round(...)); skip anything outside the image.H * W target pixels that no source pixel lands on, rounded to 4 decimals.max_safe_shift(depth, K, direction, shifts, max_holes)
direction: length-3 vector (not necessarily unit length; normalize it). shifts: increasing distances in meters.shifts in order and return the last distance whose hole fraction (for t = s * unit_direction) is at most max_holes, stopping at the first that exceeds it. Return 0.0 if the first already exceeds it.