adding students work

pull/19/head
Patricio Gonzalez Vivo 9 years ago
parent 73482a9d5e
commit 7c156e0de3

@ -0,0 +1,39 @@
// By Jaskirat Randhawa ( http://jaskirat.me/ )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.14159265359
uniform vec2 u_resolution;
uniform float u_time;
void main (void)
{
// float fade_out = 1.-abs(sin(u_time)-cos(u_time));
float fade_out = 1.-mod(u_time, 2.); // SAW TOOTH FUNCTION
float border = abs(sin(fade_out/3.)); // 0.01
float circle_radius= 1.-(fade_out); // 0.5
vec4 circle_color= vec4(1.0, 1.0, 1.0, fade_out);
vec2 circle_center= vec2(0.5, 0.5);
vec2 st = gl_FragCoord.xy/u_resolution.xy;
vec4 bkg_color = vec4(0.);
// Offset st with the center of the circle.
st = st - circle_center;
// float dist = sqrt(dot(st/.2, circle_center*2.)); //????
// float dist = sqrt(st.x*st.x+st.y*st.y); //r^2 = x^2 + y^2 // Equation of circle
float dist = sqrt(dot(st/.2, st/.2)); //Equation of circle using dot product
float t = 1.0 + smoothstep(circle_radius, circle_radius+border, dist)
- smoothstep(circle_radius-border, circle_radius, dist);
gl_FragColor = mix(circle_color, bkg_color,t);
}

@ -0,0 +1,32 @@
// By Nima Behravan ( nimabeh.wordpress.com )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspired by http://glslsandbox.com/e#27880.0
#ifdef GL_ES
precision mediump float;
#endif
uniform float u_time;
uniform vec2 mouse;
uniform vec2 u_resolution;
float w = u_resolution.x;
float h = u_resolution.y;
void main( void )
{
float move = (w / 10.0) * (cos(u_time));
vec2 pos = vec2(w * 0.5, h * 0.5);
float dist = length(gl_FragCoord.xy - pos) + 60.0*cos(u_time);
float size = 300.0;
float color = 0.0;
color += pow(size / dist, 2.0);
float color3 = mix(color, color+0.5, 0.5);
gl_FragColor = vec4(vec3(color3 / 2.0+cos(u_time), color3 / 4.0+cos(u_time), color3 / 1.5+cos(u_time)), 1.0);
}

@ -0,0 +1,46 @@
// By Hang Do Thi Duc ( http://22-8miles.com)
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspired on this picture http://www.tate.org.uk/art/artworks/turner-red-sunset-on-lake-d36200
// by William Turner Sunset
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.14159265359
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
float plot (vec2 st, float pct){
return smoothstep( pct-0.01, pct, st.y) -
smoothstep( pct, pct+0.01, st.y);
}
//Inigo Quiles
float cubicPulse( float highPos, float width, float x ){
// e.g. 0.4__0.2__0.0__0.2__0.4
x = abs(x - highPos);
// make flat before and after highPos value
if( x>width ) return 0.0;
x /= width;
// reverse Quadratfunction * smooth edges
return 1.0 - pow(x, 2.) * (3.0 - 2.0*x);
}
void main() {
vec3 colorA = vec3(0.909,0.961,0.982);
vec3 colorB = vec3(0.760,0.533,0.404);
vec2 st = gl_FragCoord.xy/u_resolution.xy;
vec3 color = vec3(1.0);
vec3 pct = vec3(st.y);
pct.r = 1.2 * cubicPulse(0.44, 0.09, st.y) - .2;
pct.g = 1.2 * (smoothstep(.28,.5, st.y) - smoothstep(.5,.8, st.y));
pct.b = 1.1 * (smoothstep(.2,.6, st.y) - smoothstep(.6,.9, st.y));
color = mix(colorA, colorB, pct);
gl_FragColor = vec4(color,1.0);
}

