#version 450
#extension GL_GOOGLE_include_directive : enable
#extension GL_ARB_separate_shader_objects : enable
//#extension GL_EXT_shader_realtime_clock : enable // NOT ALLOWED
#include "../Base/Fragment.glsl"
#include "../Base/UniformBlocks.glsl"
#define PI 3.14159
float vDrop(vec2 uv,float t)
{
uv.x = uv.x*128.0; // H-Count
float dx = fract(uv.x);
uv.x = floor(uv.x);
uv.y *= 0.05; // stretch
float o=sin(uv.x*215.4); // offset
float s=cos(uv.x*33.1)*.3 +.7; // speed
float trail = mix(95.0,35.0,s); // trail length
float yv = fract(uv.y + t*s + o) * trail;
yv = 1.0/yv;
yv = smoothstep(0.0,1.0,yv*yv);
yv = sin(yv*PI)*(s*5.0);
float d2 = sin(dx*PI);
return yv*(d2*d2);
}
void main()
{
//vec2 p = (vertexWorldPosition.xz - 0.5 * (vertexWorldPosition.xz+500.0)) / (vertexWorldPosition.xz-250.0);
vec2 p = (vertexWorldPosition.xz);
float d = length(p)+0.1;
p = vec2(atan(p.x, p.y) / PI, 2.5 / d);
float t = CurrentTime*0.004;
vec3 col = vec3(1.55,0.65,.225) * vDrop(p,t); // red
col += vec3(0.55,0.75,1.225) * vDrop(p,t+0.33); // blue
col += vec3(0.45,1.15,0.425) * vDrop(p,t+0.66); // green
outColor[0] = vec4(col*(d*d), 1.0);
//Material material = materials[materialID];
//outColor[0] = material.diffuseColor * color;
//int textureID = GetMaterialTextureHandle(material, TEXTURE_DIFFUSE);
//if (textureID != -1) outColor[0] *= texture(texture2DSampler[textureID], texcoords.xy);
//Camera distance fog
//if ((entityflags & ENTITYFLAGS_NOFOG) == 0) ApplyDistanceFog(outColor[0].rgb, vertexWorldPosition.xyz, CameraPosition);
//if ((RenderFlags & RENDERFLAGS_TRANSPARENCY) != 0)
//{
// outColor[0].rgb *= outColor[0].a;
// //outColor[0].a = 1.0f;
//}
}
Hyperdrive shader based on Drop Tunnel by Del