THE REST
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_gate_unlinked.h
index b617ab59148f37cdfba6001b4e7e638cea09c9eb..1fda296a7a51e05b7300403adb13c0269be401da 100644 (file)
@@ -97,19 +97,34 @@ static struct vg_shader _shader_model_gate_unlinked = {
 "\n"
 "#line     12        0 \n"
 "\n"
+"const int NOISE_LOOP = 3;\n"
+"vec3 digital_noise( uvec3 iuv ){\n"
+"   iuv *=uvec3(8,2524,7552);\n"
+"   for( int i=0; i<NOISE_LOOP; i++ )\n"
+"      iuv += (iuv.yzx<<2) ^ (iuv.yxz)+iuv.z;\n"
+"   return vec3(iuv)*(1.0/float(0xffffffffU));\n"
+"}\n"
+"\n"
+"vec2 rand_hash22( vec2 p ){\n"
+"   vec3 p3 = fract(vec3(p.xyx) * 213.8976123);\n"
+"   p3 += dot(p3, p3.yzx+19.19);\n"
+"   return fract(vec2((p3.x + p3.y)*p3.z, (p3.x+p3.z)*p3.y));\n"
+"}\n"
+"\n"
 "void main(){\n"
 "   compute_motion_vectors();\n"
 "\n"
 "   vec2 ssuv = gl_FragCoord.xy;\n"
-"   float opacity = 1.0-smoothstep(0.0,1.0,aUv.y+uColour.a);\n"
+"   float grad = 1.0-aUv.y*0.1;\n"
+"   float opacity = rand_hash22( vec2(floor(aUv.y*100.0),floor(aCo.z*10.0+uTime*40.0)) ).r*grad;\n"
 "   \n"
 "   vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );\n"
 "   float dither = fract( vDither.g / 71.0 ) - 0.5;\n"
 "\n"
-"   if( opacity+dither<0.5 )\n"
+"   if( opacity<0.9 )\n"
 "      discard;\n"
 "\n"
-"   FragColor = uColour;\n"
+"   FragColor = vec4(0.7,0.5,0.5,1.0);\n"
 "}\n"
 ""},
 };