Function of the Clip () command

I’ve seen in a number of examples and the debug of the ‘compiled’ shader the use of the following for creating a cutout or alpha for a texture:

clip (o.Alpha - Cutoff);

I get the whole alpha and cutoff, that’s not the question. I cannot find any more info on the clip() function, especially since the return doesn’t actually get assigned. Is this the actual function behind the alphatesting? Or is this a built-in that automatically assigns to o.Alpha (o.a)?

Any answers?

clip(x) essentially discards any texel whose value of x is below zero - the texel simply doesn’t get rendered.

It’s pretty much the function behind alphatesting. It has no return value and is a standalone function.

Documentation here; clip - Win32 apps | Microsoft Learn

3 Likes