@ -0,0 +1,46 @@
// By Hang Do Thi Duc ( http://22-8miles.com)
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspired on this work https://vimeo.com/119302847 by Leo Villareal
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.14159265359
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main() {
vec3 magenta = vec3(0.909, 0.061, 0.982);
vec3 blue = vec3(0.050, 0.000, 0.600);
vec3 white = vec3(1.0);
vec3 interference = vec3(1.0);
vec2 st = gl_FragCoord.xy/u_resolution.xy;
vec3 color = magenta;
vec3 pct = vec3(st.y);
float sinU = abs(sin(u_time * 0.3));
float cosU = abs(cos(u_time * 0.1));
float fff = pow(sin(st.y * 9. * smoothstep(0.8, 0.4, st.y) + sinU + cosU), 5.);
// added 1. for no black
interference = vec3(fff, fff, 1.);
color = mix(interference, blue, sinU);
color = mix(color, magenta, pow(sin(st.y), 5.) + 0.5);
// add more blue
color = mix(color, blue, clamp(sinU + .2, .5, 1.));
float vert = pow(sin(st.x * PI - PI * 0.53), 10.);
float hor = pow(sin(st.y * PI - PI * 0.5), 30.);
color = mix(color, white, vert);
color = mix(color, white, hor);
gl_FragColor = vec4(color,1.0);
}

@ -0,0 +1,51 @@
// By Tyler Henry ( http://tylerhenry.com )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// William Turner sunset color spectrum
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.14159265359
uniform vec2 u_resolution;
uniform float u_time;
vec3 color0 = vec3(0.980,0.820,0.373);
vec3 color1 = vec3(0.941,0.584,0.243);
vec3 color2 = vec3(0.800,0.345,0.122);
vec3 color3 = vec3(0.620,0.255,0.102);
vec3 color4 = vec3(0.345,0.345,0.478);
float trans(float x, float p, float w){
//x = input, p = peak in x, w = width
return (smoothstep(p-(w*0.5),p,x)+smoothstep(p+(0.5*w),p,x))-1.0;
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.y = 1.0 - st.y; //invert y
vec3 color = vec3(0.0);
float pct0 = trans(st.y, 0.0, 1.5); //input x, peak, width
float pct1 = trans(st.y, 0.5, 1.);
float pct2 = trans(st.y, 0.6, 0.8);
float pct3 = trans(st.y, 0.7, 1.);
float pct4 = trans(st.y, 1.0, 1.);
// Mix uses pct (a value from 0-1) to
// mix the two colors
color = mix(vec3(0.0), color0, pct0);
color = mix(color, color1, pct1);
color = mix(color, color2, pct2);
color = mix(color, color3, pct3);
color = mix(color, color4, pct4);
gl_FragColor = vec4(color, 1.0);
}

@ -0,0 +1,55 @@
// By Udit Mahajan ( uditmahajan.com / @mahajan_udit )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspired on Leo Villareal work
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
vec3 colorYellow = vec3(.98,0.87,0.30); // 98% 87% 30%
vec3 colorPink = vec3(0.95, .41, .87);// 95% 41% 87%
vec3 colorTopBot = vec3(0.91,0.05,0.24); //91% 5% 24%
vec3 colorWhite = vec3(1., .94, 1.);//100% 94% 100%
// Function from Iñigo Quiles
// www.iquilezles.org/www/articles/functions/functions.htm
float pcurve( float x, float a, float b ){
float k = pow(a+b,a+b) / (pow(a,a)*pow(b,b));
return k * pow( x, a ) * pow( 1.0-x, b );
}
float plot(vec2 st, float pct){
return smoothstep( pct-0.02, pct, st.y) -
smoothstep( pct, pct+0.02, st.y);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
float x = pcurve(st.x-0.5,5.,1.0);
float x2 = pcurve(.5-st.x,5.,1.0);
float y = pcurve(st.y,1.,1.0);
float y2 = pcurve(.4-st.y,0.2+abs(sin(u_time/20.))*5.,1.0);
float y3 = pcurve(.4-st.y,0.7+abs(sin(u_time/10.))*4.,1.0);
vec3 color = vec3(y);
float pct = plot(st,y);
color = mix(colorTopBot, colorYellow, y);
color = mix(color, colorPink, y2);
color = mix(color, colorWhite, y3);
color = mix(color, colorTopBot, x);
color = mix(color, colorTopBot, x2);
// color = (1.-pct)*color;
gl_FragColor = vec4(color,1.0);
}

