Make your "xray glass"-node a Light2D. Set it's texture to a fully white image (it has to be white, nothing else, i.e. "#FFFFFF"!) and the mode
-property to "Mix". The size of the image depends on how large the x-rayed area is supposed to be. If you don't want it to be rectangular, you can add shape by including fully transparent areas.
Next, select your "sprite 2"-node. In the inspector under CanvasItem > Material create a new CanvasItemMaterial from the dropdown-menu and set it's light_mode
-property to "Unshaded". This will be the overlay, which is shown by default, so we don't want it to be affected by the light.
Lastly, select your "sprite 1"-node and create a new CanvasItemMaterial for it as well. Only this time, set it's light_mode
to "Light Only". That way, it will only become visible where it overlaps with a Light2D texture.
Make sure, that your tree looks like this - order matters here:
- Root-Node (whatever)
- xray glass
- sprite 2
- sprite 1