No, it’s not the vertices that are discarded but the fragment: I think the
clip method they use in the Unity shader code is the
discard instruction of the fragment shader. This instruction means that the pixel will not be written to (recall that this instruction is in the fragment shader) and the zbuffer won’t be updated neither.
No, they won’t be influenced if they don’t use this material: it’s something that is done in the fragment shader, so linked to a material. Set this material to the wall but not to any other objects.
projectionTexture of the
SpotLight: this texture is passed to the fragment shader and is handled with the right math to appear being projected onto the mesh(es) the spot light affects:
The projected texture is:
You could imagine having a specific material that is using the same math to project a texture and discard the pixel if the texture has some specific value or any other condition (like alpha < 0.5 for eg).
To illustrate this, I have hacked the standard material code to discard fragments if the rgb value in the projected texture of the spot light is (0,1,0) in the PG above:
I also have added a cube so that you can see it is visible where the pixels are discarded. And because it hasn’t the customized standard material that I set on the ground, pixels are not discarded for it.