Last active
November 12, 2019 16:28
-
-
Save Zeukkari/c08a235f038fea8e1aed05be87241736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float u_time; // time | |
uniform vec2 u_resolution; // resolution | |
uniform vec2 u_mouse; | |
void main(){ | |
vec3 destColor = vec3(abs(sin(u_time)), 0.2, 0.1); | |
vec2 p = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); | |
float a = atan(p.y / p.x) * sin(u_time) * 10.0; | |
float l = 0.05 / abs(length(p *abs(sin(u_time)) ) - 0.8 + sin(a + u_time * 3.5) * 0.004); | |
destColor *= 0.5 + sin(a + u_time * 00.03) * 0.03; | |
gl_FragColor = vec4(l*destColor, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float u_time; // u_time | |
uniform vec2 u_resolution; // u_resolution | |
#define PI 3.14159265 | |
#define TAU (2*PI) | |
#define PHI (sqrt(5)*0.5 + 0.5) | |
float pModPolar(inout vec2 p, float repetitions) { | |
float angle = 2.*PI/repetitions; | |
float a = atan(p.y, p.x) + angle/2.; | |
float r = length(p); | |
float c = floor(a/angle); | |
a = mod(a,angle) - angle/2.; | |
p = vec2(cos(a), sin(a))*r; | |
// For an odd number of repetitions, fix cell index of the cell in -x direction | |
// (cell index would be e.g. -5 and 5 in the two halves of the cell): | |
if (abs(c) >= (repetitions/2.)) c = abs(c); | |
return c; | |
} | |
void main(void){ | |
vec3 destColor = vec3(0.4, 0.2, 0.5); | |
vec2 p = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a = atan(p.y / p.x) * 32.0; | |
float l = 0.2/ abs(length(p) - 0.8 + sin(a + u_time * 3.5) * 0.004); | |
vec2 pp = p; | |
//pModPolar(pp,32.0); | |
float d = length(pp)*0.4; //+vec2(sin(u_time),cos(u_time))*0.5); | |
p.x = dot(p*1.6,p*0.2); | |
d=.14/(d*d); | |
p.y += sin(u_time*4.44+p.x*54.0)*0.15; | |
l*= (sin(u_time*3.6+p.y*15.2)+2.7)/abs(cos(u_time+p.x*3.2+p.y*d)); | |
destColor *= 0.5 + sin(a*0.25 + u_time * 1.3+p.x*p.x) * 0.2; | |
gl_FragColor = vec4(l*destColor, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float u_time; // u_time | |
uniform vec2 u_resolution; // u_resolution | |
#define PI 3.14159265 | |
#define TAU (2*PI) | |
#define PHI (sqrt(5)*0.5 + 0.5) | |
float pModPolar(inout vec2 p, float repetitions) { | |
float angle = 2.*PI/repetitions; | |
float a = atan(p.y, p.x) + angle/2.; | |
float r = length(p); | |
float c = floor(a/angle); | |
a = mod(a,angle) - angle/2.; | |
p = vec2(cos(a), sin(a))*r; | |
// For an odd number of repetitions, fix cell index of the cell in -x direction | |
// (cell index would be e.g. -5 and 5 in the two halves of the cell): | |
if (abs(c) >= (repetitions/2.)) c = abs(c); | |
return c; | |
} | |
void main(void){ | |
vec3 destColor = vec3(0.4, 0.2, 0.5); | |
vec2 p = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a = atan(p.y / p.x) * 32.0; | |
float l = 0.2/ abs(length(p) - 0.8 + sin(a + u_time * 3.5) * 0.004); | |
vec2 pp = p; | |
//pModPolar(pp,32.0); | |
float d = length(pp)*0.4; //+vec2(sin(u_time),cos(u_time))*0.5); | |
p.x = dot(p*1.6,p*0.2); | |
d=.14/(d*d); | |
p.y += sin(u_time*4.44+p.x*54.0)*0.15; | |
l*= (sin(u_time*3.6+p.y*15.2)+2.7)/abs(cos(u_time+p.x*3.2+p.y*d)); | |
destColor *= 0.5 + sin(a*0.25 + u_time * 1.3+p.x*p.x) * 0.2; | |
gl_FragColor = vec4(l*destColor, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float u_time; // u_time | |
uniform vec2 u_resolution; // u_resolution | |
#define PI 3.14159265 | |
#define TAU (2*PI) | |
#define PHI (sqrt(5)*0.5 + 0.5) | |
float pModPolar(inout vec2 p, float repetitions) { | |
float angle = 2.*PI/repetitions; | |
float a = atan(p.y, p.x) + angle/2.; | |
float r = length(p); | |
float c = floor(a/angle); | |
a = mod(a,angle) - angle/2.; | |
p = vec2(cos(a), sin(a))*r; | |
// For an odd number of repetitions, fix cell index of the cell in -x direction | |
// (cell index would be e.g. -5 and 5 in the two halves of the cell): | |
if (abs(c) >= (repetitions/2.)) c = abs(c); | |
return c; | |
} | |
void main(void){ | |
vec3 destColor = vec3(0.4, 0.2, 0.5); | |
vec2 p = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a = atan(p.y / p.x) * 32.0; | |
float l = 0.2/ abs(length(p) - 0.8 + sin(a + u_time * 3.5) * 0.004); | |
vec2 pp = p; | |
//pModPolar(pp,32.0); | |
float d = length(pp)*0.4; //+vec2(sin(u_time),cos(u_time))*0.5); | |
p.x = dot(p*1.6,p*0.2); | |
d=.14/(d*d); | |
p.y += sin(u_time*4.44+p.x*54.0)*0.15; | |
l*= (sin(u_time*3.6+p.y*15.2)+2.7)/abs(cos(u_time+p.x*3.2+p.y*d)); | |
destColor *= 0.5 + sin(a*0.25 + u_time * 1.3+p.x*p.x) * 0.2; | |
gl_FragColor = vec4(l*destColor, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author @patriciogv - 2015 | |
// http://patriciogonzalezvivo.com | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform vec2 u_mouse; | |
uniform float u_time; | |
// Based on https://www.shadertoy.com/view/4sSSzG | |
float triangleDF(vec2 st, | |
vec2 p0, vec2 p1, vec2 p2){ | |
vec3 e0, e1, e2; | |
e0.xy = normalize(p1 - p0).yx * vec2(+1.0, -1.0); | |
e1.xy = normalize(p2 - p1).yx * vec2(+1.0, -1.0); | |
e2.xy = normalize(p0 - p2).yx * vec2(+1.0, -1.0); | |
e0.z = dot(e0.xy, p0); | |
e1.z = dot(e1.xy, p1); | |
e2.z = dot(e2.xy, p2); | |
float a = max(0.0, dot(e0.xy, st) - e0.z); | |
float b = max(0.0, dot(e1.xy, st) - e1.z); | |
float c = max(0.0, dot(e2.xy, st) - e2.z); | |
return length(vec3(a, b, c)*2.0); | |
} | |
void main(){ | |
vec2 st = gl_FragCoord.xy/u_resolution.xy; | |
vec3 color = vec3(0.0); | |
// Distance Field in 3 channels | |
float df = triangleDF(st, | |
vec2(0.40,0.45), | |
vec2(0.60,0.45), | |
vec2(0.5,0.60)); | |
color = vec3(df); | |
// Make a shape of it | |
float size = fract(u_time*0.2); | |
float border = 0.025; | |
color.rb += smoothstep(size+border,size+1e-7,df)- | |
smoothstep(size+0.001,size+1e-7,df); | |
gl_FragColor = vec4(color,1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015 | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform float u_time; | |
uniform float u_mouse; | |
vec2 brickTile(vec2 _st, float _zoom){ | |
_st *= _zoom; | |
// Here is where the offset is happening | |
_st.x += step(1., mod(_st.y,2.0)) * 0.5; | |
return fract(_st); | |
} | |
float box(vec2 _st, vec2 _size){ | |
_size = vec2(0.5)-_size*0.5; | |
vec2 uv = smoothstep(_size,_size+vec2(1e-4),_st); | |
uv *= smoothstep(_size,_size+vec2(1e-4),vec2(1.0)-_st); | |
return uv.x*uv.y; | |
} | |
void main(void){ | |
vec2 st = gl_FragCoord.xy/u_resolution.xy; | |
st = sin(st*u_time)-tan(u_time*0.001); | |
vec3 color = vec3(1.0, 0.0, 0.0); | |
// Modern metric brick of 215mm x 102.5mm x 65mm | |
// http://www.jaharrison.me.uk/Brickwork/Sizes.html | |
// st /= vec2(2.15,0.65)/1.5; | |
// Apply the brick tiling | |
st = brickTile(st,5.0); | |
color = vec3(box(st,vec2(0.9))); | |
color = vec3(color.r,color.g,color.b); //u_mouse.x; | |
// Uncomment to see the space coordinates | |
// color = vec3(st,0.0); | |
gl_FragColor = vec4(color,1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author @patriciogv - 2015 | |
// Title: Ikeda Grid | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform float u_time; | |
float random(in float x){ return fract(sin(x)*43758.5453); } | |
float random(in vec2 st){ return fract(sin(dot(st.xy ,vec2(12.9898,78.233))) * 43758.5453); } | |
float grid(vec2 st, float res){ | |
vec2 grid = fract(st*res); | |
return 1.-(step(res,grid.x) * step(res,grid.y)); | |
} | |
float box(in vec2 st, in vec2 size){ | |
size = vec2(0.5) - size*0.5; | |
vec2 uv = smoothstep(size, | |
size+vec2(0.001), | |
st); | |
uv *= smoothstep(size, | |
size+vec2(0.001), | |
vec2(1.0)-st); | |
return uv.x*uv.y; | |
} | |
float cross(in vec2 st, vec2 size){ | |
return clamp(box(st, vec2(size.x*0.5,size.y*0.125)) + | |
box(st, vec2(size.y*0.125,size.x*0.5)),0.,1.); | |
} | |
void main(){ | |
vec2 st = gl_FragCoord.st/u_resolution.xy; | |
st.x *= u_resolution.x/u_resolution.y; | |
vec3 color = vec3(0.0); | |
// Grid | |
vec2 grid_st = st*300.; | |
color += vec3(0.5,0.,0.)*grid(grid_st,0.01); | |
color += vec3(0.2,0.,0.)*grid(grid_st,0.02); | |
color += vec3(0.2)*grid(grid_st,0.1); | |
// Crosses | |
vec2 crosses_st = st + .5; | |
crosses_st *= 3.; | |
vec2 crosses_st_f = fract(crosses_st); | |
color *= 1.-cross(crosses_st_f,vec2(.3,.3)); | |
color += vec3(.9)*cross(crosses_st_f,vec2(.2,.2)); | |
// Digits | |
vec2 blocks_st = floor(st*6.); | |
float t = u_time*.8+random(blocks_st); | |
float time_i = floor(t); | |
float time_f = fract(t); | |
color.rgb += step(0.9,random(blocks_st+time_i))*(1.0-time_f); | |
gl_FragColor = vec4( color , 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SixteenSegmentDisplay.glsl | |
// 16 Segment Display Example v3 | |
// rearranged source code by I.G.P. | |
// better comments added to source by Hekate | |
#ifdef GL_ES | |
precision highp float; | |
#endif | |
vec2 uv; | |
uniform float u_time; | |
uniform vec2 u_resolution; | |
const vec2 ch_size = vec2(1.0, 2.0); // character size (X,Y) | |
const vec2 ch_space = ch_size + vec2(1.0, 1.0); // character distance Vector(X,Y) | |
const vec2 ch_start = vec2 (ch_space.x * -6., 2.); // start position | |
vec2 ch_pos = vec2 (0.0, 0.0); // character position(X,Y) | |
vec3 ch_color = vec3 (0.0, 0.5, 2.5); // character color (R,G,B) | |
const vec3 bg_color = vec3 (0.0, 0.0, 0.0); // background color (R,G,B) | |
#define REPEAT_SIGN false // True/False; True=Multiple, False=Single | |
/* 16 segment display...Akin to LED Display. | |
Segment bit positions: | |
__2__ __1__ | |
|\ | /| | |
| \ | / | | |
3 11 10 9 0 | |
| \ | / | | |
| \|/ | | |
_12__ __8__ | |
| | | |
| /|\ | | |
4 / | \ 7 | |
| 13 14 15 | | |
| / | \ | | |
__5__|__6__ | |
15 12 11 8 7 4 3 0 | |
| | | | | | | | | |
0000 0000 0000 0000 | |
example: letter A | |
12 8 7 4 3210 | |
| | | | |||| | |
0001 0001 1001 1111 | |
binary to hex -> 0x119F | |
*/ | |
#define n0 ddigit(0x22FF); | |
#define n1 ddigit(0x0281); | |
#define n2 ddigit(0x1177); | |
#define n3 ddigit(0x11E7); | |
#define n4 ddigit(0x5508); | |
#define n5 ddigit(0x11EE); | |
#define n6 ddigit(0x11FE); | |
#define n7 ddigit(0x2206); | |
#define n8 ddigit(0x11FF); | |
#define n9 ddigit(0x11EF); | |
#define A ddigit(0x119F); | |
#define B ddigit(0x927E); | |
#define C ddigit(0x007E); | |
#define D ddigit(0x44E7); | |
#define E ddigit(0x107E); | |
#define F ddigit(0x101E); | |
#define G ddigit(0x807E); | |
#define H ddigit(0x1199); | |
#define I ddigit(0x4466); | |
#define J ddigit(0x4436); | |
#define K ddigit(0x9218); | |
#define L ddigit(0x0078); | |
#define M ddigit(0x0A99); | |
#define N ddigit(0x8899); | |
#define O ddigit(0x00FF); | |
#define P ddigit(0x111F); | |
#define Q ddigit(0x80FF); | |
#define R ddigit(0x911F); | |
#define S ddigit(0x8866); | |
#define T ddigit(0x4406); | |
#define U ddigit(0x00F9); | |
#define V ddigit(0x2218); | |
#define W ddigit(0xA099); | |
#define X ddigit(0xAA00); | |
#define Y ddigit(0x4A00); | |
#define Z ddigit(0x2266); | |
#define _ ch_pos.x += ch_space.x; | |
#define s_dot ddigit(0); | |
#define s_minus ddigit(0x1100); | |
#define s_plus ddigit(0x5500); | |
#define s_greater ddigit(0x2800); | |
#define s_less ddigit(0x8200); | |
#define s_sqrt ddigit(0x0C02); | |
#define nl1 ch_pos = ch_start; ch_pos.y -= 3.0; | |
#define nl2 ch_pos = ch_start; ch_pos.y -= 6.0; | |
#define nl3 ch_pos = ch_start; ch_pos.y -= 9.0; | |
float dseg(vec2 p0, vec2 p1) | |
{ | |
vec2 dir = normalize(p1 - p0); | |
vec2 cp = (uv - ch_pos - p0) * mat2(dir.x, dir.y,-dir.y, dir.x); | |
return distance(cp, clamp(cp, vec2(0), vec2(distance(p0, p1), 0))); | |
} | |
bool bit(int n, int b) | |
{ | |
return mod(floor(float(n) / exp2(floor(float(b)))), 2.0) != 0.0; | |
} | |
float d = 1e6; | |
void ddigit(int n) | |
{ | |
float v = 1e6; | |
vec2 cp = uv - ch_pos; | |
if (n == 0) v = min(v, dseg(vec2(-0.405, -1.000), vec2(-0.500, -1.000))); | |
if (bit(n, 0)) v = min(v, dseg(vec2( 0.500, 0.063), vec2( 0.500, 0.937))); | |
if (bit(n, 1)) v = min(v, dseg(vec2( 0.438, 1.000), vec2( 0.063, 1.000))); | |
if (bit(n, 2)) v = min(v, dseg(vec2(-0.063, 1.000), vec2(-0.438, 1.000))); | |
if (bit(n, 3)) v = min(v, dseg(vec2(-0.500, 0.937), vec2(-0.500, 0.062))); | |
if (bit(n, 4)) v = min(v, dseg(vec2(-0.500, -0.063), vec2(-0.500, -0.938))); | |
if (bit(n, 5)) v = min(v, dseg(vec2(-0.438, -1.000), vec2(-0.063, -1.000))); | |
if (bit(n, 6)) v = min(v, dseg(vec2( 0.063, -1.000), vec2( 0.438, -1.000))); | |
if (bit(n, 7)) v = min(v, dseg(vec2( 0.500, -0.938), vec2( 0.500, -0.063))); | |
if (bit(n, 8)) v = min(v, dseg(vec2( 0.063, 0.000), vec2( 0.438, -0.000))); | |
if (bit(n, 9)) v = min(v, dseg(vec2( 0.063, 0.063), vec2( 0.438, 0.938))); | |
if (bit(n, 10)) v = min(v, dseg(vec2( 0.000, 0.063), vec2( 0.000, 0.937))); | |
if (bit(n, 11)) v = min(v, dseg(vec2(-0.063, 0.063), vec2(-0.438, 0.938))); | |
if (bit(n, 12)) v = min(v, dseg(vec2(-0.438, 0.000), vec2(-0.063, -0.000))); | |
if (bit(n, 13)) v = min(v, dseg(vec2(-0.063, -0.063), vec2(-0.438, -0.938))); | |
if (bit(n, 14)) v = min(v, dseg(vec2( 0.000, -0.938), vec2( 0.000, -0.063))); | |
if (bit(n, 15)) v = min(v, dseg(vec2( 0.063, -0.063), vec2( 0.438, -0.938))); | |
ch_pos.x += ch_space.x; | |
d = min(d, v); | |
} | |
void main( void ) | |
{ | |
vec2 aspect = u_resolution.xy / u_resolution.y; | |
uv = ( gl_FragCoord.xy / u_resolution.y ) - aspect / 2.0; | |
uv *= 20.0 + sin(u_time); // set zoom size | |
if (REPEAT_SIGN) | |
uv = -14.0 + mod(1.8*(uv-1.0),ch_space*vec2(16.,6.5)); // set zoom size | |
ch_pos = ch_start + vec2(sin(u_time),0.0); // set start position | |
_ _ _ T H E Y nl1 | |
_ _ L I V E | |
vec3 color = mix(ch_color, bg_color, 1.0- (0.08 / d)); // shading | |
gl_FragColor = vec4(color, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform float u_time; | |
uniform vec2 u_resolution; | |
uniform vec2 u_mouse; | |
void main() | |
{ | |
vec2 uv = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x+u_mouse.x, u_resolution.y+u_mouse.y); | |
vec2 f = vec2(0.0); | |
vec3 c = vec3(0.5); | |
float light = 0.0; | |
for (float x = 0.1; x < 6.0; x += 1.0) | |
{ | |
f = vec2(sin(sin(u_time + uv.x * x) - uv.y * dot(vec2(x + uv.y), vec2(sin(x), cos(x))))); | |
light += (0.04 / distance(uv, f)) - (0.01 * distance(vec2((sin(u_time + uv.y+u_mouse.x))), vec2(uv))); | |
c.y = sin(u_time + x) * 0.2 + 0.6; | |
} | |
c *= light; | |
gl_FragColor = vec4(c, 0.6); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float u_time; // u_time | |
uniform vec2 u_resolution; // u_resolution | |
void main(void){ | |
vec3 destColor = vec3(0.9, 0.2, 0.1); | |
vec2 p = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a = atan(p.y / p.x) * 20.0; | |
float l = 0.05 / abs(length(p) - 0.8 + sin(a + u_time * 3.5) * 0.1); | |
destColor *= 0.5 + sin(a + u_time * 00.03) * 0.03; | |
vec3 destColor2 = vec3(0.5, 0.2, 0.9); | |
vec2 p2 = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a2 = atan(p.y / p.x) * 10.0; | |
float l2 = 0.05 / abs(length(p) - 0.9 + sin(a + u_time * 13.5) * (0.1 * l)); | |
destColor2 *= 0.5 + sin(a + u_time * 00.03) * 0.03; | |
vec3 destColor3 = vec3(0.2, 0.9, 0.5); | |
vec2 p3 = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a3 = atan(p.y / p.x) * 10.0; | |
float l3 = 0.05 / abs(length(p) - 0.9 + sin(a + u_time * 23.5) * (0.1 * l2)); | |
destColor3 *= 0.5 + sin(a + u_time * 00.03) * 0.03; | |
gl_FragColor = vec4(l*destColor + l2*destColor2 + l3*destColor3, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float u_time; // u_time | |
uniform vec2 u_resolution; // u_resolution | |
#define PI 3.14159265 | |
#define TAU (2*PI) | |
#define PHI (sqrt(5)*0.5 + 0.5) | |
float pModPolar(inout vec2 p, float repetitions) { | |
float angle = 2.*PI/repetitions; | |
float a = atan(p.y, p.x) + angle/2.; | |
float r = length(p); | |
float c = floor(a/angle); | |
a = mod(a,angle) - angle/2.; | |
p = vec2(cos(a), sin(a))*r; | |
// For an odd number of repetitions, fix cell index of the cell in -x direction | |
// (cell index would be e.g. -5 and 5 in the two halves of the cell): | |
if (abs(c) >= (repetitions/2.)) c = abs(c); | |
return c; | |
} | |
void main(void){ | |
vec3 destColor = vec3(0.4, 0.2, 0.5); | |
vec2 p = (gl_FragCoord.xy * 2.0 - u_resolution) / min(u_resolution.x, u_resolution.y); // 正規化 | |
float a = atan(p.y / p.x) * 32.0; | |
float l = 0.2/ abs(length(p) - 0.8 + sin(a + u_time * 3.5) * 0.004); | |
vec2 pp = p; | |
//pModPolar(pp,32.0); | |
float d = length(pp)*0.4; //+vec2(sin(u_time),cos(u_time))*0.5); | |
p.x = dot(p*1.6,p*0.2); | |
d=.14/(d*d); | |
p.y += sin(u_time*4.44+p.x*54.0)*0.15; | |
l*= (sin(u_time*3.6+p.y*15.2)+2.7)/abs(cos(u_time+p.x*3.2+p.y*d)); | |
destColor *= 0.5 + sin(a*0.25 + u_time * 1.3+p.x*p.x) * 0.2; | |
gl_FragColor = vec4(l*destColor, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author @patriciogv - 2015 | |
// Title: Ikeda Grid | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform float u_time; | |
float random(in float x){ return fract(sin(x)*43758.5453); } | |
float random(in vec2 st){ return fract(sin(dot(st.xy ,vec2(12.9898,78.233))) * 43758.5453); } | |
float grid(vec2 st, float res){ | |
vec2 grid = fract(st*res); | |
return 1.-(step(res,grid.x) * step(res,grid.y)); | |
} | |
float box(in vec2 st, in vec2 size){ | |
size = vec2(0.5) - size*0.5; | |
vec2 uv = smoothstep(size, | |
size+vec2(0.001), | |
st); | |
uv *= smoothstep(size, | |
size+vec2(0.001), | |
vec2(1.0)-st); | |
return uv.x*uv.y; | |
} | |
float cross(in vec2 st, vec2 size){ | |
return clamp(box(st, vec2(size.x*0.5,size.y*0.125)) + | |
box(st, vec2(size.y*0.125,size.x*0.5)),0.,1.); | |
} | |
void main(){ | |
vec2 st = gl_FragCoord.st/u_resolution.xy; | |
st.x *= u_resolution.x/u_resolution.y; | |
vec3 color = vec3(0.0); | |
// Grid | |
vec2 grid_st = st*300.0; | |
color += vec3(0.5,abs(sin(-u_time)),0.)*grid(grid_st,0.01); | |
color += vec3(0.2,0.,0.)*grid(grid_st,0.02); | |
color += vec3(abs(sin(u_time*0.1)))*grid(grid_st,0.1); | |
// Crosses | |
vec2 crosses_st = st + .5; | |
crosses_st *= 3.; | |
vec2 crosses_st_f = fract(crosses_st); | |
color *= 1.-cross(crosses_st_f,vec2(.3,.3)); | |
color += vec3(.9)*cross(crosses_st_f,vec2(.2,.2)); | |
// Digits | |
vec2 blocks_st = floor(st*6.); | |
float t = u_time*.8+random(blocks_st); | |
float time_i = floor(t); | |
float time_f = fract(t); | |
color.rgb += step(0.9,random(blocks_st+time_i))*(1.0-time_f); | |
gl_FragColor = vec4( color , 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment