When I apply the depth map to generate a 3D mesh of the skybox there is this problem: “spikes” on the edges of objects in a 3D mesh.

I believe there are two main possible solutions
1. High-resolution meshes
If we wanted a perfect texture distortion without artifacts on the edges, we should have a mesh with as much resolution as one vertex per texture pixel (something too demanding, especially for web browsers)

Another possible solution would be to generate a mesh in which the vertex density automatically concentrates in areas where there is greater contrast in the depth map texture, but that is beyond my knowledge.
2. Depth map with “swollen” and more blurred edges
This is an option that can reduce the quality of the details of the 3D mesh, but it is an efficient trick to solve the ugly mesh distortions that generate the effect of “spikes” on the edges of objects.
2a. Raw generated depth map

2b. Depth Map modified with Photoshop filters, expanding borders and blurring them

I should find a way to apply a similar effect directly to the raw depth map, creating a new texture in Unity. Other way would be making a shader with that kind of algorithm, but I’m not sur yet which way would be the best
(reconverting the depth map texture via Script or via Material/Shader)