-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfrag.glsl
More file actions
40 lines (30 loc) · 827 Bytes
/
frag.glsl
File metadata and controls
40 lines (30 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 vUv;
#pragma glslify: random = require('glsl-random')
#pragma glslify: blend = require('glsl-blend-overlay')
uniform float aspect;
uniform vec2 scale;
uniform vec2 offset;
uniform bool coloredNoise;
uniform vec2 smoothing;
uniform float noiseAlpha;
uniform vec3 color1;
uniform vec3 color2;
void main() {
vec2 pos = vUv;
pos -= 0.5;
pos.x *= aspect;
pos /= scale;
pos -= offset;
float dist = length(pos);
dist = smoothstep(smoothing.x, smoothing.y, 1.-dist);
vec4 color = vec4(1.0);
color.rgb = mix(color2, color1, dist);
if (noiseAlpha > 0.0) {
vec3 noise = coloredNoise ? vec3(random(vUv * 1.5), random(vUv * 2.5), random(vUv)) : vec3(random(vUv));
color.rgb = mix(color.rgb, blend(color.rgb, noise), noiseAlpha);
}
gl_FragColor = color;
}