accommodate inspector change
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_gate_unlinked.fs
1 out vec4 FragColor;
2
3 uniform float uTime;
4 uniform vec3 uCam;
5 uniform vec4 uColour;
6
7 in vec3 aNorm;
8 in vec2 aUv;
9 in vec3 aCo;
10
11 #include "motion_vectors_fs.glsl"
12
13 const int NOISE_LOOP = 3;
14 vec3 digital_noise( uvec3 iuv ){
15 iuv *=uvec3(8,2524,7552);
16 for( int i=0; i<NOISE_LOOP; i++ )
17 iuv += (iuv.yzx<<2) ^ (iuv.yxz)+iuv.z;
18 return vec3(iuv)*(1.0/float(0xffffffffU));
19 }
20
21 vec2 rand_hash22( vec2 p ){
22 vec3 p3 = fract(vec3(p.xyx) * 213.8976123);
23 p3 += dot(p3, p3.yzx+19.19);
24 return fract(vec2((p3.x + p3.y)*p3.z, (p3.x+p3.z)*p3.y));
25 }
26
27 void main(){
28 compute_motion_vectors();
29
30 vec2 ssuv = gl_FragCoord.xy;
31 float grad = 1.0-aUv.y*0.1;
32 float opacity = rand_hash22( vec2(floor(aUv.y*100.0),floor(aCo.z*10.0+uTime*40.0)) ).r*grad;
33
34 vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );
35 float dither = fract( vDither.g / 71.0 ) - 0.5;
36
37 if( opacity<0.9 )
38 discard;
39
40 FragColor = vec4(0.7,0.5,0.5,1.0);
41 }