tidying up some shader stuff (nameing etc)

This commit is contained in:
langolierz
2018-10-16 20:54:48 +00:00
parent f1ee096cb3
commit fc14b5023c
23 changed files with 69 additions and 416 deletions

View File

@@ -1,32 +0,0 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main() {
vec3 color = vec3(0.0,0.0,0.0);
vec2 pos = gl_FragCoord.xy;
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
vec2 s1 = vec2(u_resolution.x*(0.5 + 0.25*cos(u_time)), u_resolution*(0.5 + 0.25*sin(u_time)));
vec2 s2 = vec2(u_resolution.x*(0.5 + 0.25*sin(u_time)), u_resolution*(0.5 + 0.25*cos(u_time)));
vec2 s3 = vec2(u_resolution.x*0.5, u_resolution*0.5);
float r1 = pow(pow(pos.x-s1.x,2.0) + pow(pos.y-s1.y,2.0), 0.5);
float r2 = pow(pow(pos.x-s2.x,2.0) + pow(pos.y-s2.y,2.0), 0.5);
float r3 = pow(pow(pos.x-s3.x,2.0) + pow(pos.y-s3.y,2.0), 0.5);
color += vec3(0.5 + 0.5*sign(sin((0.1 + 0.05*sin(u_time+2.0))*r1 - 1.0*u_time)), 0.0, 0.0);
color += vec3(0.0, 0.0, 0.5 + 0.5*sign(sin((0.1 + 0.05*sin(u_time))*r2 - 1.2*u_time)));
color += vec3(0.0, 0.5 + 0.5*sign(sin((0.1 + 0.05*sin(u_time+0.5))*r3 - 1.1*u_time)), 0.0);
gl_FragColor = vec4(color,1.);
}

View File

@@ -1,3 +1,6 @@
//gen-shader
//written by Tim Caldwell
// a simple example of how to use continuous parameters to perform switching functions
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,10 +0,0 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform float u_time;
uniform float u_x0;
void main() {
gl_FragColor = vec4(sin(1000.0*u_x0*u_time),0.0,0.0,1.0);
}

View File

@@ -9,17 +9,19 @@ precision mediump float;
uniform float u_time;
uniform float u_x0;
uniform float u_x1;
uniform float u_x2;
uniform float u_x3;
uniform vec2 u_resolution;
void main( void ) {
vec2 position = ( gl_FragCoord.xy / u_resolution.xy ) + (u_resolution.x * u_x0, u_resolution.y * u_x1) / 4.0;
vec2 position = ( gl_FragCoord.xy / u_resolution.xy ) + (u_resolution.x, u_resolution.y * (u_x0*0.01)) / 4.0;
float color = 0.0;
color += sin( position.x * cos( u_time / 15.0 ) * 80.0 ) + cos( position.y * cos( u_time / 15.0 ) * 10.0 );
color += sin( position.y * sin( u_time / 10.0 ) * 40.0 ) + cos( position.x * sin( u_time / 25.0 ) * 40.0 );
color += sin( position.x * sin( u_time / 5.0 ) * 10.0 ) + sin( position.y * sin( u_time / 35.0 ) * 80.0 );
color += sin( position.x * cos( u_time / 15.0 ) * 80.0 ) + cos( position.y * cos( u_time / 15.0 ) * 10.0 ) * u_x1;
color += sin( position.y * sin( u_time / 10.0 ) * 40.0 ) + cos( position.x * sin( u_time / 25.0 ) * 40.0 ) * u_x2;
color += sin( position.x * sin( u_time / 5.0 ) * 10.0 ) + sin( position.y * sin( u_time / 35.0 ) * 80.0 ) * u_x3;
color *= sin( u_time / 10.0 ) * 0.8;
gl_FragColor = vec4( vec3( color, color * 0.5, sin( color + u_time / 3.0 ) * 0.75 ), 1.0 );
gl_FragColor = vec4( vec3( color, color * 0.5 * sin(0.02*u_time) , sin( color + u_time / 3.0 ) * 0.75 ), 1.0 );
}

View File

@@ -0,0 +1,37 @@
//gen-shader
//written by Ben Caldwell
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
uniform float u_x0;
uniform float u_x1;
uniform float u_x2;
uniform float u_x3;
void main() {
vec3 color = vec3(0.0,0.0,0.0);
float mod_time = u_x0 * u_time;
vec2 pos = gl_FragCoord.xy;
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
vec2 s1 = vec2(u_resolution.x*(0.5 + 0.25*cos(mod_time)), u_resolution*(0.5 + 0.25*sin(mod_time)));
vec2 s2 = vec2(u_resolution.x*(0.5 + 0.25*sin(mod_time)), u_resolution*(0.5 + 0.25*cos(mod_time)));
vec2 s3 = vec2(u_resolution.x*0.5, u_resolution*0.5);
float r1 = (pow(pow(pos.x-s1.x,2.0) + pow(pos.y-s1.y,2.0), 0.5))*u_x1;
float r2 = (pow(pow(pos.x-s2.x,2.0) + pow(pos.y-s2.y,2.0), 0.5))*u_x2;
float r3 = (pow(pow(pos.x-s3.x,2.0) + pow(pos.y-s3.y,2.0), 0.5))*u_x3;
color += vec3(0.5 + 0.5*sign(sin((0.1 + 0.05*sin(mod_time+2.0))*r1 - 1.0*mod_time)), 0.0, 0.0);
color += vec3(0.0, 0.0, 0.5 + 0.5*sign(sin((0.1 + 0.05*sin(mod_time))*r2 - 1.2*mod_time)));
color += vec3(0.0, 0.5 + 0.5*sign(sin((0.1 + 0.05*sin(mod_time+0.5))*r3 - 1.1*mod_time)), 0.0);
gl_FragColor = vec4(color,1.);
}

