6-way clipping shader

I’ve searched for 3 days and found a couple of tutorials and one unity store package explaining how to set up a scene where a plane can make part of an object invisible using shaders. With all of them, I find one of these two problems:

  • The shader doesn’t work, gives errors, or just turns the object pink
  • The shader works, but is buggy when I change the object in the example scene, and has errors when I try to modify the code to support 6 planes instead of 1 or 2

Some of the tutorials I found:

There was one tutorial with a submarine example object which was the only one with problem 2, but I can’t find it again

I need a shader and/or scene which can hide all parts of an object which are beyond 6 clipping faces, or a cube’s 6 faces. I’m using 2020.3.26f1. I have very little experience with shaders and the correct inspector panel setups in order to make them work properly (which might be the reason I failed when using some of the tutorials).

I’m willing to try new solutions as well as solutions which modify or correctly follow the tutorials to work properly.

the latest amplify shader editor has a shader and demo how to set this type up and then you could make all your custom effects also

its inside the ase shader package that is free to download if you own ase already