0 votes

Hello everyone,

I'm currently trying to wrap my head around pixel position manipulation in shaders.
My situation is the following (I'm honestly not sure how much of that is relevant but I hope that's enough information):
I have a Sprite with a Texture that is 500px x 500px (but scaled by 0.2).
This Sprite and with that the shader is not fullscreen.
And for this Sprite I have a shader that takes the UV value and manipulates it in some way. (It is supposed to do a swirl).

Now i have a modified UV Value and would like to read the SCREEN TEXTUTRE at this point,
but texture(SCREEN_TEXTURE, uv) needs the SCREEN UV and not the UV.

Is there any way to transform my UV to SCREEN_UV so i can read the correct pixel?

Is there a way to get the size of the screen and the size of the shader in pixels?
Then I can calculate this transformation myself.
I tried to get the sizes in pixels with SCREEN PIXEL SIZE and TEXTURE PIXEL SIZE (as well as doing several calculations with that) but i can't get it to work.

I hope i made myself clear enough and any help or pointers are greatly appreciated.

in Engine by (14 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.