A wafer-level fabrication process for making a plurality of optical modules, the method comprising: providing a respective beam shaping system (426, 428) over a first surface of each of a plurality of transparent covers; providing a spacer on a second surface of each of the plurality of transparent covers opposite to the first surface, wherein the spacer has respective through-holes each of which is aligned with a corresponding one of the beam shaping systems and corresponds to a respective optical channel, the spacer including extensions (104, 106, 106A, 106B) extending away from the beam shaping systems so as to provide respective alignment edges; providing material laterally encircling the respective transparent covers; measuring at least one optical property for an optical channel corresponding to each beam shaping system after providing the material encircling the respective transparent covers; modifying a height of one or more of the extensions based on the measuring to produce a resulting structure; separating the resulting structure into a plurality of modules each of which includes at least one of the beam shaping systems, at least one of the transparent covers, a first portion of the spacer including at least one of the alignment edges, and a second portion of the material laterally surrounding the at least one of the transparent covers and defining at least one adhesion edge; and subsequently bringing the alignment edge of at least one of the modules into contact with a surface of a respective image sensor, and providing adhesive to attach the adhesion edge of the module to a surface of a printed circuit board on which the image sensor is mounted. providing a respective beam shaping system (426, 428) over a first surface of each of a plurality of transparent covers; providing a spacer on a second surface of each of the plurality of transparent covers opposite to the first surface, wherein the spacer has respective through-holes each of which is aligned with a corresponding one of the beam shaping systems and corresponds to a respective optical channel, the spacer including extensions (104, 106, 106A, 106B) extending away from the beam shaping systems so as to provide respective alignment edges; providing material laterally encircling the respective transparent covers; measuring at least one optical property for an optical channel corresponding to each beam shaping system after providing the material encircling the respective transparent covers; modifying a height of one or more of the extensions based on the measuring to produce a resulting structure; separating the resulting structure into a plurality of modules each of which includes at least one of the beam shaping systems, at least one of the transparent covers, a first portion of the spacer including at least one of the alignment edges, and a second portion of the material laterally surrounding the at least one of the transparent covers and defining at least one adhesion edge; and subsequently bringing the alignment edge of at least one of the modules into contact with a surface of a respective image sensor, and providing adhesive to attach the adhesion edge of the module to a surface of a printed circuit board on which the image sensor is mounted.