Pimoroni’s HyperPixel 4 Square put to excellent use
More details here: https://eleccelerator.com/pi-handheld-3d-scanner/ including the files required to install the software and the 3D CAD models for the 3D printed case
The web page provides you with a high level understanding of how the camera works and how the software uses the data from the camera to construct 3D point clouds, and eventually a 3D mesh.
It’s done using an Intel RealSense D415 camera, connected to a Raspberry Pi 4, and RTAB-Map as the software framework. Such a device is only recently possible because the Raspberry Pi 4 finally included USB 3.0 ports which allowed for fast enough data rates.