0 votes

Hey All,

Preface: I am very new to and bad at shaders. I can basically only write some simple fragment shaders that color a sprite differently lol.

I am trying to create a screen perspective skew shader like what is used in this pic:
enter image description here

So lost on where to start lol. Is this a frag shader, or a vertex shader, or both? It seems like it is simple enough to be a beginner project, but I can't figure it out haha. At first, I thought it was a vertex shader, but beyond not really being able to get a skew working, I also didn't know how to apply a vertex shader over the entire screen. I know how to do that with fragment shaders tho. Is this something to do with just changing the SCREEN_UV values?

I am starting to read the book of shaders right now, but I hate that Godot's language is different. any ideas on where to learn what is necessary to do this. Or know of a shader like this that I can just paste in haha.

here is my current crack at it, but nothing happens haha:

void fragment(){
    vec2 uv = ((FRAGCOORD.xy / (1.0 / TEXTURE_PIXEL_SIZE).xy) - 0.5) * vec2((1.0 / TEXTURE_PIXEL_SIZE).x / (1.0 / TEXTURE_PIXEL_SIZE).y, 1.0);

    vec4 screen = texture(TEXTURE, uv);
    COLOR = screen;
Godot version 3.3.1
in Engine by (577 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.