Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | scrubswithnosleeves |
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:
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;