To start off with it, I’m not very good with Shaders yet, I’m still learning, but I’m trying to figure out how to write a shader which I put on a Polygon2D, which should simply flip everything directly above it on the Y axis. This is what I got so far:
However, there’s one big issue with this. As I understand it, SCREEN_UV, as the name suggests, uses the viewport as reference. This causes the illusion to completely fall apart as soon as the camera moves up or down for any reason.
How can I modify this shader so it “ignores” the viewport moving up and down, and simply reflect CanvasItems?
The node this shader is attached to is not following the camera, that’s the whole point. This is attached to a simple Polygon2D which sits just under the player.
ok, i tested myself with movement up down, left right with camera on characterbody2d on water reflection shader. it kinda doesnt work only if i removed BackBufferCopy Node before the node with shader.
I’ll provide a bit more context to the post. I’m working on a 2D beat-em-up / platformer game, and this is supposed to be a somewhat simple but more flexible reflection method I can fine-tune. However, as it stands right now, it’s behavior is not correct, see the following example:
The video linked and the code provided does indeed seem to work with a Sprite2D, but does not work when using a Polygon2D, which is the main reason I needed a custom solution.