@ -0,0 +1,61 @@
// By Udit Mahajan ( uditmahajan.com / @mahajan_udit )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspired on Leo Villareal work
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
vec3 colorTopBot = vec3(0.91,0.5,0.24); //91% 5% 24%
vec3 colorOne = vec3(1.);//44% 41% 99%
vec3 colorTwo = vec3(.55, .18, .36);//55% 18% 26%
vec3 colorThree = vec3(.06, .15, .55); //46% 15% 15%
vec3 colorFour = vec3(.03, .2, .59);// 39% 20% 19%
// Function from Iñigo Quiles
// www.iquilezles.org/www/articles/functions/functions.htm
float pcurve( float x, float a, float b ){
float k = pow(a+b,a) / (pow(a,a)*pow(b,b));
return k * pow( x, a ) * pow( 1.0-x, b );
}
float plot(vec2 st, float pct){
return smoothstep( pct-0.02, pct, st.y) -
smoothstep( pct, pct+0.02, st.y);
}
float plot1(vec2 st, float pct){
return step( pct-0.02, st.x) -
step( pct+0.02, st.x);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
float y = pcurve(st.x, 1., 1.);
float lines = step(0.25,sin(st.x*(3.14)*23.0));
float y1 = pcurve(st.x, abs(sin(u_time/2.)), 1.);
float y2 = pcurve(st.x, abs(cos(u_time/5.))*10., 1.);
float y3= pcurve(st.x, abs(sin(u_time/7.))*5., 1.);
float y4= pcurve(st.x, abs(mod(u_time/17., 10.))*5., 1.);
vec3 color = vec3(1.);
float pct = plot1(st,y);
color = mix(color, colorTopBot, y);
color = mix(color, colorTwo, y1);
color = mix(color, colorThree, y2);
color = mix(color, colorFour, y3);
color = mix(color, colorOne, lines);
gl_FragColor = vec4(color,1.0);
}

@ -0,0 +1,51 @@
// By Jaskirat Randhawa ( http://jaskirat.me/ )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspiration https://www.shadertoy.com/view/Xtj3DD
#ifdef GL_ES
precision mediump float;
#endif
uniform float u_time;
uniform vec2 u_resolution;
uniform vec2 u_mouse;
float F(float x, float peak, float width){
float y = 0.0;
width=width * 0.5;
y = smoothstep(peak-width,peak,x) - smoothstep(peak,peak+width,x);
return y;
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
float timeA = (sin(u_time/5.));
float x1 = sin(timeA)/2.+.5;
float y1 = cos(timeA);
// x1 = u_mouse.x/u_resolution.x;
// y1 = u_mouse.y/u_resolution.y;
vec2 center_sun = vec2(0.5);
center_sun = vec2 (x1,y1-(.2));
vec3 sun = vec3(1.0,1.0,1.0) *(length(gl_FragCoord.xy - (center_sun * u_resolution.xy)) < (u_resolution.x/20.0) ? 1.0 : 0.0);
float halo = (length(gl_FragCoord.xy - center_sun * u_resolution.xy)-(u_resolution.x/40.0))/length(u_resolution.xy);
float sunHaloExp = 2.*exp(-pow(halo,2.0)/(pow(1.25-y1,15.2)));
sunHaloExp += 2.*exp(-pow(halo,2.0)/(pow(0.004,1.2)));
vec3 haloRed = vec3 (.4,0.2,0.1) * sunHaloExp*3.*(2.-y1);
vec3 horizon_blue = pow((st.y-1.5),15.)*vec3(0.2,0.5,1.0);
vec3 horizon_orange = pow((st.y-1.5),35.)*vec3(1.,0.4,0.1);
vec3 horizon = mix(horizon_blue,horizon_orange,pow(1.5-y1,3.));
// horizon = pow(abs(st.y*cos(u_time)/2.-1.),20.)*vec3(0.5,0.7,1.0);
vec3 color = vec3(0.);
float pct = F(st.y,y1-.20,0.1); // Lens Flare
color = vec3(step(.1,sun)+sun);
gl_FragColor = vec4(horizon*pct+horizon+sun/3.+haloRed,1.0);
}

@ -0,0 +1,36 @@
// By Nitcha Tothong ( nitchafa.me )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
vec3 colorA = vec3(0.5,0.5,0.5);
vec3 colorB = vec3(1.0,0.7,0.4);
vec3 colorC = vec3(0.0,0.15,0.2);
float plot (vec2 st, float pct){
return smoothstep( pct-0.01, pct, st.y) -
smoothstep( pct, pct+0.01, st.y);
}
// cosine based palette, 4 vec3 params by Iñigo Quílez
// http://www.iquilezles.org/www/articles/palettes/palettes.html
vec3 palette( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d )
{
return a + b*cos( 6.28318*(c*t+d) );
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
// Move to +
st.x -= 0.40*u_time*0.6;
vec3 color = palette(st.x,colorA, colorC, colorB, colorC)* 1.5;
float f = fract(st.x*7.0);
gl_FragColor = vec4(color,1.0);
}

@ -0,0 +1,70 @@
// By Luobin Wang ( @peterobbin )
// For Shader Studio Course https://github.com/patriciogonzalezvivo/ss2015
// Inspired on Leo Villareal work
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
#define PI 3.14159265359
float easeInOutQuint(float t, float b, float c, float d) {
t /= d/2.0;
if (t < 1.0) return c/2.0*t*t*t*t*t + b;
t -= 2.0;
return c/2.0*(t*t*t*t*t + 2.0) + b;
}
float plot (vec2 st, float pct){
return smoothstep( pct-0.01, pct, st.y) -
smoothstep( pct, pct+0.01, st.y);
}
vec3 rgbNormalizer(vec3 color){
float r = color.r;
float g = color.g;
float b = color.b;
return vec3((r + 1.0)/256.0 , (g + 1.0)/256.0 , (b + 1.0)/256.0 );
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0);
vec3 pct = vec3(st.y);
vec3 colorWhite = rgbNormalizer(vec3(141.0, 122.0, 79.0));
vec3 colorBlue = rgbNormalizer(vec3(200.0, 100.0, 100.0));
float cosT = cos(u_time * 0.05 ) * 2.0 ;
float sinT = sin(u_time * 0.05 ) * 2.0 ;
vec2 toCenter = vec2(0.5) - st;
float angle = atan(toCenter.y, toCenter.x);
float radius = length(toCenter) * 2.0;
color = mix(color,rgbNormalizer(vec3(2.0,6.0,89.0)), 1.0);
float frameBlack = sin(radius*PI*9.0)* 0.2 + 0.8;
color = mix(color,rgbNormalizer(vec3(4.0,13.0,191.0)), frameBlack);
float frameV = smoothstep(0.6, 0.0, abs(sin(radius*PI* 0.2 - sinT * 2.0)));
vec3 colorV = mix(color,rgbNormalizer(vec3(108.0,41.0,41.0)), frameV);
color += colorV;
float frameV2 = smoothstep(0.6, 0.0, abs(sin(radius*PI* 0.1 - 2.0 - sinT * 2.0))) ;
vec3 colorV2 = mix(color,rgbNormalizer(vec3(178.0,156.0,233.0)), frameV2);
color += colorV2;
gl_FragColor = vec4(color,1.0);
}

@ -93,3 +93,19 @@ The following is a list of examples present in this book.
* [Matrix](../edit.html#08/matrix.frag)
* I Ching series: [pattern](../edit.html#09/iching-01.frag), [random](../edit.html#10/iching-02.frag), [with noise](../edit.html#11/iching-03.frag)
* Ikeda's series: [test pattern](../edit.html#10/ikeda-00.frag), [data path](../edit.html#10/ikeda-03.frag), [data defrag](../edit.html#10/ikeda-04.frag), [digits](../edit.html#10/ikeda-digits.frag), [radar](../edit.html#10/ikeda-simple-grid.frag) and [numered grid](../edit.html#10/ikeda-numered-grid.frag)
### Students Work
* [Shaping functions](../05/)
* [Color](../06/)
- [Light](../edit.html#examples/06/behrn916-light.frag) by Nima Behravan
- [Turner Sunset](../edit.html#examples/06/dothh489-sunset.frag) by Hang Do Thi Duc
- [Villareal instalation](../edit.html#examples/06/dothh489-villareal.frag) by Hang Do Thi Duc
- [Turner Sunset](../edit.html#examples/06/henrt555-turner.frag) by Tyler Henry
- [Villareal instalation 1](../edit.html#examples/06/mahau289-villareal1.frag) by Udit Mahajan
- [Villareal instalation 2](../edit.html#examples/06/mahau289-villareal2.frag) by Udit Mahajan
- [Sunrise/Sunset](../edit.html#examples/06/randj063-sunset.frag) by Jaskirat Randhawa
- [Villareal instalation](../edit.html#examples/06/tothn598-villareal.frag) by Nitcha Tothong
- [Villareal instalation](../edit.html#examples/06/wangl073-villareal.frag) by Luobin Wang
Loading…
Cancel
Save