Video Texture with Mask

I’m creating a project that involves playing a video and I’m using a video texture for this. I also wanted to add a mask to this so that I can view the video through a unique shape. I wanted to create something like this: where the visible parts of the texture would be the visible parts of the video.

This is the playground I’m using to test this: it includes a glb model of a star to verify the video texture works fine with a custom model. Is this possible using only textures?

The PG does not work for me:

A quick Chromakey shader

Sorry about that, looks like the file was blocked on your end. Nonetheless, I know the custom shape works so I just replaced it with a box. The Chroma Key example looks great, though the video I’m using does not have a green screen. I think the video texture with the 3d mesh would work just fine now that I’m playing around with it, although I would like to use the 3d mesh as the mask. I saw a playground using the stencil buffer which may be what I’m looking to implement.

It’s been a while since I played with shaders but I’m looking to create a portal-like effect where I can see through one end like this: Impossible Geometry with Stencil Shaders in Unity URP - YouTube . If there’s something already like that available in a playground I’d love to see it, otherwise I’ll attempt to create it myself.