accommodate inspector change
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_font.fs
1 uniform sampler2D uTexGarbage; // unused
2 uniform sampler2D uTexMain; // unused
3 uniform vec3 uCamera;
4 uniform float uTime;
5 uniform float uOpacity;
6 uniform float uColourize;
7
8 #include "light_clearskies_stddef.glsl"
9 #include "common_scene.glsl"
10 #include "motion_vectors_fs.glsl"
11
12 vec3 pal( float t ){
13 vec3 a = vec3(0.30,0.3,0.3);
14 vec3 b = vec3(0.8);
15 vec3 c = vec3(0.28,0.3,0.4);
16 vec3 d = vec3(0.00,0.1,0.1);
17 return a + b*cos( 6.28318*(c*t+d) );
18 }
19
20 void main(){
21 compute_motion_vectors();
22 vec3 vfrag = vec3(0.5,0.5,0.5);
23 vec3 qnorm = aNorm.xyz;
24
25 //vec4 vsamplemain = texture( uTexMain, aUv );
26 //vfrag = vsamplemain.rgb;
27
28 vec4 spread0 = uTime*0.0002*vec4( 17.3,-19.6, 23.2,-47.7 );
29 vec4 spread1 = uTime*0.0002*vec4( -13.3, 12.6,-28.2, 14.7 );
30
31 vec2 p = aCo.xy + vec2(0.3);
32 float a = atan( p.y/p.x );
33 vec4 v0 = step( vec4(0.5), fract(vec4(a) + spread0) );
34 vec4 v1 = step( vec4(0.5), fract(vec4(a) + spread1) );
35
36 float d = ( v0.x+v0.y+v0.z+v0.w +
37 v1.x+v1.y+v1.z+v1.w ) * 0.125;
38
39 float dither = fract(dot(vec2(171.0,231.0),gl_FragCoord.xy)/71.0);
40 float x = d*0.8+length(p)*0.3;
41 x = (floor(x*8.0) + step(dither, fract(x * 8.0))) / 8.0;
42
43 if( x + (uOpacity*2.0-1.0) < 0.5 )
44 discard;
45
46 vfrag = mix( vec3(x), pal( x ), uColourize );
47
48 if( g_light_preview == 1 ){
49 vfrag = vec3(0.5);
50 }
51
52 vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );
53 oColour = vec4( vfrag, 1.0 );
54 }