map_test_fragment.frag

main 33 lines · 817 bytes Raw
Alex Alex Commit Client Upload Part 1 19/10/2026 00:04
1#ifdef GL_ES
2precision mediump float;
3#endif
4
5uniform float u_Time;
6uniform sampler2D u_NoiseTexture; // Noise texture for turbulence
7varying vec2 v_TexCoord;
8
9float cloudNoise(vec2 uv) {
10 return texture2D(u_NoiseTexture, uv).r;
11}
12
13void main(void) {
14 vec2 uv = v_TexCoord;
15
16 float ttime = u_Time * 0.1;
17 vec2 offset = vec2(sin(ttime), cos(ttime)) * 0.1;
18
19 // Apply turbulence using noise function
20 float turb = cloudNoise(uv + offset);
21 uv += (turb - 0.5) * 0.1;
22
23 // Apply the cloud color
24 vec3 cloudColor = vec3(0.5, 0.6, 1.0); // Blue cloud color
25 float opacity = 0.6;
26
27 // Apply a cloud-like blending using turbulence
28 float cloudLayer = cloudNoise(uv * 5.0);
29 vec3 finalColor = mix(cloudColor, vec3(1.0), cloudLayer * opacity);
30
31 gl_FragColor = vec4(finalColor, 1.0);
32}
33
Top