View File

@@ -1,10 +0,0 @@
precision mediump float;
uniform float u_time;
uniform vec2 u_resolution;
float sin1(float t) { return (sin(t) * 0.5 + 0.5); }
void main(void) {
vec2 p = ( gl_FragCoord.xy / min(u_resolution.x, u_resolution.y));
gl_FragColor = vec4(vec3(sin1(p.x * 10.0 + sin1(p.y * 10.0 + u_time)) * sin1(p.y * 10.0 + sin1(p.x * 10.0 + u_time))), 1.0);
}

View File

@@ -1,40 +0,0 @@
// Tenjix
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.1415926535897932384626433832795
uniform float u_time;
uniform vec2 u_resolution;
const float position = 0.0;
const float scale = 8.0;
const float intensity = 1.0;
float band(vec2 pos, float amplitude, float frequency) {
float wave = scale * amplitude * sin(2.0 * PI * frequency * pos.x + u_time) / 6.05;
float light = clamp(amplitude * frequency * 0.002, 0.001 + 0.001 / scale, 5.0) * scale / abs(wave - pos.y);
return light;
}
void main( void ) {
vec3 color = vec3(0., 0.5, 1.0);
color = color == vec3(0.0)? vec3(0.10, 0.5, 10.0) : color;
vec2 pos = (gl_FragCoord.xy / u_resolution.xy);
pos.y += - 0.5 - position;
float spectrum = 0.0;
spectrum += band(pos, 0.1, 10.0);
spectrum += band(pos, 0.2, 8.0);
spectrum += band(pos, 0.10, 5.0);
spectrum += band(pos, 0.09, 3.0);
spectrum += band(pos, 0.8, 2.0);
spectrum += band(pos, 1.0, 1.0);
gl_FragColor = vec4(color * spectrum, spectrum);
}

View File

@@ -1,4 +1,5 @@
//gen-shader
//written by Ben Caldwell
#ifdef GL_ES
precision mediump float;
#endif
@@ -8,6 +9,7 @@ uniform float u_time;
uniform float u_x0;
uniform float u_x1;
uniform float u_x2;
uniform float u_x3;
void main() {
@@ -16,8 +18,8 @@ void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
color += vec3(u_x0*sign(sin(0.05*pos.x - u_time + sin(0.05*pow(pos.y,1.5) - u_time))),0.,0.);
color += vec3(0., 0., sign(cos(0.03*pos.x - 2.0*u_x1*u_time + 0.5*sin(0.05*pos.y - 2.0*u_x2*u_time))));
color += vec3(u_x0*sign(sin(0.05*pos.x - u_time + sin(0.05*pow(pos.y,(0.7 + u_x1)) - u_time))),0.,0.);
color += vec3(0., 0., sign(cos(0.05*pos.x*u_x2 - 2.0*u_time + 5.0*u_x3*sin(0.05*pos.y - 2.0*u_time))));
gl_FragColor = vec4(color,1.);

View File

@@ -1,4 +1,5 @@
//gen-shader
//written by Ben Caldwell
#ifdef GL_ES
precision mediump float;
#endif
@@ -6,17 +7,19 @@ precision mediump float;
uniform vec2 u_resolution;
uniform float u_time;
uniform float u_x0;
uniform float u_x1;
void main() {
float mod_time = u_time*u_x0;
vec2 pos = gl_FragCoord.xy;
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
vec3 color = vec3(0.0,0.0,0.0);
color += vec3(sin(0.05*pos.x - cos(u_x0*u_time)) + cos(0.05*pos.x/(0.1 + abs(cos(u_time/5.0)))),0.0,0.0);
color += vec3(sin(0.05*pos.y - cos(u_time/5.0)) + cos(0.05*pos.y/(0.1 + abs(cos(u_time/5.0)))),0.0,0.0);
color += vec3(0.0, 0.0, sin(u_time));
color += vec3(sin(0.7*u_x1*pos.x - cos(u_x0*mod_time)) + cos(0.05*pos.x/(0.1 + abs(cos(mod_time/5.0)))),0.0,0.0);
color += vec3(sin(0.05*pos.y - cos(mod_time/5.0)) + cos(0.5*pos.y/(0.1 + abs(cos(mod_time/5.0)))),0.0,0.0);
color += vec3(0.0, 0.0, sin(mod_time));
gl_FragColor = vec4(color,1.);