Make Cylinder Transparent when Vertex Position Above Intersecting Plane in Y?

As the title suggest, I have a scenario where a plane, or more generally a mesh whose vertices can be higher/ low in y around the edge. I would like to place a cylinder across the plane such that the cylinder is made transparent when it’s vertices are above the intersection points of the other mesh.

I suppose it’s a bit like a boolean operation, except I need to be able to do this at runtime. Hence a shader. I followed a video where parts of a sphere are made transparent at, or around, the intersection of the other object. However, this is not the effect I want, I want the cylinder to be transparent, or cutout, above the parts where the intersection takes place.

is this achievable and if so how could I go about it?

Some quick pointers :

You’ll need your plane to feed it’s position and it’s normal (up vector) to the shader.

Use the dot product of the (Vector going from the fragment position to the plane position) and the normal vector of the plane to determine whether or not the pixel should be transparent.

Let me know if it works out !

Thanks for tips Rob. I’ll get my head around it this weekend and let you know how get on.