You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.7 KiB
GLSL
59 lines
1.7 KiB
GLSL
// Author @patriciogv - 2015
|
|
// Title: Ikeda Test patterns
|
|
|
|
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
// Copyright (c) Patricio Gonzalez Vivo, 2015 - http://patriciogonzalezvivo.com/
|
|
// I am the sole copyright owner of this Work.
|
|
//
|
|
// You cannot host, display, distribute or share this Work in any form,
|
|
// including physical and digital. You cannot use this Work in any
|
|
// commercial or non-commercial product, website or project. You cannot
|
|
// sell this Work and you cannot mint an NFTs of it.
|
|
// I share this Work for educational purposes, and you can link to it,
|
|
// through an URL, proper attribution and unmodified screenshot, as part
|
|
// of your educational material. If these conditions are too restrictive
|
|
// please contact me and we'll definitely work it out.
|
|
|
|
uniform vec2 u_resolution;
|
|
uniform vec2 u_mouse;
|
|
uniform float u_time;
|
|
|
|
float random (in float x) {
|
|
return fract(sin(x)*1e4);
|
|
}
|
|
|
|
float random (in vec2 st) {
|
|
return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);
|
|
}
|
|
|
|
float randomSerie(float x, float freq, float t) {
|
|
return step(.8,random( floor(x*freq)-floor(t) ));
|
|
}
|
|
|
|
void main() {
|
|
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
|
st.x *= u_resolution.x/u_resolution.y;
|
|
|
|
vec3 color = vec3(0.0);
|
|
|
|
float cols = 2.;
|
|
float freq = random(floor(u_time))+abs(atan(u_time)*0.1);
|
|
float t = 60.+u_time*(1.0-freq)*30.;
|
|
|
|
if (fract(st.y*cols* 0.5) < 0.5){
|
|
t *= -1.0;
|
|
}
|
|
|
|
freq += random(floor(st.y));
|
|
|
|
float offset = 0.025;
|
|
color = vec3(randomSerie(st.x, freq*100., t+offset),
|
|
randomSerie(st.x, freq*100., t),
|
|
randomSerie(st.x, freq*100., t-offset));
|
|
|
|
gl_FragColor = vec4(1.0-color,1.0);
|
|
}
|