parent
0e23850ebc
commit
f59d5073ee
@ -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; |
||||
} |
||||
|
Before Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 905 KiB |
|
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 196 KiB |
Loading…
Reference in new issue