Added filter rgb_uv_distort.gdshader and improved greyscale.gdshader
This commit is contained in:
parent
00bac825a0
commit
e18fd7a14e
3 changed files with 16 additions and 4 deletions
|
@ -6,6 +6,7 @@ const dir = "res://src/presets/shaders/"
|
||||||
"Empty": load(dir + "empty.gdshader"),
|
"Empty": load(dir + "empty.gdshader"),
|
||||||
"Greyscale": load(dir + "greyscale.gdshader"),
|
"Greyscale": load(dir + "greyscale.gdshader"),
|
||||||
"Lowpass": load(dir + "lowpass.gdshader"),
|
"Lowpass": load(dir + "lowpass.gdshader"),
|
||||||
|
"RGB -> UV Distort": load(dir + "rgb_uv_distort.gdshader"),
|
||||||
"Mix": load(dir + "mix.gdshader")
|
"Mix": load(dir + "mix.gdshader")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
shader_type canvas_item;
|
shader_type canvas_item;
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
// TODO: not only r
|
|
||||||
vec4 tex = texture(TEXTURE , UV);
|
vec4 tex = texture(TEXTURE , UV);
|
||||||
COLOR.r = tex.r;
|
float b = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
|
||||||
COLOR.g = tex.r;
|
COLOR.r = b;
|
||||||
COLOR.b = tex.r;
|
COLOR.g = b;
|
||||||
|
COLOR.b = b;
|
||||||
COLOR.a = tex.a;
|
COLOR.a = tex.a;
|
||||||
}
|
}
|
||||||
|
|
11
src/presets/shaders/rgb_uv_distort.gdshader
Normal file
11
src/presets/shaders/rgb_uv_distort.gdshader
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
const float strength = 0.1;
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec2 uv = UV;
|
||||||
|
float b = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
|
||||||
|
uv.x = mix(uv.x, b, strength);
|
||||||
|
uv.y = mix(uv.y, b, strength);
|
||||||
|
COLOR = texture(TEXTURE, uv);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue