X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fscene_font.fs;h=366e120115a448eebd9f4bcfcfc42d51d3aa5330;hb=be5e25dee2c54c2a22ca3bbb5bbe0eb6149343be;hp=27241fee83b488710d782d6ce234c05bcd5cf71b;hpb=c2b59441df0383807ba093295af2e4400e552f39;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/scene_font.fs b/shaders/scene_font.fs index 27241fe..366e120 100644 --- a/shaders/scene_font.fs +++ b/shaders/scene_font.fs @@ -1,23 +1,51 @@ uniform sampler2D uTexGarbage; // unused -uniform sampler2D uTexMain; +uniform sampler2D uTexMain; // unused uniform vec3 uCamera; -uniform vec4 uPlane; +uniform float uTime; +uniform float uOpacity; +uniform float uColourize; +#include "light_clearskies_stddef.glsl" #include "common_scene.glsl" #include "motion_vectors_fs.glsl" -void main() -{ - compute_motion_vectors(); +vec3 pal( float t ){ + vec3 a = vec3(0.30,0.3,0.3); + vec3 b = vec3(0.8); + vec3 c = vec3(0.28,0.3,0.4); + vec3 d = vec3(0.00,0.1,0.1); + return a + b*cos( 6.28318*(c*t+d) ); +} +void main(){ + compute_motion_vectors(); vec3 vfrag = vec3(0.5,0.5,0.5); - vec4 vsamplemain = texture( uTexMain, aUv ); vec3 qnorm = aNorm.xyz; - vfrag = vsamplemain.rgb; + //vec4 vsamplemain = texture( uTexMain, aUv ); + //vfrag = vsamplemain.rgb; + + vec4 spread0 = uTime*0.0002*vec4( 17.3,-19.6, 23.2,-47.7 ); + vec4 spread1 = uTime*0.0002*vec4( -13.3, 12.6,-28.2, 14.7 ); + + vec2 p = aCo.xy + vec2(0.3); + float a = atan( p.y/p.x ); + vec4 v0 = step( vec4(0.5), fract(vec4(a) + spread0) ); + vec4 v1 = step( vec4(0.5), fract(vec4(a) + spread1) ); + + float d = ( v0.x+v0.y+v0.z+v0.w + + v1.x+v1.y+v1.z+v1.w ) * 0.125; + + float dither = fract(dot(vec2(171.0,231.0),gl_FragCoord.xy)/71.0); + float x = d*0.8+length(p)*0.3; + x = (floor(x*8.0) + step(dither, fract(x * 8.0))) / 8.0; + + if( x + (uOpacity*2.0-1.0) < 0.5 ) + discard; + + vfrag = mix( vec3(x), pal( x ), uColourize ); - if( g_light_preview == 1 ) - { + if( g_light_preview == 1 ){ vfrag = vec3(0.5); }