pull/63/head
Patricio Gonzalez Vivo 8 years ago
parent b3b07fc514
commit 5d37b89432

@ -1,4 +1,5 @@
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
// Title: Deco
#ifdef GL_ES
precision mediump float;

@ -1,4 +1,5 @@
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
// Title: Diamond Tiles
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv ( patricio.io ) - 2015
// Inspired by the Patterns of Nina Warmerdam ( www.behance.net/ninawarmerdam )
// Title: Nina Warmerdam ( www.behance.net/ninawarmerdam )
#ifdef GL_ES
precision mediump float;

@ -1,4 +1,5 @@
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
// Title: IChing series
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,6 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Zigzag
#ifdef GL_ES
precision mediump float;
#endif

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Mosaic
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Truchet - 10 print
#ifdef GL_ES
precision mediump float;

@ -1,71 +0,0 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
#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 bin(vec2 ipos, float n){
int remain = int(n);//mod(n,33554432.);
int x = int(ipos.x);
int y = int(ipos.y);
for(int i = 0; i < 25; i++){
if ( i/3 == y && mod(float(i),3.) == ipos.x ) {
return mod(float(remain),2.0);
}
remain = remain/2;
}
return 0.0;
}
float char(vec2 st, float n){
st.x = st.x*2.-0.5;
st.y = st.y*1.2-0.1;
vec2 grid = vec2(3.,5.);
vec2 ipos = floor(st*grid);
vec2 fpos = fract(st*grid);
n = floor(mod(n,10.));
float digit = 0.0;
if (n < 1. ) { digit = 31600.; }
else if (n < 2. ) { digit = 9363.0; }
else if (n < 3. ) { digit = 31184.0; }
else if (n < 4. ) { digit = 31208.0; }
else if (n < 5. ) { digit = 23525.0; }
else if (n < 6. ) { digit = 29672.0; }
else if (n < 7. ) { digit = 29680.0; }
else if (n < 8. ) { digit = 31013.0; }
else if (n < 9. ) { digit = 31728.0; }
else if (n < 10. ) { digit = 31717.0; }
float pct = bin(ipos, digit);
vec2 borders = vec2(1.);
//borders *= step(0.01,fpos.x) * step(0.01,fpos.y); // inner
borders *= step(0.0,st)*step(0.0,1.-st); // outer
return step(.5,1.0-pct) * borders.x * borders.y;
}
void main(){
vec2 st = gl_FragCoord.st/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
float rows = 2.0;
vec2 ipos = floor(st*rows);
vec2 fpos = fract(st*rows);
ipos += vec2(0.,floor(u_time*20.*random(ipos.x+1.)));
float pct = random(ipos);
vec3 color = vec3(char(fpos,100.*pct));
color = mix(color,vec3(color.r,0.,0.),step(.99,pct));
gl_FragColor = vec4( color , 1.0);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

@ -1,4 +1,5 @@
// Author @patriciogv ( patriciogonzalezvivo.com ) - 2015
// Author: @patriciogv ( patriciogonzalezvivo.com ) - 2015
// Title: IChing
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Ikeda Test patterns
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Wave
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: DeFrag
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Ikeda Data Stream
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: DeFrag
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Ikeda Digits
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Ikeda Numered Grid
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Ikeda Grid
#ifdef GL_ES
precision mediump float;

@ -1,5 +1,5 @@
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
// Title: Matrix
#ifdef GL_ES
precision mediump float;

@ -1,3 +1 @@
## Featured examples
This examples are shared by our readers using [this editor](http://editor.thebookofshaders.com/). Send yours to [@bookofshaders](https://twitter.com/bookofshaders). We are looking forward to see it!

@ -1,3 +1,5 @@
# Shader Gallery
# Examples Gallery
The following is the list of examples present in this book and more from our excellent contributors and readers. Find your favorite example and play around with it. It's good idea to change the values or commenting out a part of the code to understand what each part of the code is doing. Once you feel comfortable with the example, try if you can create something unique and new by tweaking it bit by bit, then share your experiment with "share" button at the top of the editor so that someone can find it and study.
<p align="right"><i>Cureated by <a href="https://twitter.com/kyndinfo">Kenichi Yoneda (@kyndinfo)</a></i></p>
This is a collection of examples extracted from the chapters of this book together with shared shaders kindly donated by other readers using [the on-line editor](http://editor.thebookofshaders.com/). Feel free to explore and tweak them bit by bit. Once you have something you are proud of, click the "Export" and then copy the "URL to code...". Send it to [@bookofshaders](https://twitter.com/bookofshaders) or [@kyndinfo](https://twitter.com/kyndinfo). We are looking forward to see it!

Loading…
Cancel
Save