shaders folder!
This commit is contained in:
parent
69c28ced8b
commit
f1e7f136f8
30 changed files with 28 additions and 29 deletions
|
@ -1,43 +0,0 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
const float PI = 3.1415926535;
|
||||
|
||||
uniform bool enabled = true;
|
||||
uniform vec2 resolution;
|
||||
uniform vec2 curvature;
|
||||
uniform vec2 scanline_opacity;
|
||||
uniform float brightness;
|
||||
|
||||
vec2 curve_uv(vec2 uv) {
|
||||
uv = uv * 2.0 - 1.0;
|
||||
vec2 offset = abs(uv.yx) / vec2(curvature.x, curvature.y);
|
||||
uv = uv + uv * offset * offset;
|
||||
uv = uv * 0.5 + 0.5;
|
||||
return uv;
|
||||
}
|
||||
|
||||
vec3 scanline_intensity(float uv, float res, float opacity) {
|
||||
float intensity = sin((uv * res - 0.25) * PI * 2.0);
|
||||
intensity = ((0.5 * intensity) + 0.5) * 0.9 + 0.1;
|
||||
return vec3(pow(intensity, opacity));
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
if (enabled) {
|
||||
vec2 curved_uv = UV;
|
||||
vec3 base_color = texture(TEXTURE, curved_uv).rgb;
|
||||
|
||||
base_color += vec3(1.0/256.0);
|
||||
base_color *= scanline_intensity(curved_uv.x, resolution.x, scanline_opacity.y);
|
||||
base_color *= scanline_intensity(curved_uv.y, resolution.y, scanline_opacity.x);
|
||||
base_color *= vec3(brightness);
|
||||
|
||||
if (curved_uv.x < 0.0 || curved_uv.y < 0.0 || curved_uv.x > 1.0 || curved_uv.y > 1.0) {
|
||||
COLOR = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
} else {
|
||||
COLOR = vec4(base_color, 1.0);
|
||||
}
|
||||
} else {
|
||||
COLOR = texture(TEXTURE, UV);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue