GLSL. The distance between vertexes for taking mask

Hello everyone! I`m new in GLSL. I want to create mesh mask with Kinect and for this i want execute the distance between vertexes. If Z distance more then for example 0.4 - the vertex is discard.
How to do it?

What strange is Kinect doesn’t give you vertices, only points with pointcloud. In GLSL you can, for example, give an alpha level of 0 when the blue color (z coords) is outside a range.

Thanks for the answer Jacqueshoepffner.

I already have displacement mesh which is implemented by KinectDepth. My main goal is to cut mesh by KinectPlayerIndex white color. Thats why i want to execute distance between vertexes.

I want to create Realtime-mesh as in the video below:

Also I have a question about Kinect SOP. I`m using kinect 360, sdk is installed, but Kinect SOP not working.

Hello,
I am not sure its real time, nothing give this impression. I think they use the point cloud to generate a mesh in Houdini or something equivalent, there is too much effects and slow motion.
I cannot help about kinect SOP because I have only kinect 2 but looking to it, it will give a mesh made from skeleton, not from point cloud so much less vertices.
From that I see two path, one would be to filter the point cloud with depth value and also comparing image with and without bodies to eliminate others (freeze image and GLSL top), reduce the number of point to make a number acceptable by CPU and use something as DAT to SOP to construct the mesh.
Another better way would be to use GPU and GLSL/geometry shader to produce a mesh from points. But thats another story because you have to calculate the normals for each point. I think its doable (I am working at it but far away from graal).

Jacqueshoepffner thanks for your ideas.

Here is solution - Brekel.
https://brekel.com/

The problem is solved.