Clipping planes in Mesh_basic_material

Hi, i created a mesh, using the meshbasicmaterial, and i tried to apply clipping for it.It is cliiping, but after certain clipping, if i try to move the mesh, the clipped parts are still visible

return new THREE.MeshBasicMaterial({
color: color ?? generateMetallicColor(),
side: THREE.DoubleSide,
clippingPlanes: clippingPlanes,
wireframe: true,
transparent: false,
opacity: 1,
clipShadows: true,
});

The planes are relative to the global space. They are not local to the object where they are used as clipping planes. To solve your issue, you have to recalculate the clipping planes whenever the object moves or rotates.

I’m not sure what is the best way to do this. I could only come up with this ugly solution:

https://codepen.io/boytchev/full/vYqaMxJ

image

PS. It is always considered polite and respectful when you format your code as code (instead of pouring it as text) and when you also provide an online debuggable program demonstrating the issue.

2 Likes