- Edited
I developed a basic understanding of shaders but I cannot wrap my head around screen shaders and there seems to be a noticeable lack of tutorials on it :/ I read this page multiple times: https://docs.godotengine.org/en/stable/tutorials/shaders/screen-reading_shaders.html but it's not nearly detailed enough for me to understand how this works.
So, I would really appreciate if someone could help with this:
What information is actually taken from screen_uv? I get that the values go from 0.0 -> 1.0 from the topleft in each axis. However, a CanvasLayer with a ColorRect gets ignored for some reason? Or do we only apply the screenshader to elements below it ((or elements before it in the scene tree, or elements with a lower z index)?
I tried to use visual shaders to get some information for each step, for example I have this:
And I guess the shader preview just isn't working? Expanding the other nodes doesn't do anything either. Shouldn't the input in the image show a UV image like the normal UV information? Also, when using visual shaders with the Texture2D node, do I need the SamplerPort or the screen option? I have never seen that mentioned anywhere (in fact, nobody covers visual shaders)Still from the image above, I get that I am taking the red values from the image below the ColorRect and multiply it with the x value of the screen_uv, which works and I get values that get lighter the further right the screen goes. But when I try to limit the alpha values it gets ignored. I assume I am getting the alpha values from the ColorRect but I am not sure what to do about it.
In more general terms, does anyone know of a tutorial that explains screen shaders? I feel like I am figuring things out by blindly bashing things together which is super frustrating.
oh also, one minor but very annoying thing: Why can't I lock the CanvasLayer in the above example? Clicking on the lock symbol doesn't do anything and it makes it impossible to move things around in the editor