map_toxic_fog.frag

main 31 lines · 799 bytes Raw
Alex Alex Commit Client Upload Part 1 19/10/2026 00:04
1uniform float u_Time;
2uniform sampler2D u_Tex0;
3uniform sampler2D u_Tex1;
4varying vec2 v_TexCoord;
5uniform mat3 u_TextureMatrix;
6uniform vec2 u_MapCoords;
7
8vec2 direction = vec2(1.0,0.3);
9float speed = 0.05;
10float pressure = 0.9;
11float zoom = 0.5;
12
13vec3 toxicEffect(vec3 color)
14{
15 return vec3(color.x * 0.15,
16 color.y * 0.6,
17 color.z * 0.15);
18}
19
20void main(void)
21{
22 vec2 b = vec2(-u_TextureMatrix[1][1]/u_TextureMatrix[0][0], 1.0);
23
24 vec2 offset = (u_MapCoords + (v_TexCoord * b) + (direction * u_Time * speed)) / zoom;
25 vec3 bgcol = texture2D(u_Tex0, v_TexCoord).xyz;
26 vec3 fogcol = texture2D(u_Tex1, offset).xyz;
27 fogcol = toxicEffect(fogcol);
28 vec3 col = bgcol + fogcol*pressure;
29 gl_FragColor = vec4(col,1.0);
30}
31
Top