From 5d37b894322a361574eb0a6c858c9cd87a479402 Mon Sep 17 00:00:00 2001 From: Patricio Gonzalez Vivo Date: Sun, 24 Apr 2016 11:26:26 -0400 Subject: [PATCH] styling --- 09/deco.frag | 1 + 09/diamondtiles.frag | 1 + 09/dots5.frag | 2 +- 09/iching-01.frag | 1 + 09/zigzag.frag | 3 +- 10/2d-random-mosaic.frag | 2 +- 10/2d-random-truchet.frag | 2 +- 10/digits.frag | 71 ------------------------------------- 10/digits.png | Bin 41144 -> 0 bytes 10/iching-02.frag | 3 +- 10/ikeda-00.frag | 2 +- 10/ikeda-01.frag | 2 +- 10/ikeda-02.frag | 2 +- 10/ikeda-03.frag | 2 +- 10/ikeda-04.frag | 2 +- 10/ikeda-digits.frag | 2 +- 10/ikeda-numered-grid.frag | 2 +- 10/ikeda-simple-grid.frag | 2 +- 10/matrix.frag | 2 +- examples/FEATURED.md | 2 -- examples/README.md | 6 ++-- 21 files changed, 23 insertions(+), 89 deletions(-) delete mode 100644 10/digits.frag delete mode 100644 10/digits.png diff --git a/09/deco.frag b/09/deco.frag index f763a12..908bc61 100644 --- a/09/deco.frag +++ b/09/deco.frag @@ -1,4 +1,5 @@ // Author @patriciogv ( patriciogonzalezvivo.com ) - 2015 +// Title: Deco #ifdef GL_ES precision mediump float; diff --git a/09/diamondtiles.frag b/09/diamondtiles.frag index 116f55b..d727d66 100644 --- a/09/diamondtiles.frag +++ b/09/diamondtiles.frag @@ -1,4 +1,5 @@ // Author @patriciogv ( patriciogonzalezvivo.com ) - 2015 +// Title: Diamond Tiles #ifdef GL_ES precision mediump float; diff --git a/09/dots5.frag b/09/dots5.frag index fb4f277..4ccb880 100644 --- a/09/dots5.frag +++ b/09/dots5.frag @@ -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; diff --git a/09/iching-01.frag b/09/iching-01.frag index dfabb24..72cdd7c 100644 --- a/09/iching-01.frag +++ b/09/iching-01.frag @@ -1,4 +1,5 @@ // Author @patriciogv ( patriciogonzalezvivo.com ) - 2015 +// Title: IChing series #ifdef GL_ES precision mediump float; diff --git a/09/zigzag.frag b/09/zigzag.frag index 02e4cf6..6a010d9 100644 --- a/09/zigzag.frag +++ b/09/zigzag.frag @@ -1,5 +1,6 @@ // Author @patriciogv - 2015 -// http://patriciogonzalezvivo.com +// Title: Zigzag + #ifdef GL_ES precision mediump float; #endif diff --git a/10/2d-random-mosaic.frag b/10/2d-random-mosaic.frag index 9baf34f..945f929 100644 --- a/10/2d-random-mosaic.frag +++ b/10/2d-random-mosaic.frag @@ -1,5 +1,5 @@ // Author @patriciogv - 2015 -// http://patriciogonzalezvivo.com +// Title: Mosaic #ifdef GL_ES precision mediump float; diff --git a/10/2d-random-truchet.frag b/10/2d-random-truchet.frag index e61fdd1..5a2915f 100644 --- a/10/2d-random-truchet.frag +++ b/10/2d-random-truchet.frag @@ -1,5 +1,5 @@ // Author @patriciogv - 2015 -// http://patriciogonzalezvivo.com +// Title: Truchet - 10 print #ifdef GL_ES precision mediump float; diff --git a/10/digits.frag b/10/digits.frag deleted file mode 100644 index ada1591..0000000 --- a/10/digits.frag +++ /dev/null @@ -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); -} diff --git a/10/digits.png b/10/digits.png deleted file mode 100644 index fcbe44f4044190026c58f748dcbea3fd6dc9bd3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41144 zcmeI5QD|FL7{_n3n8hsF!rVi8=h}tB=)+*4yXZD$+N37-VWY?%h7TjyF|&sb#Ud+M z)-1KCMB@-e1tEB0B8W^V_~JucWpoHzGv^+L4;wm-5A~r;)IKbpdz-L(PqK5*!@2kF z-u?#*tT`#&_w{_=@B4q>Irr_c!?{>Qj!2Re8-0G{1xeb_(Ef%)%U1-^~~tV z@R8HU#*gRo|6WZ+vYEURWWR)z;K$j8GgiyUH@TI`&zBB<8p&CG)A($yuyI=HeQ&N- z2$xweWL1p0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KzlL_XcM#Bz1|MV9ZiAWz&E}!iY|2-vmGh-;!NK%3U!^gipYv%< za8nyPpBSBwn*e}*4(}N#uux!W3y4o#Ho%@IFuW&Q-F~lf=?5eDw%b+I*J^Y6Cureated by Kenichi Yoneda (@kyndinfo)

+ +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!