diff --git a/2D/BoxTiling.glsl b/2D/BoxTiling.glsl index 8fd15ba..103c283 100644 --- a/2D/BoxTiling.glsl +++ b/2D/BoxTiling.glsl @@ -1,9 +1,6 @@ #iChannel0 "https://i.imgur.com/TnmUwCn.jpg" -float XNUM = 10.; -float YNUM = 10.; - vec4 BoxCoords(vec2 uv) { vec2 gv = fract(uv); diff --git a/2D/HexTiling.glsl b/2D/HexTiling.glsl index 58a2d3c..112aea8 100644 --- a/2D/HexTiling.glsl +++ b/2D/HexTiling.glsl @@ -42,7 +42,7 @@ void mainImage ( out vec4 fragColor, in vec2 fragCoord) { vec4 hc = HexCoords(uv); //col.rg = hc(uv).xy; - col.rgb = texture(iChannel0, hc(uv).xy+0.5).rgb; + col.rgb = texture(iChannel0, hc.xy+0.5).rgb; col.rgb *= vec3(smoothstep(0.09, 0.99, sin(hc.z+hc.w/17.+iTime) )); fragColor = vec4(col, 1.0); diff --git a/2D/rainyWindow/rainyWindow.glsl b/2D/rainyWindow/rainyWindow.glsl new file mode 100644 index 0000000..2ef0dac --- /dev/null +++ b/2D/rainyWindow/rainyWindow.glsl @@ -0,0 +1,83 @@ + +#iChannel0 "file://./Textures/forrest.jpg" +#iChannel0::MinFilter "LinearMipMapLinear" +#iChannel0::WrapMode "Mirror" + +#define S(a,b,c) smoothstep(a,b,c) + + +float size = 4.0; +vec2 aspect = vec2(2,1); + +float N21(vec2 p) { + //return fract( sin(p.x*100.0+p.y*6574.0)*5647.0 ); + p = fract(p*vec2(233.32, 851.73)); + p += dot(p, p+23.45); + return fract(p.x*p.y); +} + +vec4 BoxCoords(vec2 uv) { + + vec2 gv = fract(uv); + vec2 id = floor(uv); + //standard uv + return vec4(gv.x, gv.y, id.x, id.y); +} + +vec3 RainLayer(vec2 uv, float t) { + vec2 iuv = uv; + uv.y += t * 0.13; + uv *= size * aspect; + + vec4 gv = BoxCoords(uv); + gv.xy -= 0.5; + + float dt = N21(gv.zw); + t += dt*6.22134; + + + float w = (iuv.y) * 10.; + float x = (dt-0.5)*0.8; + x += (.4-abs(x))*sin(3.*w)*pow(sin(w),6.)*0.45; + float y = -sin(t+sin(t+sin(t)*0.5))*0.45; + y -= (gv.x-x)*(gv.x-x); + + vec2 dropPos = (gv.xy-vec2(x,y))/aspect; + float drop = S(.05, 0.03, length(dropPos)); + + vec2 trailPos = (gv.xy-vec2(x,t * 0.25))/aspect; + trailPos.y = (fract(trailPos.y * 8.)-0.5) /8.; + float trail = S(.03, 0.01, length(trailPos)); + float fogTrail = S(-.05, .05, dropPos.y); + fogTrail *= S(.5, y, gv.y); + trail *= fogTrail; + fogTrail *= S(0.05, 0.04, abs(dropPos.x)); + + vec2 offset = drop*dropPos + vec2(trail)*trailPos; + offset *= -2.; + + return vec3(offset, fogTrail); + //return vec3(drop,1, fogTrail); +} + +void mainImage ( out vec4 fragColor, in vec2 fragCoord) { + vec2 uv = (fragCoord/iResolution.y); + float t = iTime; //mod(iTime, 7200.); + + vec4 col = vec4(0,0,0,1.0); + + vec3 rain = RainLayer(uv,t); + rain += RainLayer(uv*1.2+7.21,t); + rain += RainLayer(uv*1.35+1.21,t); + rain += RainLayer(uv*1.55-1.21,t); + + float blur = 4.0*(1.-rain.z); + + col.rgb = texture(iChannel0, uv + rain.xy, blur).rgb; + //col = vec4(rain.xxx,1.); + + + //if (gv.x > 0.48 || gv.y > 0.48) col = vec4(1,0,0,1); + //col.rgb = vec3(N21(uv.xy)); + fragColor = col; +} \ No newline at end of file diff --git a/2D/water/sand.jpg b/2D/water/sand.jpg deleted file mode 100644 index 29ad90e..0000000 Binary files a/2D/water/sand.jpg and /dev/null differ diff --git a/2D/water/water.glsl b/2D/water/water.glsl index a9c9017..0d009ae 100644 --- a/2D/water/water.glsl +++ b/2D/water/water.glsl @@ -1,5 +1,5 @@ #iChannel0::WrapMode "Repeat" -#iChannel0 "file://./sand2.jpg" +#iChannel0 "file://./Textures/sand.jpg" float N21(vec2 p) { //return fract( sin(p.x*100.0+p.y*6574.0)*5647.0 ); @@ -41,12 +41,11 @@ float SmoothNoise2(vec2 uv, int ocataves) { void mainImage ( out vec4 fragColor, in vec2 fragCoord) { vec2 uv = (fragCoord-0.5*iResolution.xy)/iResolution.y; - uv = uv*4.; float tmp; - float b = SmoothNoise2(uv+iTime*0.5,2)*0.5+SmoothNoise2(uv-iTime*0.2,2)*0.5; + float b = SmoothNoise2(uv*4.+iTime*0.5,2)*0.5+SmoothNoise2(uv*4.-iTime*0.2,2)*0.5; tmp = smoothstep(0.5, 0.505, b); b = tmp - smoothstep(0.505, 0.51, b); - fragColor = vec4( texture(iChannel0, uv+ SmoothNoise2(uv+iTime*0.5,2)*0.4 ).xyz+b, 1.0 ); + fragColor = vec4( texture(iChannel0, uv*1.5+ SmoothNoise2(uv+iTime*0.5,2)*0.4 ).xyz+b, 1.0 ); } \ No newline at end of file diff --git a/Textures/forrest.jpg b/Textures/forrest.jpg new file mode 100644 index 0000000..4133845 Binary files /dev/null and b/Textures/forrest.jpg differ diff --git a/2D/water/sand2.jpg b/Textures/sand.jpg similarity index 100% rename from 2D/water/sand2.jpg rename to Textures/sand.jpg