Advertisement
Mayosis

test

Oct 19th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.95 KB | None | 0 0
  1. #define r iResolution.xy
  2. #define t iTime
  3.  
  4. #define zoom 1.
  5.  
  6. #define P(id,a,b,c,d,e,f,g,h) if( id == int(pos.y) ){ int pa = a+2*(b+2*(c+2*(d+2*(e+2*(f+2*(g+2*(h))))))); cha = floor(mod(float(pa)/pow(2.,float(pos.x)-1.),2.)); }
  7.  
  8. float gray(vec3 _i)
  9. {
  10.     return _i.x*0.299+_i.y*0.587+_i.z*0.114;
  11. }
  12.  
  13. void mainImage( out vec4 fragColor, in vec2 fragCoord )
  14. {
  15.     vec2 uv = vec2(floor(fragCoord.x/8./zoom)*8.*zoom,floor(fragCoord.y/12./zoom)*12.*zoom)/r;
  16.     ivec2 pos = ivec2(mod(fragCoord.x/zoom,8.),mod(fragCoord.y/zoom,12.));
  17.     vec4 tex = texture(iChannel0,uv);
  18.     float cha = 0.;
  19.    
  20.     float g = gray(tex.xyz);
  21.     if( g < .125 )
  22.     {
  23.         P(11,0,0,0,0,0,0,0,0);
  24.         P(10,0,0,0,0,0,0,0,0);
  25.         P(9,0,0,0,0,0,0,0,0);
  26.         P(8,0,0,0,0,0,0,0,0);
  27.         P(7,0,0,0,0,0,0,0,0);
  28.         P(6,0,0,0,0,0,0,0,0);
  29.         P(5,0,0,0,0,0,0,0,0);
  30.         P(4,0,0,0,0,0,0,0,0);
  31.         P(3,0,0,0,0,0,0,0,0);
  32.         P(2,0,0,0,0,0,0,0,0);
  33.         P(1,0,0,0,0,0,0,0,0);
  34.         P(0,0,0,0,0,0,0,0,0);
  35.     }
  36.     else if( g < .25 ) // .
  37.     {
  38.         P(11,0,0,0,0,0,0,0,0);
  39.         P(10,0,0,0,0,0,0,0,0);
  40.         P(9,0,0,0,0,0,0,0,0);
  41.         P(8,0,0,0,0,0,0,0,0);
  42.         P(7,0,0,0,0,0,0,0,0);
  43.         P(6,0,0,0,0,0,0,0,0);
  44.         P(5,0,0,0,0,0,0,0,0);
  45.         P(4,0,0,0,1,1,0,0,0);
  46.         P(3,0,0,0,1,1,0,0,0);
  47.         P(2,0,0,0,0,0,0,0,0);
  48.         P(1,0,0,0,0,0,0,0,0);
  49.         P(0,0,0,0,0,0,0,0,0);
  50.     }
  51.     else if( g < .375 ) // ,
  52.     {
  53.         P(11,0,0,0,0,0,0,0,0);
  54.         P(10,0,0,0,0,0,0,0,0);
  55.         P(9,0,0,0,0,0,0,0,0);
  56.         P(8,0,0,0,0,0,0,0,0);
  57.         P(7,0,0,0,0,0,0,0,0);
  58.         P(6,0,0,0,0,0,0,0,0);
  59.         P(5,0,0,0,0,0,0,0,0);
  60.         P(4,0,0,0,1,1,0,0,0);
  61.         P(3,0,0,0,1,1,0,0,0);
  62.         P(2,0,0,0,0,1,0,0,0);
  63.         P(1,0,0,0,1,0,0,0,0);
  64.         P(0,0,0,0,0,0,0,0,0);
  65.     }
  66.     else if( g < .5 ) // -
  67.     {
  68.         P(11,0,0,0,0,0,0,0,0);
  69.         P(10,0,0,0,0,0,0,0,0);
  70.         P(9,0,0,0,0,0,0,0,0);
  71.         P(8,0,0,0,0,0,0,0,0);
  72.         P(7,0,0,0,0,0,0,0,0);
  73.         P(6,1,1,1,1,1,1,1,0);
  74.         P(5,0,0,0,0,0,0,0,0);
  75.         P(4,0,0,0,0,0,0,0,0);
  76.         P(3,0,0,0,0,0,0,0,0);
  77.         P(2,0,0,0,0,0,0,0,0);
  78.         P(1,0,0,0,0,0,0,0,0);
  79.         P(0,0,0,0,0,0,0,0,0);
  80.     }
  81.     else if(g < .625 ) // +
  82.     {
  83.         P(11,0,0,0,0,0,0,0,0);
  84.         P(10,0,0,0,0,0,0,0,0);
  85.         P(9,0,0,0,1,0,0,0,0);
  86.         P(8,0,0,0,1,0,0,0,0);
  87.         P(7,0,0,0,1,0,0,0,0);
  88.         P(6,1,1,1,1,1,1,1,0);
  89.         P(5,0,0,0,1,0,0,0,0);
  90.         P(4,0,0,0,1,0,0,0,0);
  91.         P(3,0,0,0,1,0,0,0,0);
  92.         P(2,0,0,0,0,0,0,0,0);
  93.         P(1,0,0,0,0,0,0,0,0);
  94.         P(0,0,0,0,0,0,0,0,0);
  95.     }
  96.     else if(g < .75 ) // *
  97.     {
  98.         P(11,0,0,0,0,0,0,0,0);
  99.         P(10,0,0,0,1,0,0,0,0);
  100.         P(9,1,0,0,1,0,0,1,0);
  101.         P(8,0,1,0,1,0,1,0,0);
  102.         P(7,0,0,1,1,1,0,0,0);
  103.         P(6,0,0,0,1,0,0,0,0);
  104.         P(5,0,0,1,1,1,0,0,0);
  105.         P(4,0,1,0,1,0,1,0,0);
  106.         P(3,1,0,0,1,0,0,1,0);
  107.         P(2,0,0,0,1,0,0,0,0);
  108.         P(1,0,0,0,0,0,0,0,0);
  109.         P(0,0,0,0,0,0,0,0,0);
  110.     }
  111.     else if(g < .875 ) // #
  112.     {
  113.         P(11,0,0,0,0,0,0,0,0);
  114.         P(10,0,0,1,0,0,1,0,0);
  115.         P(9,0,0,1,0,0,1,0,0);
  116.         P(8,1,1,1,1,1,1,1,0);
  117.         P(7,0,0,1,0,0,1,0,0);
  118.         P(6,0,0,1,0,0,1,0,0);
  119.         P(5,0,1,0,0,1,0,0,0);
  120.         P(4,0,1,0,0,1,0,0,0);
  121.         P(3,1,1,1,1,1,1,1,0);
  122.         P(2,0,1,0,0,1,0,0,0);
  123.         P(1,0,1,0,0,1,0,0,0);
  124.         P(0,0,0,0,0,0,0,0,0);
  125.     }
  126.     else // @
  127.     {
  128.         P(11,0,0,0,0,0,0,0,0);
  129.         P(10,0,0,1,1,1,1,0,0);
  130.         P(9,0,1,0,0,0,0,1,0);
  131.         P(8,1,0,0,0,1,1,1,0);
  132.         P(7,1,0,0,1,0,0,1,0);
  133.         P(6,1,0,0,1,0,0,1,0);
  134.         P(5,1,0,0,1,0,0,1,0);
  135.         P(4,1,0,0,1,0,0,1,0);
  136.         P(3,1,0,0,1,1,1,1,0);
  137.         P(2,0,1,0,0,0,0,0,0);
  138.         P(1,0,0,1,1,1,1,1,0);
  139.         P(0,0,0,0,0,0,0,0,0);
  140.     }
  141.    
  142.     vec3 col = tex.xyz/max(tex.x,max(tex.y,tex.z));
  143.     fragColor = vec4(cha*col,1.);
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement