shine_fragment.frag

main 47 lines · 1.3 KB Raw
Alex Alex Commit Client Upload Part 1 19/10/2026 00:04
1uniform mat4 u_Color;
2varying vec2 v_TexCoord;
3varying vec2 v_TexCoord2;
4varying vec2 v_TexCoord3;
5varying vec2 v_Position;
6uniform sampler2D u_Tex0;
7uniform float u_Time;
8uniform vec2 u_Resolution;
9
10float speed = 5.0;
11float height = 1.0;
12float radius = 8.0;
13
14void main()
15{
16 float r = 255.0 / 255.0;
17 float g = 255.0 / 255.0;
18 float b = 255.0 / 255.0;
19
20 float modSpeed = 0.8;
21 float mode = abs(0.5 - mod(u_Time * modSpeed, 1.0)) * 1.5;
22
23 gl_FragColor = texture2D(u_Tex0, v_TexCoord);
24 vec4 texcolor = texture2D(u_Tex0, v_TexCoord2);
25 vec4 texcolor2 = texture2D(u_Tex0, v_TexCoord3);
26 if(texcolor.r > 0.9) {
27 gl_FragColor *= texcolor.g > 0.9 ? u_Color[0] : u_Color[1];
28 } else if(texcolor.g > 0.9) {
29 gl_FragColor *= u_Color[2];
30 } else if(texcolor.b > 0.9) {
31 gl_FragColor *= u_Color[3];
32 }
33
34 if(gl_FragColor.a < 0.01) {
35 if(texcolor2.a > 0.01) {
36 gl_FragColor = vec4(r, g, b, mode);
37 } else {
38 discard;
39 }
40 }
41
42 if(texcolor.a > 0.9) {
43 gl_FragColor.xyz *= max(1.0, height / sqrt(abs(abs(sqrt(v_Position.x * v_Position.x + v_Position.y * v_Position.y) / 8.0) - abs(mod(u_Time * speed, radius * 2.0) - radius))));
44 }
45 if(gl_FragColor.a < 0.01) discard;
46}
47
Top