An optical sensing device includes a light source, which is configured to emit one or more beams of light pulses at respective angles toward a target scene. An array of sensing elements is configured to output signals in response to incidence of photons on the sensing elements. Light collection optics are configured to image the target scene onto the array. Control circuitry is coupled to actuate the sensing elements only in one or more selected regions of the array, each selected region containing a respective set of the sensing elements in a part of the array onto which the light collection optics image a corresponding area of the target scene that is illuminated by the one of the beams, and to adjust a membership of the respective set responsively to a distance of the corresponding area from the device.