I am using ARKit + SceneKit. After applying depth video with alpha channel on SCNPlane, scaled triangles appear. How to remove these triangles and vertices that remained on the SCNPlane with depth 0.0.
Result The video for videotexture
I am using ARKit + SceneKit. After applying depth video with alpha channel on SCNPlane, scaled triangles appear. How to remove these triangles and vertices that remained on the SCNPlane with depth 0.0.
Result The video for videotexture
I think distortions appear (meaning scaled triangles) like in the image below
Seems like this code might be the solution.
Can anyone explain what this code does?
sampler linearSampler = sampler( filter::linear, mip_filter::linear, max_anisotropy(8) );
float center = u_displacementTexture.sample(linearSampler, _surface.diffuseTexcoord).r; float x_up = u_displacementTexture.sample(linearSampler, _surface.diffuseTexcoord, int2(1, 0)).r; float x_down = u_displacementTexture.sample(linearSampler, _surface.diffuseTexcoord, int2(-1, 0)).r; float y_up = u_displacementTexture.sample(linearSampler, _surface.diffuseTexcoord, int2(0, 1)).r; float y_down = u_displacementTexture.sample(linearSampler, _surface.diffuseTexcoord, int2(0, -1)).r;
float threshold = 0.01 / scn_commonprofile.displacementIntensity; if (abs(x_up - center) > threshold || abs(x_down - center) > threshold || abs(y_up - center) > threshold || abs(y_down - center) > threshold) { discard_fragment(); }