Shader Graph: How to make a simple clipping shader?

I´m new to shader graph and I like the fact that it allows creating shaders without memorizing the bizarre HLSL syntax by heart =)

However, I stumbled upon a problem: I have an old clipping shader that just discards all pixels below a certain plane in the world (the clipping plane is defined as position and normal vectors). Unity could not convert my shader automatically, so I guess I need to create a new lightweight rendering pipeline (which my project uses) compatible shader then.

My question is: How can I create a similar clipping shader using shader graph? I tried playing with the position, step and comparison nodes, but only got weird results. Is it even possible with the built-in nodes or do I need to create a custom node for the clipping/discarding?

Any help for a shader graph newbie would be appreciated. I did not find such shader by searching the net/docs.

Or if someone can point me to a LWRP compatible clipping shader, that would be awesome as well!

Did you try using the Alpha Clip Threshold output on the Master Node?

1 Like

Would Alpha Clip Threshold + something position-based work for a clipping shader? I’ve had good results using the Alpha Clip Threshold for other things so I’m assuming it could work well for a clipping shader.

Speaking of, I need to figure out how to make a cutaway shader, i.e. a clipping shader but the “empty” part is filled in with a solid color or texture. Is there a way to do that using Shader Graph?

Thanks for the answers @Andy-Touch and @Ehredt . I tried toying with the Alpha Clip Threshold in the PBR Master node, but could not get any clipping to happen, but thats probably due to my very limited skills on shader graph.

This is what I thought would do the trick (on X axis), but no luck:

The docs only say “Fragments with an alpha below this value will be discarded. Requires a node connection. Expected range 0 - 1.” So I am not sure how to make this work.

Would it be possible to guide me a little bit here? Or even post an example?

Ok like 3 nanoseconds after posting the above I got it - I have to set the position input to Alpha input and then Clip property to the Alpha Clip Threashold, like this:


Yay, I have a very primitive clipping shader made with shader graph. Of course this works only on one axis and in world position.

Any tips how to improve this are welcome.


This is a more advanced one.


Apperantly, atm the alpha clip threshold only works when a property node is inserted

1 Like

Why not just expose the clip method… writing shaders like this takes way more time and so much more bloat.


It is a matter of choice and depends on user case.
The simplest case is a single material and in this case you are right - the clip keyword and plane properties should be exposed and you can manage the clipping properties locally on material values.
But when using a number of materials with the same clipping plane and keyword - it might be more convenient to hide them on shaders and materials so you could manage them globally by shader globals.

Unity just messed up their shader developer tools is whats so annoying.

I wish they would have done it like the points below as it would have solved more issues in a more elegant way.

  • Make an agnostic C# => shader lang transpiler using Roslyn syntax analyzers.
  • Make Shader-Graph compile to C# shaders.
  • This allows people who know what they’re doing to write more optimized shaders in C# while people who don’t to use shader graph.

But whatever stuff in Unity is pretty hacky atm.


Thats one of the best ideas ive ever seen about shaders

CS2X will eventually support this “C# => native shader lang” concept later:
Or course its not a Unity3D thing but something I’ve always wanted.

Hey, I know it’s been a couple years, but do you know how I could add a rotation to the clipping plane? I’m SO close to having this effect being how i need it, all I need is the rotation.

Thanks ahead of time!

Just rotate the SectionPlane and then update it on the material, so this way you will get the section plane rotating around SectionPoint.

Thanks for your brain, man, I couldn’t do it for 2 weeks) Although I knew it, this is a banal thing, only I used R for the place. A in Split

8739084--1183524--scr_20230118_190918_501.png [quote=“tomekkie2, post:6, topic: 721607, username:tomekkie2”]

This is a more advanced one.
I improved to fit my needs, thanks.
Now it works like this: clipping occurs at a point relative to the object and along the normal of the plane.