Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcosbitetti/ef2f425066fb2e05755fe5f8d199c60f to your computer and use it in GitHub Desktop.
Save marcosbitetti/ef2f425066fb2e05755fe5f8d199c60f to your computer and use it in GitHub Desktop.
Simple Faster Blur for Godot Shader
// VERTEX SHADER
uniform vec2 screen_size = vec2(1280,800);
VAR1 = vec4(1.0/screen_size.x,1.0/screen_size.y,0.0,0.0);
// FRAGMENT SHADER
vec3 sc =
texscreen( vec2(SCREEN_UV.x-VAR1.x*4.0, SCREEN_UV.y-VAR1.y*4.0) ) * 0.0162162162 +
texscreen( vec2(SCREEN_UV.x-VAR1.x*3.0, SCREEN_UV.y-VAR1.y*3.0) ) * 0.0540540541 +
texscreen( vec2(SCREEN_UV.x-VAR1.x*2.0, SCREEN_UV.y-VAR1.y*2.0) ) * 0.1216216216 +
texscreen( vec2(SCREEN_UV.x-VAR1.x, SCREEN_UV.y-VAR1.y) ) * 0.1945945946 +
texscreen(SCREEN_UV) * 0.2270270270 +
texscreen( vec2(SCREEN_UV.x+VAR1.x, SCREEN_UV.y+VAR1.y) ) * 0.1945945946 +
texscreen( vec2(SCREEN_UV.x+VAR1.x*2.0, SCREEN_UV.y+VAR1.y*2.0) ) * 0.1216216216 +
texscreen( vec2(SCREEN_UV.x+VAR1.x*3.0, SCREEN_UV.y+VAR1.y*3.0) ) * 0.0540540541 +
texscreen( vec2(SCREEN_UV.x+VAR1.x*4.0, SCREEN_UV.y+VAR1.y*4.0) ) * 0.0162162162
;
COLOR = color(sc.r,sc.g,sc.b,1.0);
@0nepixel
Copy link

how do you use this, but using vec4 instead of vec3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment