diff --git a/border/shaders/effect-border-iq.slang b/border/shaders/effect-border-iq.slang index 87ae80d..fbfb4d7 100644 --- a/border/shaders/effect-border-iq.slang +++ b/border/shaders/effect-border-iq.slang @@ -1,6 +1,13 @@ #version 450 -// All effects created by inigo quilez - iq/2014 +// All effects created by inigo quilez - iq/2013-2017 +// Hexagons - distance : https://www.shadertoy.com/view/Xd2GR3 +// Voronoi - smooth : https://www.shadertoy.com/view/ldB3zc +// Color grid : https://www.shadertoy.com/view/4dBSRK +// Voronoi - metrics : https://www.shadertoy.com/view/MdSGRc +// Iterations - shiny : https://www.shadertoy.com/view/MslXz8 +// Fractal Tiling : https://www.shadertoy.com/view/Ml2GWy +// Bubbles : https://www.shadertoy.com/view/4dl3zn // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. // modified for slang border shader by hunterk @@ -32,21 +39,21 @@ layout(std140, set = 0, binding = 0) uniform UBO mat4 MVP; } global; -#pragma parameter effect "Effect Choice" 1.0 1.0 6.0 1.0 +#pragma parameter effect "Effect Choice" 1.0 1.0 7.0 1.0 #pragma parameter aspect_x "Aspect Ratio Numerator" 64.0 1.0 256. 1.0 #pragma parameter aspect_y "Aspect Ratio Denominator" 49.0 1.0 256. 1.0 -#pragma parameter border_zoom "Border Zoom" 8.0 0.5 16.0 0.5 #pragma parameter integer_scale "Force Integer Scaling" 1.0 0.0 1.0 1.0 #pragma parameter overscale "Integer Overscale" 0.0 0.0 1.0 1.0 +#pragma parameter border_zoom "Border Zoom" 8.0 0.5 16.0 0.5 #pragma parameter border_speed "Border Animation Speed" 0.5 0.5 10 0.5 -#pragma parameter scanline_toggle "Scanline Toggle" 0.0 0.0 1.0 1.0 #pragma parameter interp_toggle "Sharpen Linear Scaling" 0.0 0.0 1.0 1.0 +#pragma parameter scanline_toggle "Scanline Toggle" 0.0 0.0 1.0 1.0 #pragma parameter THICKNESS "Scanline Thickness" 2.0 1.0 12.0 1.0 #pragma parameter DARKNESS "Scanline Darkness" 0.35 0.0 1.0 0.05 -#pragma parameter OS_MASK_TOP "OS Mask Top" 0.0 0.0 1.0 0.005 -#pragma parameter OS_MASK_BOTTOM "OS Mask Bottom" 0.0 0.0 1.0 0.005 -#pragma parameter OS_MASK_LEFT "OS Mask Left" 0.0 0.0 1.0 0.005 -#pragma parameter OS_MASK_RIGHT "OS Mask Right" 0.0 0.0 1.0 0.005 +#pragma parameter OS_MASK_TOP "Overscan Mask Top" 0.0 0.0 1.0 0.005 +#pragma parameter OS_MASK_BOTTOM "Overscan Mask Bottom" 0.0 0.0 1.0 0.005 +#pragma parameter OS_MASK_LEFT "Overscan Mask Left" 0.0 0.0 1.0 0.005 +#pragma parameter OS_MASK_RIGHT "Overscan Mask Right" 0.0 0.0 1.0 0.005 #pragma stage vertex layout(location = 0) in vec4 Position; @@ -171,6 +178,12 @@ float hash1( float n ) return fract(sin(n)*43758.5453); } +vec2 hash2( vec2 p ) +{ + p = vec2( dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)) ); + return fract(sin(p)*43758.5453); +} + float noise( in vec3 x ) { vec3 p = floor(x); @@ -217,7 +230,7 @@ vec4 hexagons_bg(vec2 coord, vec2 output_size, float frame_count) return vec4(col, 1.0); } -vec4 voronoi( in vec2 x, float w, float frame_count ) +vec4 voronoi_1( in vec2 x, float w, float frame_count ) { vec2 n = floor( x ); vec2 f = fract( x ); @@ -246,13 +259,13 @@ vec4 voronoi( in vec2 x, float w, float frame_count ) return m; } -vec4 voronoi_bg(vec2 texture_size, float frame_count, vec2 uv) +vec4 voronoi_smooth(vec2 texture_size, float frame_count, vec2 uv) { vec2 p = uv * vec2(2.0,1.0); float k = 2.0 + 70.0 * pow( 0.5 + 0.5*sin(0.25*6.2831*0.03 * frame_count), 4.0 ); k = 0.5 - 0.5*cos(0.25*6.2831*0.01 * frame_count); - vec4 c = voronoi( 6.0*p, k, frame_count ); + vec4 c = voronoi_1( 6.0*p, k, frame_count ); vec3 col = c.yzw; @@ -265,6 +278,70 @@ vec4 voronoi_bg(vec2 texture_size, float frame_count, vec2 uv) return vec4( col, 1.0 ); } +vec4 voronoi_2( in vec2 x, float mode, float timer ) +{ + vec2 n = floor( x ); + vec2 f = fract( x ); + + vec3 m = vec3( 8.0 ); + float m2 = 8.0; + for( int j=-1; j<=2; j++ ) + for( int i=-1; i<=2; i++ ) + { + vec2 g = vec2( float(i),float(j) ); + vec2 o = hash2( n + g ); + + // animate + o = 0.5 + 0.5*sin( timer + 6.2831*o ); + + vec2 r = g - f + o; + + // euclidean + vec2 d0 = vec2( sqrt(dot(r,r)), 1.0 ); + // manhattam + vec2 d1 = vec2( 0.71*(abs(r.x) + abs(r.y)), 1.0 ); + // triangular + vec2 d2 = vec2( max(abs(r.x)*0.866025+r.y*0.5,-r.y), + step(0.0,0.5*abs(r.x)+0.866025*r.y)*(1.0+step(0.0,r.x)) ); + + vec2 d = d0; + if( mode<3.0 ) d=mix( d2, d0, fract(mode) ); + if( mode<2.0 ) d=mix( d1, d2, fract(mode) ); + if( mode<1.0 ) d=mix( d0, d1, fract(mode) ); + + if( d.x