Using multiple 2D screen reading shaders with different z_indexes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pixel Puddle

With multiple screen reading shaders, how can they both be see through if they have different z_indexes?

As you can see below, Gas2 becomes opaque while Gas1 is visible. How can both shaders that use SCREEN_TEXTURE also both be see-through?

  1. Godot icon (Icon1, z_index = 20), screen reading shader (Gas1, z_index = 30)
  2. Godot icon (Icon2, z_index = 40), screen reading shader (Gas2, z_index = 50)

enter image description here

:bust_in_silhouette: Reply From: Pixel Puddle

I’m gonna pull a Stackexchange-style self-answer here, because I’ve figured it out

The solution is to use BackBufferCopy with the copy_mode set to Viewport and set its z_index above what you want coming through the shader reading the SCREEN_TEXTURE.

For example, here I am using a BackBufferCopy with its own z_index set to 41, so it’s above Icon2 (z_index = 40), and below Gas2 (z_index = 50).

enter image description here

Hope this helps someone else!