Hey I'm pretty new to Godot and was trying to implement an equivalent to a unity stencil shader for my project. I got most everything setup and it works in editor. However, whenever I play the game and try to reference the subviewport texture in a 3D object's shader the texture just show up as pink. If I restart the game engine then the texture shows up as pink in editor too (until I reset the ViewportTexture's local to scene checkbox). I'm wondering if there is anything I've missed and need to implement to get it to work. I've attached a copy of my debug project for convenience.
Zip File:
Screenshots:
In editor (everything's fine):
in game (suddenly broken: applies to 3D mesh objects, textureRect and sprite3D don't do this):