This is a modification of an old Processing sketch that I wrote some years ago to visualize scan meshes taken with my Kinect 3D scanner application. Instead of Processing, the sketch now uses the three.js WebGL library to display the scan mesh in 3D. Most of the calculations are done on the GPU using GLSL shaders. Some of the effects use a 2D texture mask that is updated every frame with the p5.js library.
If the sketch doesn't work, you probably need to change your browser to one that supports WebGL.
For more details, check the sketch source code, the Scan.js class and the vertex and fragment shaders.