Multiple portals with Stencil Filters in Unity

I have a scene in Unity where I have two portals:

With Stencil Filter I want to render differents worlds in both portals. The green floor has this shader:

Shader "Custom/StancilFilter"
{
   Properties
   {
    _Color ("Color", Color) = (1,1,1,1)
    [Enum(Equal,3,NotEqual,6)] _StencilTest ("Stencil Test", int) = 6
}
SubShader
{
    Color [_Color]
    Stencil{
       Ref 1
       Comp [_StencilTest]
   
    }
   
   
    Pass
    {
    }
}

}

While the portal on the right has this shader:

Shader "Custom/PortalWindow2"
{

SubShader
{

    ZWrite off
    ColorMask 0
   
   
    Stencil{
       Ref 2
       Pass replace
      
    }

    Pass
    {
    }
}
}

I’m very new to shaders, and my question is: how can I prevent the right portal to render the green floor?

This thread might help get you started ** Portals via Stencils in Unity .**
It includes a link to the github project. I’ve not tested it for a long time, but it should still work with the built-in pipeline.
Yikes - just checking the date on my post and its from back in 2013! How time flies.