Hiding textures from certain lights and not others

Godot Version



I’m making a 3D game where you can have a device that can reveal hidden messages for the player.
It’s the same idea behind a UV light or some x-rays or something like that.

First I tried using a spotlight 3D and decals, but I couldn’t figure out how to make it work on some parts of the decal but not all of it.

Then I found this shader, which is amazing…
My UV light worked great on the meshes with that shader, but as the shader requires mask culling in all other lights, (including the main character’s flashlight) the meshes would not interact with other lights at all, giving away the presence of the secret.

So now I’m at a loss. The only thing I can think of is having duplicate objects so I can cull one but not the other, and managing it that way, but what would you do?

If there was a way to change the visual instance layer per material that could work…