├── Binaries ├── ShaderLoader.dll └── SpoutPanel.exe ├── LICENSE ├── README.md ├── ShaderLoader.pdf ├── Shaders ├── GLSLsandbox-11706-0_The_other_road_to_hell.txt ├── GLSLsandbox-1293-0_duelling_mandelbulbs.txt ├── GLSLsandbox-20625-0_GLSLFont.txt ├── GLSLsandbox-20798-0_cartoon.txt ├── GLSLsandbox-20800-0_cartoon.txt ├── GLSLsandbox-3259-0_relief_tunnel.txt ├── LICENCE.TXT ├── More shaders │ ├── README.TXT │ ├── ShaderToy-4d2XR1_phoenix.txt │ ├── ShaderToy-4d2Xzc_flakes.txt │ ├── ShaderToy-4dBGDy_green_discs.txt │ ├── ShaderToy-4dXGRn_deform_star.txt │ ├── ShaderToy-4dXGWS_ifs_random.txt │ ├── ShaderToy-4df3DS_infinite_city.txt │ ├── ShaderToy-4djSD3_texture_flow_II.txt │ ├── ShaderToy-4djXzz_topologica.txt │ ├── ShaderToy-4dlGDN_noise_blur.txt │ ├── ShaderToy-4s23zR_random_spheres.txt │ ├── ShaderToy-4sBXRc_texture_swirl.txt │ ├── ShaderToy-4sSSWz_stardust.txt │ ├── ShaderToy-4sf3Rn_planet.txt │ ├── ShaderToy-4sfGWX_wolfenstein.txt │ ├── ShaderToy-4sl3Dr_digital_brain.txt │ ├── ShaderToy-4slSzj_glass-polyhedron.txt │ ├── ShaderToy-Md23Wz_mars_jetpack.txt │ ├── ShaderToy-Md2GRc_fractal_lines.txt │ ├── ShaderToy-MdBSDt_bacterium.txt │ ├── ShaderToy-MdX3zr_flame.txt │ ├── ShaderToy-MdXGDH_old_school_plasma.txt │ ├── ShaderToy-MdfSzn_metatunnel.txt │ ├── ShaderToy-Mds3Rn_road_to_hell.txt │ ├── ShaderToy-MdsXzr_fluid-amoeba.txt │ ├── ShaderToy-Ms2SWW_deform_square_tunnel.txt │ ├── ShaderToy-MsXGR2_dubstep.txt │ ├── ShaderToy-MsXGRf_flames.txt │ ├── ShaderToy-MsXGz8_isolines.txt │ ├── ShaderToy-Msl3WH_warp_speed.txt │ ├── ShaderToy-MslGRn_electron.txt │ ├── ShaderToy-MssGW4_iterations_guts.txt │ ├── ShaderToy-Xd2GR3_hexagons_distance.txt │ ├── ShaderToy-XdB3Dw_popular.txt │ ├── ShaderToy-XdBSzd_tissue.txt │ ├── ShaderToy-XdSSz1_string_theory.txt │ ├── ShaderToy-Xs2XDV_twofield.txt │ ├── ShaderToy-XsBSRG_morning_city.txt │ ├── ShaderToy-XsX3Rn#_deform_fly.txt │ ├── ShaderToy-XsXGzn_clover.txt │ ├── ShaderToy-XsjXR1_worms.txt │ ├── ShaderToy-XsjXRm_plasma_globe.txt │ ├── ShaderToy-Xsl3zn_warping_texture.txt │ ├── ShaderToy-ld23zt_shakespeare_quest.txt │ ├── ShaderToy-ldBXDd_Crease_Machine.txt │ ├── ShaderToy-ldS3Rh_icosahedron.txt │ ├── ShaderToy-ldfXzn_diamonds-are-forever.txt │ ├── ShaderToy-ldjXD3_Texture_Flow_III.txt │ ├── ShaderToy-lsBXD1_GTC_Conference.txt │ ├── ShaderToy-lsSGRc_blocks.txt │ ├── ShaderToy-lsSGzy_flaring.txt │ ├── ShaderToy-lsXSDn#_matrix_rain.txt │ ├── ShaderToy-lsf3R4_wavy_texture.txt │ ├── ShaderToy-lsf3RH_ball_of_fire.txt │ ├── ShaderToy-lslXRS_lava.txt │ ├── ShaderToy-lss3WS_relentless.txt │ └── ShaderToy-lss3WS_simplicity.txt ├── Revised │ ├── README.TXT │ └── ShaderToy-ldl3W8#_voronoi-distances.txt ├── ShaderToy-4dBSRK_color_grid.txt ├── ShaderToy-4dl3zn_bubbles.txt ├── ShaderToy-4ds3zn_apollonian.txt ├── ShaderToy-4sX3Rn_menger_sponge.txt ├── ShaderToy-4sXGDN_iterations_coral.txt ├── ShaderToy-4sfXDs_helices.txt ├── ShaderToy-4slGD4_mountains.txt ├── ShaderToy-4slSR4_S4550_tutorial_part_2.txt ├── ShaderToy-4tfGRr_supernovae.txt ├── ShaderToy-4ts3RN_land_of_gloss.txt ├── ShaderToy-4ts3zM#_knitted.txt ├── ShaderToy-Md2Gzh_fuzzy_field.txt ├── ShaderToy-Mdf3z7_menger_journey.txt ├── ShaderToy-MdfGRn_vorotissue.txt ├── ShaderToy-Mdl3RH_iterations_trigonome.txt ├── ShaderToy-MdlXz8_tileable_water.txt ├── ShaderToy-Mds3R8_lyapunov.txt ├── ShaderToy-MsfGzM_two_tweets.txt ├── ShaderToy-MsfGzr_to_the_road_of_ribbon.txt ├── ShaderToy-MslGD8_voronoi_basic.txt ├── ShaderToy-MslXz8_iterations_shiny.txt ├── ShaderToy-Xd23DD_racing_game.txt ├── ShaderToy-Xd2GR1_carnival_ride.txt ├── ShaderToy-XdBGzd_sphere_projection.txt ├── ShaderToy-XdXGDS_iterations_inversion.txt ├── ShaderToy-Xds3zN_raymarching_primitives.txt ├── ShaderToy-Xs2GDd_cellular.txt ├── ShaderToy-XsB3Rm_ray_matching_sample_code.txt ├── ShaderToy-XsSGRD_fluffys_breakfast.txt ├── ShaderToy-Xsf3zX__rolling_hills.txt ├── ShaderToy-XsfSD4_warping_procedural_3.txt ├── ShaderToy-Xsl3zN_fire.txt ├── ShaderToy-XslGRr_clouds.txt ├── ShaderToy-XssXz4_neon_parallax.txt ├── ShaderToy-XtsGRM_nessie.txt ├── ShaderToy-iq2014_inverse_bilinear.txt ├── ShaderToy-iq2014_voronoise.txt ├── ShaderToy-ldf3DN_mandelbrot_orbit_traps.txt ├── ShaderToy-llXGR4_antialiasing.txt ├── ShaderToy-lsB3zD_doom.txt ├── ShaderToy-lsXGz8_time.txt ├── ShaderToy-lsf3RH_ball_of_fire.txt ├── ShaderToy-lsf3zr_catacombs.txt ├── ShaderToy-lsfGDB_disk_intersection.txt ├── ShaderToy-lsl3RH_warping_procedural_2.txt ├── chocolux.txt ├── clod.txt ├── colour-input_example.txt ├── disco.txt ├── dual-texture_example.txt ├── flower.txt ├── frei_chen_edge_filter.txt ├── kuwahara_filter.txt ├── monjori.txt ├── nautilus.txt ├── pass_through_example.txt ├── plasma.txt ├── quantize_filter.txt ├── simple.txt ├── thermal_imaging.txt ├── vlahos_chroma_key.txt └── water.txt ├── Source ├── ShaderLoader.cpp └── ShaderLoader.h └── installation.txt /Binaries/ShaderLoader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Binaries/ShaderLoader.dll -------------------------------------------------------------------------------- /Binaries/SpoutPanel.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Binaries/SpoutPanel.exe -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Lynn Jarvis, Leading Edge Pty. Ltd. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShaderLoader 2 | A FreeframeGL plugin to load shader files created from GLSL Sandbox and ShaderToy 3 | -------------------------------------------------------------------------------- /ShaderLoader.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/ShaderLoader.pdf -------------------------------------------------------------------------------- /Shaders/GLSLsandbox-11706-0_The_other_road_to_hell.txt: -------------------------------------------------------------------------------- 1 | // 2 | // The other road to hell 3 | // By gleurop 4 | // 5 | // http://glslsandbox.com/e#11706.0 6 | // 7 | precision mediump float; 8 | 9 | uniform float time; 10 | uniform vec2 resolution; 11 | 12 | const int MAX_ITER = 50; 13 | 14 | vec2 rotate(in vec2 v, in float a) { 15 | return vec2(cos(a)*v.x + sin(a)*v.y, -sin(a)*v.x + cos(a)*v.y); 16 | } 17 | 18 | float torus(in vec3 p, in vec2 t) 19 | { 20 | vec2 q = vec2(length(p.xz)-t.x,p.y); 21 | return length(q)-t.y; 22 | } 23 | 24 | float trap(in vec3 p) 25 | { 26 | //return length(max(abs(p.xy) - vec2(0.05), 0.0)); 27 | //return length(p.xz)-0.05; 28 | return min(torus(p, vec2(0.5, 0.05)), length(max(abs(p.xz) - vec2(0.05), 0.0))); 29 | //return max(min(length(p.xz), min(length(p.yz), length(p.xy))) - 0.15, 0.0); 30 | } 31 | 32 | float map(in vec3 p) 33 | { 34 | float cutout = dot(abs(p.yz),vec2(0.5))-0.035; 35 | float road = max(abs(p.y-0.025), abs(p.z)-0.035); 36 | 37 | vec3 z = abs(1.0-mod(p,2.0)); 38 | z.yz = rotate(z.yz, time*0.0005); 39 | 40 | float d = 99999.0; 41 | for (float i = 0.0; i < 3.0; i++) { 42 | z.xz = rotate(z.xz, radians(i*7.0+time)); 43 | z.zy = rotate(z.yz, radians((i+1.0)*2.0+time*0.1234)); 44 | z = abs(1.0-mod(z+i/3.0,2.0)); 45 | 46 | z = z*2.0 - 0.3; 47 | d = min(d, trap(z) * pow(2.0, -(i+1.0))); 48 | } 49 | return min(max(d, -cutout), road); 50 | } 51 | 52 | vec3 hsv(in float h, in float s, in float v) { 53 | return mix(vec3(1.0), clamp((abs(fract(h + vec3(3, 2, 1) / 3.0) * 6.0 - 3.0) - 1.0), 0.0 , 1.0), s) * v; 54 | } 55 | 56 | vec3 intersect(in vec3 rayOrigin, in vec3 rayDir) 57 | { 58 | float total_dist = 0.0; 59 | vec3 p = rayOrigin; 60 | float d = 1.0; 61 | float iter = 0.0; 62 | float mind = 3.14159+sin(time*0.00000001)*0.000001; 63 | 64 | for (int i = 0; i < MAX_ITER; i++) 65 | { 66 | if (d < 0.0001) continue; 67 | 68 | d = map(p); 69 | p += d*vec3(rayDir.x, rotate(rayDir.yz, sin(mind))); 70 | mind = min(mind, d); 71 | total_dist += d; 72 | iter++; 73 | } 74 | 75 | vec3 color = vec3(0.0); 76 | if (d < 0.0001) { 77 | float x = (iter/float(MAX_ITER)); 78 | float y = (d-0.001)/0.001/(float(MAX_ITER)); 79 | float z = (0.001-d)/0.001/float(MAX_ITER); 80 | if (max(abs(p.y-0.025), abs(p.z)-0.035)<0.001) { // Road 81 | float w = smoothstep(mod(p.x*50.0, 4.0), 2.0, 2.01); 82 | w -= 1.0-smoothstep(mod(p.x*50.0+2.0, 4.0), 2.0, 1.99); 83 | w = fract(w+0.0001); 84 | float a = fract(smoothstep(abs(p.z), 0.0025, 0.0026)); 85 | color = vec3((1.0-x-y*2.)*mix(vec3(0.8, 0.8, 0), vec3(0.1), 1.0-(1.0-w)*(1.0-a))); 86 | } else { 87 | float q = 1.0-x-y*2.+z; 88 | color = hsv(q*0.2+0.85, 1.0-q*0.2, q); 89 | } 90 | } else 91 | color = hsv(d, 1.0, 1.0)*mind*100.0; // Background 92 | return color; 93 | } 94 | 95 | void main() 96 | { 97 | vec3 upDirection = vec3(0, -1, 0); 98 | vec3 cameraDir = vec3(1,0,0); 99 | vec3 cameraOrigin = vec3(time*0.1, 0, 0); 100 | 101 | vec3 u = normalize(cross(upDirection, cameraOrigin)); 102 | vec3 v = normalize(cross(cameraDir, u)); 103 | vec2 screenPos = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy; 104 | screenPos.x *= resolution.x / resolution.y; 105 | vec3 rayDir = normalize(u * screenPos.x + v * screenPos.y + cameraDir*(1.0-length(screenPos)*0.5)); 106 | 107 | gl_FragColor = vec4(intersect(cameraOrigin, rayDir), 1.0); 108 | } 109 | -------------------------------------------------------------------------------- /Shaders/GLSLsandbox-1293-0_duelling_mandelbulbs.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Duelling Mandelbulbs 3 | // 4 | // http://glsl.herokuapp.com/e#1293.0 5 | // http://www.thealphablenders.com/ 6 | // 2012 by Andrew Caudwell 7 | // 8 | #ifdef GL_ES 9 | precision mediump float; 10 | #endif 11 | 12 | uniform vec2 resolution; 13 | uniform vec2 mouse; 14 | uniform float time; 15 | 16 | struct Ray { 17 | vec3 o; 18 | vec3 d; 19 | }; 20 | 21 | // dueling mandelbulbs 22 | // @acaudwell 23 | 24 | // http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/ 25 | 26 | float mandelbulb(in vec3 p, float power) { 27 | 28 | float dr = 1.0; 29 | float r = length(p); 30 | 31 | vec3 c = p; 32 | 33 | for(int i=0; i<2; i++) { 34 | 35 | float zo0 = asin(p.z / r); 36 | float zi0 = atan(p.y, p.x); 37 | float zr = pow(r, power-1.0); 38 | float zo = (zo0) * power; 39 | float zi = (zi0) * power; 40 | float czo = cos(zo); 41 | 42 | dr = zr * dr * power + 1.0; 43 | zr *= r; 44 | 45 | p = zr * vec3(czo*cos(zi), czo*sin(zi), sin(zo)); 46 | 47 | p += c; 48 | 49 | r = length(p); 50 | } 51 | 52 | return 0.5 * r * log(r) / r; 53 | } 54 | 55 | void main() { 56 | 57 | vec2 p = ((gl_FragCoord.xy / resolution.xy) * 2.0 - 1.0) * 3.5; 58 | 59 | float t = time; 60 | 61 | Ray ray1; 62 | ray1.o = vec3(0.0); 63 | ray1.d = normalize( vec3((p - 1.5*vec2(sin(t-2.0), cos(t+1.0))) * vec2(resolution.x/resolution.y, 1.0), 1.0 ) ); 64 | 65 | Ray ray2; 66 | ray2.o = vec3(0.0); 67 | ray2.d = normalize( vec3((p - 1.5*vec2(cos(-t),sin(t))) * vec2(resolution.x/resolution.y, 1.0), 1.0 ) ); 68 | 69 | ray1.d.xy = vec2( ray1.d.x * cos(t) - ray1.d.y * sin(t), ray1.d.x * sin(t) + ray1.d.y * cos(t)); 70 | ray2.d.xy = vec2( ray2.d.x * cos(t) - ray2.d.y * sin(t), ray2.d.x * sin(t) + ray2.d.y * cos(t)); 71 | 72 | float m1 = mandelbulb(ray1.o + ray1.d, abs(cos(t)*13.0)); 73 | float m2 = mandelbulb(ray2.o + ray2.d, abs(sin(t)*13.0)); 74 | 75 | float f = pow(max(m1,m2) , abs(m1-m2)); 76 | vec3 c = m1 > m2 ? vec3(0.0, 0.05, 0.2) : vec3(0.2, 0.05, 0.0); 77 | 78 | gl_FragColor = vec4(c*f, 1.0); 79 | } 80 | 81 | -------------------------------------------------------------------------------- /Shaders/GLSLsandbox-3259-0_relief_tunnel.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Relief tunnel 3 | // 4 | // http://glsl.herokuapp.com/e#3259.0 5 | // 6 | 7 | 8 | #ifdef GL_ES 9 | precision mediump float; 10 | #endif 11 | //gt 12 | uniform float time; 13 | uniform vec2 mouse; 14 | uniform vec2 resolution; 15 | 16 | void main( void ) { 17 | 18 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy; 19 | vec2 uv; 20 | //shadertoy deform "relief tunnel"-gt 21 | float r = sqrt( dot(p,p) ); 22 | float a = atan(p.y,p.x) + 0.9*sin(0.5*r-0.5*time); 23 | 24 | float s = 0.5 + 0.5*cos(7.0*a); 25 | s = smoothstep(0.0,1.0,s); 26 | s = smoothstep(0.0,1.0,s); 27 | s = smoothstep(0.0,1.0,s); 28 | s = smoothstep(0.0,1.0,s); 29 | 30 | uv.x = time + 1.0/( r + .2*s); 31 | //uv.y = 3.0*a/3.1416; 32 | uv.y = 1.0*a/10.1416; 33 | 34 | float w = (0.5 + 0.5*s)*r*r; 35 | 36 | // vec3 col = texture2D(tex0,uv).xyz; 37 | 38 | float ao = 0.5 + 0.5*cos(42.0*a);//amp up the ao-g 39 | ao = smoothstep(0.0,0.4,ao)-smoothstep(0.4,0.7,ao); 40 | ao = 1.0-0.5*ao*r; 41 | 42 | 43 | //faux shaded texture-gt 44 | float px = gl_FragCoord.x/resolution.x; 45 | float py = gl_FragCoord.y/resolution.y; 46 | float x = mod(uv.x*resolution.x,resolution.x/3.5); 47 | float y = mod(uv.y*resolution.y+(resolution.y/2.),resolution.y/3.5); 48 | float v = (x / y)-.7; 49 | gl_FragColor = vec4(vec3(.1-v,.9-v,1.-v)*w*ao,1.0); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Shaders/LICENCE.TXT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Shaders/LICENCE.TXT -------------------------------------------------------------------------------- /Shaders/More shaders/README.TXT: -------------------------------------------------------------------------------- 1 | Changes made to ShaderLoader now allow these shaders to work. 2 | 3 | 1) Texture wrap mode is set to GL_REPEAT instead of GL_CLAMP. 4 | This allows use of cordinates from -1.0 to +1.0, otherwise 5 | texture data will be retrieved only in the range 0.0 - 1.0. 6 | 7 | 2) Individual ShaderToy channel resolutions are now supported 8 | instead of just the global resolution. This means that any shader 9 | using iChannelResolution will now work. 10 | 11 | Many shaders require a noise image to create noise data and 12 | some require specific images to work. This is annotated in the 13 | shader code where possible. Otherwise check what is being used. 14 | 15 | Take note of the License terms for use of these shaders. 16 | LICENSE.TXT in the "Shaders" root folder. 17 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4d2XR1_phoenix.txt: -------------------------------------------------------------------------------- 1 | // phoenix 2 | 3 | // https://www.shadertoy.com/view/4d2XR1 4 | 5 | // original by nimitz https://www.shadertoy.com/view/lsSGzy#, slightly modified 6 | 7 | #define ray_brightness 10. 8 | #define gamma 5. 9 | #define ray_density 4.5 10 | #define curvature 15. 11 | #define red 4. 12 | #define green 1.0 13 | #define blue .3 14 | 15 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 16 | // !!!!!!!!!!!!! UNCOMMENT ONE OF THESE TO CHANGE EFFECTS !!!!!!!!!!! 17 | // MODE IS THE PRIMARY MODE 18 | #define MODE normalize 19 | // #define MODE 20 | 21 | #define MODE3 * 22 | // #define MODE3 + 23 | 24 | #define MODE2 r + 25 | // #define MODE2 26 | 27 | // #define DIRECTION + 28 | #define DIRECTION - 29 | 30 | #define SIZE 0.1 31 | 32 | #define INVERT / 33 | // #define INVERT * 34 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 35 | 36 | float noise( in vec2 x ) 37 | { 38 | return texture2D(iChannel0, x*.01).x; // INCREASE MULTIPLIER TO INCREASE NOISE 39 | } 40 | 41 | // FLARING GENERATOR, A.K.A PURE AWESOME 42 | mat2 m2 = mat2( 0.80, 0.60, -0.60, 0.80 ); 43 | float fbm( in vec2 p ) 44 | { 45 | float z=2.; // EDIT THIS TO MODIFY THE INTENSITY OF RAYS 46 | float rz = -0.05; // EDIT THIS TO MODIFY THE LENGTH OF RAYS 47 | p *= 0.25; // EDIT THIS TO MODIFY THE FREQUENCY OF RAYS 48 | for (int i= 1; i < 6; i++) 49 | { 50 | rz+= abs((noise(p)-0.5)*2.)/z; 51 | z = z*2.; 52 | p = p*2.*m2; 53 | } 54 | return rz; 55 | } 56 | 57 | void main(void) 58 | { 59 | float t = DIRECTION iGlobalTime*.33; 60 | vec2 uv = gl_FragCoord.xy / iResolution.xy-0.5; 61 | uv.x *= iResolution.x/iResolution.y; 62 | uv*= curvature* SIZE; 63 | 64 | float r = sqrt(dot(uv,uv)); // DISTANCE FROM CENTER, A.K.A CIRCLE 65 | float x = dot(MODE(uv), vec2(.5,0.))+t; 66 | float y = dot(MODE(uv), vec2(.0,.5))+t; 67 | 68 | float val; 69 | val = fbm(vec2(MODE2 y * ray_density, MODE2 x MODE3 ray_density)); // GENERATES THE FLARING 70 | val = smoothstep(gamma*.02-.1,ray_brightness+(gamma*0.02-.1)+.001,val); 71 | val = sqrt(val); // WE DON'T REALLY NEED SQRT HERE, CHANGE TO 15. * val FOR PERFORMANCE 72 | 73 | vec3 col = val INVERT vec3(red,green,blue); 74 | col = 1.-col; // WE DO NOT NEED TO CLAMP THIS LIKE THE NIMITZ SHADER DOES! 75 | float rad= 30. * texture2D(iChannel1, vec2(0,0)).x; // MODIFY THIS TO CHANGE THE RADIUS OF THE SUNS CENTER 76 | col = mix(col,vec3(1.), rad - 266.667 * r); // REMOVE THIS TO SEE THE FLARING 77 | 78 | gl_FragColor = vec4(col,1.0); 79 | } 80 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4d2Xzc_flakes.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Flakes 3 | // 4 | // 5 | // https://www.shadertoy.com/view/4d2Xzc 6 | // 7 | // Dependent on the input image - Original uses ShaderToy texture image - tex03 8 | // 9 | // Created by inigo quilez - iq/2014 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | void main( void ) 13 | { 14 | vec2 p = gl_FragCoord.xy/iResolution.xy; 15 | 16 | vec3 col = vec3( 0.0 ); 17 | 18 | for( int i=0; i<150; i++ ) 19 | { 20 | float an = 6.2831*float(i)/150.0; 21 | vec2 of = vec2( cos(an), sin(an) ) * (1.0+0.6*cos(7.0*an+iGlobalTime)) + vec2( 0.0, iGlobalTime ); 22 | col = max( col, texture2D( iChannel0, p + 20.0*of/iResolution.xy ).xyz ); 23 | col = max( col, texture2D( iChannel0, p + 5.0*of/iResolution.xy ).xyz ); 24 | } 25 | 26 | col = pow( col, vec3(1.0,2.0,3.0) ) * pow( 4.0*p.y*(1.0-p.y), 0.25 ); 27 | 28 | gl_FragColor = vec4( col, 1.0 ); 29 | } 30 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4dBGDy_green_discs.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/4dBGDy 3 | // 4 | 5 | // Green Discs - by fizzer 6 | // 7 | vec3 cam_origin; 8 | mat3 cam_rotation; 9 | vec2 frag_coord; 10 | float time=0.0; 11 | 12 | vec3 rotateX(float a, vec3 v) 13 | { 14 | return vec3(v.x, cos(a) * v.y + sin(a) * v.z, cos(a) * v.z - sin(a) * v.y); 15 | } 16 | 17 | vec3 rotateY(float a, vec3 v) 18 | { 19 | return vec3(cos(a) * v.x + sin(a) * v.z, v.y, cos(a) * v.z - sin(a) * v.x); 20 | } 21 | 22 | vec3 round(vec3 x) 23 | { 24 | return floor(x + vec3(0.5)); 25 | } 26 | 27 | float orbIntensity(vec3 p) 28 | { 29 | if(length(p) < 4.0) 30 | return 1.0; 31 | 32 | return smoothstep(0.25, 1.0, cos(p.x * 10.0) * sin(p.y * 5.0) * cos(p.z * 7.0)) * 0.2 * step(length(p), 17.0); 33 | } 34 | 35 | vec3 project(vec3 p) 36 | { 37 | // transpose the rotation matrix. unfortunately tranpose() is not available. 38 | mat3 cam_rotation_t = mat3(vec3(cam_rotation[0].x, cam_rotation[1].x, cam_rotation[2].x), 39 | vec3(cam_rotation[0].y, cam_rotation[1].y, cam_rotation[2].y), 40 | vec3(cam_rotation[0].z, cam_rotation[1].z, cam_rotation[2].z)); 41 | 42 | // transform into viewspace 43 | p = cam_rotation_t * (p - cam_origin); 44 | 45 | // project 46 | return vec3(p.xy / p.z, p.z); 47 | } 48 | 49 | float orb(float rad, vec3 coord) 50 | { 51 | return 1.0 - smoothstep(0.5, 0.55, distance(coord.xy, frag_coord) / rad); 52 | } 53 | 54 | float orbShadow(float rad, vec3 coord) 55 | { 56 | return 1.0 - smoothstep(0.4, 1.1, distance(coord.xy, frag_coord) / rad) * mix(1.0,0.99,orb(rad,coord)); 57 | } 58 | 59 | vec3 traverseUniformGrid(vec3 ro, vec3 rd) 60 | { 61 | vec3 increment = vec3(1.0) / rd; 62 | vec3 intersection = ((floor(ro) + round(rd * 0.5 + vec3(0.5))) - ro) * increment; 63 | 64 | increment = abs(increment); 65 | ro += rd * 1e-3; 66 | 67 | vec4 accum = vec4(0.0,0.0,0.0,1.0); 68 | 69 | // traverse the uniform grid 70 | for(int i = 0; i < 40; i += 1) 71 | { 72 | vec3 rp = floor(ro + rd * min(intersection.x, min(intersection.y, intersection.z))); 73 | 74 | float orb_intensity = orbIntensity(rp); 75 | 76 | if(orb_intensity > 1e-3) 77 | { 78 | // get the screenspace position of the cell's centerpoint 79 | vec3 coord = project(rp + vec3(0.5)); 80 | 81 | if(coord.z > 1.0) 82 | { 83 | // calculate the initial radius 84 | float rad = 0.55 / coord.z;// * (1.0 - smoothstep(0.0, 50.0, length(rp))); 85 | 86 | // adjust the radius 87 | rad *= 1.0 + 0.5 * sin(rp.x + time * 1.0) * cos(rp.y + time * 2.0) * cos(rp.z); 88 | 89 | float dist = distance(rp + vec3(0.5), ro); 90 | 91 | float c = smoothstep(1.0, 2.5, dist); 92 | float a = orb(rad, coord) * c; 93 | float b = orbShadow(rad, coord) * c; 94 | 95 | accum.rgb += accum.a * a * 1.5 * mix(vec3(1.0), vec3(0.4, 1.0, 0.5) * 0.5, 0.5 + 0.5 * cos(rp.x)) * exp(-dist * dist * 0.008); 96 | 97 | accum.a *= 1.0 - b; 98 | } 99 | } 100 | 101 | // step to the next ray-cell intersection 102 | intersection += increment * step(intersection.xyz, intersection.yxy) * step(intersection.xyz, intersection.zzx); 103 | } 104 | 105 | // background colour 106 | accum.rgb += accum.a * vec3(0.02); 107 | 108 | return accum.rgb; 109 | } 110 | 111 | 112 | void main(void) 113 | { 114 | // get the normalised device coordinates 115 | vec2 uv = gl_FragCoord.xy / iResolution.xy; 116 | frag_coord = uv * 2.0 - vec2(1.0); 117 | frag_coord.x *= iResolution.x / iResolution.y; 118 | 119 | // defined the time interval for this frame 120 | float time0=iGlobalTime,time1=time0+0.04; 121 | 122 | float jitter=texture2D(iChannel0,uv*iResolution.xy/256.0).r; 123 | 124 | gl_FragColor.rgb = vec3(0.0); 125 | 126 | for(int n=0;n<4;n+=1) 127 | { 128 | time=mix(time0,time1,(float(n)+jitter)/4.0)*0.7; 129 | 130 | cam_origin = rotateX(time * 0.3, rotateY(time * 0.5, vec3(0.0, 0.0, -10.0))); 131 | 132 | // calculate the rotation matrix 133 | vec3 cam_w = normalize(vec3(cos(time) * 10.0, 0.0, 0.0) - cam_origin); 134 | vec3 cam_u = normalize(cross(cam_w, vec3(0.0, 1.0, 0.0))); 135 | vec3 cam_v = normalize(cross(cam_u, cam_w)); 136 | 137 | cam_rotation = mat3(cam_u, cam_v, cam_w); 138 | 139 | vec3 ro = cam_origin,rd = cam_rotation * vec3(frag_coord, 1.0); 140 | 141 | // render the particles 142 | gl_FragColor.rgb += traverseUniformGrid(ro, rd); 143 | } 144 | 145 | // good old vignet 146 | gl_FragColor.rgb *= 0.5 + 0.5*pow( 16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y), 0.1 ); 147 | 148 | gl_FragColor.rgb = sqrt(gl_FragColor.rgb / 4.0 * 0.8); 149 | } 150 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4dXGRn_deform_star.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Deform Star 3 | // 4 | // https://www.shadertoy.com/view/4dXGRn 5 | // 6 | 7 | // Created by inigo quilez - iq/2013 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | vec3 sqr( vec3 x ) { return x*x; } 11 | void main(void) 12 | { 13 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / iResolution.xy; 14 | float a = atan(p.y,p.x); 15 | float r = sqrt(dot(p,p)); 16 | float s = r * (1.0+0.5*cos(iGlobalTime*0.5)); 17 | 18 | vec2 uv = 0.02*p; 19 | uv.x += .03*cos(-iGlobalTime+a*4.0)/s; 20 | uv.y += .02*iGlobalTime +.03*sin(-iGlobalTime+a*4.0)/s; 21 | uv.y += r*r*0.025*sin(2.0*r); 22 | 23 | vec3 col = texture2D( iChannel0, 0.5*uv).xyz * vec3(1.0,0.8,0.6); 24 | col += sqr(texture2D( iChannel0, 1.0*uv).xxx) * vec3(0.7,1.0,1.0); 25 | 26 | float w = 2.0*r; 27 | w *= 0.5 + 0.5*pow(clamp(1.0-0.75*r,0.0,1.0),0.5); 28 | 29 | gl_FragColor = vec4(col*w,1.0); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4dXGWS_ifs_random.txt: -------------------------------------------------------------------------------- 1 | // 2 | // IFS random 3 | // 4 | // https://www.shadertoy.com/view/4dXGWS 5 | // 6 | 7 | // Created by inigo quilez - iq/2013 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | float hash( in float n ) 11 | { 12 | return fract(sin(n)*43758.5453123); 13 | } 14 | 15 | float determinant( in mat2 m ) 16 | { 17 | return abs( m[0][0]*m[1][1] - m[0][1]*m[1][0] ); 18 | } 19 | 20 | void main( void ) 21 | { 22 | vec2 uv = -1.0 + 2.0*gl_FragCoord.xy/iResolution.xy; 23 | uv *= 2.0; 24 | float t = 0.1*iGlobalTime - 1.0; 25 | #if 0 26 | mat2 am = mat2( cos(t*1.71+0.18), cos(t*1.31+3.18), cos(t*1.13+3.29), cos(t*1.44+4.21) ); 27 | mat2 bm = mat2( cos(t*2.57+1.66), cos(t*1.08+0.74), cos(t*2.25+2.78), cos(t*1.23+1.29) ); 28 | mat2 cm = mat2( cos(t*1.15+6.33), cos(t*2.94+2.92), cos(t*1.78+0.82), cos(t*2.58+2.36) ); 29 | mat2 dm = mat2( cos(t*1.42+4.89), cos(t*2.73+6.34), cos(t*1.82+5.91), cos(t*1.21+3.84) ); 30 | vec2 at = vec2( cos(t*2.13+0.94), cos(t*1.19+0.29) )*0.8; 31 | vec2 bt = vec2( cos(t*1.09+5.25), cos(t*1.27+1.77) )*0.8; 32 | vec2 ct = vec2( cos(t*2.76+4.39), cos(t*2.35+2.04) )*0.8; 33 | vec2 dt = vec2( cos(t*1.42+4.71), cos(t*2.81+3.51) )*0.8; 34 | #else 35 | mat2 am = mat2( cos(t*1.71+0.18), -cos(t*1.31+3.18), cos(t*1.31+3.18), cos(t*1.44+4.21) ); 36 | mat2 bm = mat2( cos(t*2.57+1.66), -cos(t*1.08+0.74), cos(t*1.08+0.74), cos(t*1.23+1.29) ); 37 | mat2 cm = mat2( cos(t*1.15+6.33), -cos(t*2.94+2.92), cos(t*2.94+2.92), cos(t*2.58+2.36) ); 38 | mat2 dm = mat2( cos(t*1.42+4.89), -cos(t*2.73+6.34), cos(t*2.73+6.34), cos(t*1.21+3.84) ); 39 | vec2 at = vec2( cos(t*2.13+0.94), cos(t*1.19+0.29) )*0.8; 40 | vec2 bt = vec2( cos(t*1.09+5.25), cos(t*1.27+1.77) )*0.8; 41 | vec2 ct = vec2( cos(t*2.76+4.39), cos(t*2.35+2.04) )*0.8; 42 | vec2 dt = vec2( cos(t*1.42+4.71), cos(t*2.81+3.51) )*0.8; 43 | #endif 44 | 45 | // make sure all trasnforms are contracting, ie, |fi(x)| < 1 ) 46 | am /= mix( 1.0, determinant(am), clamp(determinant(am)*3.0-2.0,0.0,1.0) ); 47 | bm /= mix( 1.0, determinant(bm), clamp(determinant(bm)*3.0-2.0,0.0,1.0) ); 48 | cm /= mix( 1.0, determinant(cm), clamp(determinant(cm)*3.0-2.0,0.0,1.0) ); 49 | dm /= mix( 1.0, determinant(dm), clamp(determinant(dm)*3.0-2.0,0.0,1.0) ); 50 | 51 | vec3 cola = vec3(0.0); 52 | vec3 colb = vec3(0.0); 53 | 54 | float cad = 0.0; 55 | 56 | float p = texture2D( iChannel0, (iGlobalTime+gl_FragCoord.xy+0.5)/256.0, -100.0 ).x; 57 | 58 | vec2 z = vec2( 0.0 ); 59 | 60 | for( int i=0; i<256; i++ ) 61 | { 62 | p = fract( p*8.1 ); 63 | 64 | cad *= 0.25; 65 | if( p < 0.25 ) { z = am*z + at; cad += 0.00; } 66 | else if( p < 0.50 ) { z = bm*z + bt; cad += 0.25; } 67 | else if( p < 0.75 ) { z = cm*z + ct; cad += 0.50; } 68 | else { z = dm*z + dt; cad += 0.75; } 69 | 70 | // non linear transform 71 | float zr = length(z); 72 | float ar = atan( z.y, z.x ) + zr*0.5; 73 | z = 2.0*vec2( cos(ar), sin(ar) )/zr; 74 | 75 | if( i>10 ) 76 | { 77 | vec3 coh = 0.5 + 0.5*sin(2.*cad + vec3(0.0,1.2,2.0)); 78 | float cok = dot(uv-z,uv-z); 79 | cola = mix( cola, coh, exp( -512.0*cok ) ); 80 | colb = mix( colb, coh, exp( -48.0*cok ) ); 81 | } 82 | } 83 | 84 | vec3 col = cola + 0.5*colb; 85 | 86 | gl_FragColor = vec4( col, 1.0 ); 87 | } 88 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4djSD3_texture_flow_II.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/4djSD3 3 | // 4 | 5 | // Texture Flow II 6 | 7 | // Needs 2 textures 8 | // Channel0 - tex12 (noise image) 9 | // Channel1 - tex05 (material image) 10 | 11 | // Created by inigo quilez - iq/2014 12 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 13 | 14 | // Needs two textures 15 | 16 | vec2 flow( vec2 uv ) 17 | { 18 | vec2 e = 1.0/iChannelResolution[0].xy; 19 | 20 | float time = 5.0 * mod( iGlobalTime, 12.0 ); 21 | 22 | for( int i=0; i<50; i++ ) { 23 | float h0 = dot( texture2D(iChannel0, uv ).xyz, vec3(0.333) ); 24 | float h1 = dot( texture2D(iChannel0, uv+vec2(e.x,0.0)).xyz, vec3(0.333) ); 25 | float h2 = dot( texture2D(iChannel0, uv+vec2(0.0,e.y)).xyz, vec3(0.333) ); 26 | // tangent 27 | vec2 f = vec2( h2-h0, h0-h1 )/(255.0*e); 28 | // move 29 | uv += 0.0015*f *clamp( (time-float(i)), 0.0, 1.0 ); 30 | } 31 | 32 | return uv; 33 | } 34 | 35 | void main( void ) 36 | { 37 | vec2 p = gl_FragCoord.xy / iResolution.xy; 38 | 39 | // orbit, distance and distance gradient 40 | vec2 uva = 0.05*(p + vec2(1.0,0.0)/iResolution.xy); 41 | vec2 uvb = 0.05*(p + vec2(0.0,1.0)/iResolution.xy); 42 | vec2 uvc = 0.05*p; 43 | vec2 nuva = flow( uva ); 44 | vec2 nuvb = flow( uvb ); 45 | vec2 nuvc = flow( uvc ); 46 | float fa = length(nuva-uva)*64.0; 47 | float fb = length(nuvb-uvb)*64.0; 48 | float fc = length(nuvc-uvc)*64.0; 49 | vec3 nor = normalize( vec3((fa-fc)*iResolution.x,1.0,(fb-fc)*iResolution.y ) ); 50 | 51 | // color 52 | vec3 col = texture2D(iChannel1, 4.0*nuvc).xyz; 53 | 54 | // ilumination 55 | vec3 lig = normalize( vec3( 1.0,1.0,-0.4 ) ); 56 | col *= vec3(0.5,0.6,0.7) + vec3(1.0,0.9,0.8) * clamp( dot(nor,lig), 0.0, 1.0 ); 57 | col *= fc; 58 | 59 | // postprocess 60 | col = 2.0*pow( col, vec3(0.8,0.8,0.7) ); 61 | col *= 0.75 + 0.25*sqrt( 16.0*p.x*p.y*(1.0-p.x)*(1.0-p.y) ); 62 | 63 | gl_FragColor = vec4( col, 1.0 ); 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4djXzz_topologica.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/4djXzz 3 | // 4 | 5 | // 6 | // Topologica 7 | // 8 | 9 | /*-------------------------------------------------------------------------------------- 10 | License CC0 - http://creativecommons.org/publicdomain/zero/1.0/ 11 | To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. 12 | ---------------------------------------------------------------------------------------- 13 | -Otavio Good 14 | */ 15 | 16 | // various noise functions 17 | float Hash2d(vec2 uv) 18 | { 19 | float f = uv.x + uv.y * 47.0; 20 | return fract(cos(f*3.333)*100003.9); 21 | } 22 | float Hash3d(vec3 uv) 23 | { 24 | float f = uv.x + uv.y * 37.0 + uv.z * 521.0; 25 | return fract(cos(f*3.333)*100003.9); 26 | } 27 | float mixP(float f0, float f1, float a) 28 | { 29 | return mix(f0, f1, a*a*(3.0-2.0*a)); 30 | } 31 | const vec2 zeroOne = vec2(0.0, 1.0); 32 | float noise2d(vec2 uv) 33 | { 34 | vec2 fr = fract(uv.xy); 35 | vec2 fl = floor(uv.xy); 36 | float h00 = Hash2d(fl); 37 | float h10 = Hash2d(fl + zeroOne.yx); 38 | float h01 = Hash2d(fl + zeroOne); 39 | float h11 = Hash2d(fl + zeroOne.yy); 40 | return mixP(mixP(h00, h10, fr.x), mixP(h01, h11, fr.x), fr.y); 41 | } 42 | float noise2dT(vec2 uv) 43 | { 44 | vec2 fr = fract(uv); 45 | vec2 smooth = fr*fr*(3.0-2.0*fr); 46 | vec2 fl = floor(uv); 47 | uv = smooth + fl; 48 | return texture2D(iChannel0, (uv + 0.5)/iChannelResolution[0].xy).y; // use constant here instead? 49 | } 50 | float noise(vec3 uv) 51 | { 52 | vec3 fr = fract(uv.xyz); 53 | vec3 fl = floor(uv.xyz); 54 | float h000 = Hash3d(fl); 55 | float h100 = Hash3d(fl + zeroOne.yxx); 56 | float h010 = Hash3d(fl + zeroOne.xyx); 57 | float h110 = Hash3d(fl + zeroOne.yyx); 58 | float h001 = Hash3d(fl + zeroOne.xxy); 59 | float h101 = Hash3d(fl + zeroOne.yxy); 60 | float h011 = Hash3d(fl + zeroOne.xyy); 61 | float h111 = Hash3d(fl + zeroOne.yyy); 62 | return mixP( 63 | mixP(mixP(h000, h100, fr.x), mixP(h010, h110, fr.x), fr.y), 64 | mixP(mixP(h001, h101, fr.x), mixP(h011, h111, fr.x), fr.y) 65 | , fr.z); 66 | } 67 | 68 | float PI=3.14159265; 69 | 70 | vec3 saturate(vec3 a) 71 | { 72 | return clamp(a, 0.0, 1.0); 73 | } 74 | vec2 saturate(vec2 a) 75 | { 76 | return clamp(a, 0.0, 1.0); 77 | } 78 | float saturate(float a) 79 | { 80 | return clamp(a, 0.0, 1.0); 81 | } 82 | 83 | float Density(vec3 p) 84 | { 85 | //float ws = 0.06125*0.125; 86 | //vec3 warp = vec3(noise(p*ws), noise(p*ws + 111.11), noise(p*ws + 7111.11)); 87 | float final = noise(p*0.06125);// + sin(iGlobalTime)*0.5-1.95 + warp.x*4.0; 88 | float other = noise(p*0.06125 + 1234.567); 89 | other -= 0.5; 90 | final -= 0.5; 91 | final = 0.1/(abs(final*final*other)); 92 | final += 0.5; 93 | return final*0.0001; 94 | } 95 | 96 | void main(void) 97 | { 98 | // ---------------- First, set up the camera rays for ray marching ---------------- 99 | vec2 uv = gl_FragCoord.xy/iResolution.xy * 2.0 - 1.0;// - 0.5; 100 | 101 | // Camera up vector. 102 | vec3 camUp=vec3(0,1,0); // vuv 103 | 104 | // Camera lookat. 105 | vec3 camLookat=vec3(0,0.0,0); // vrp 106 | 107 | float mx=iMouse.x/iResolution.x*PI*2.0 + iGlobalTime * 0.01; 108 | float my=-iMouse.y/iResolution.y*10.0 + sin(iGlobalTime * 0.03)*0.2+0.2;//*PI/2.01; 109 | vec3 camPos=vec3(cos(my)*cos(mx),sin(my),cos(my)*sin(mx))*(200.2); // prp 110 | 111 | // Camera setup. 112 | vec3 camVec=normalize(camLookat - camPos);//vpn 113 | vec3 sideNorm=normalize(cross(camUp, camVec)); // u 114 | vec3 upNorm=cross(camVec, sideNorm);//v 115 | vec3 worldFacing=(camPos + camVec);//vcv 116 | vec3 worldPix = worldFacing + uv.x * sideNorm * (iResolution.x/iResolution.y) + uv.y * upNorm;//scrCoord 117 | vec3 relVec = normalize(worldPix - camPos);//scp 118 | 119 | // -------------------------------------------------------------------------------- 120 | float t = 0.0; 121 | float inc = 0.02; 122 | float maxDepth = 70.0; 123 | vec3 pos = vec3(0,0,0); 124 | float density = 0.0; 125 | // ray marching time 126 | for (int i = 0; i < 37; i++) // This is the count of how many times the ray actually marches. 127 | { 128 | if ((t > maxDepth)) break; 129 | pos = camPos + relVec * t; 130 | float temp = Density(pos); 131 | //temp *= saturate(t-1.0); 132 | 133 | inc = 1.9 + temp*0.05; // add temp because this makes it look extra crazy! 134 | density += temp * inc; 135 | t += inc; 136 | } 137 | 138 | // -------------------------------------------------------------------------------- 139 | // Now that we have done our ray marching, let's put some color on this. 140 | vec3 finalColor = vec3(0.01,0.1,1.0)* density*0.2; 141 | 142 | // output the final color with sqrt for "gamma correction" 143 | gl_FragColor = vec4(sqrt(clamp(finalColor, 0.0, 1.0)),1.0); 144 | } 145 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4dlGDN_noise_blur.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Noise Blur 3 | // 4 | // https://www.shadertoy.com/view/4dlGDN 5 | // 6 | 7 | 8 | // Created by inigo quilez - iq/2013 9 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 10 | 11 | float hash( float n ) 12 | { 13 | return fract(sin(n)*43758.5453); 14 | } 15 | 16 | float noise( in vec2 x ) 17 | { 18 | vec2 p = floor(x); 19 | vec2 f = fract(x); 20 | f = f*f*(3.0-2.0*f); 21 | float n = p.x + p.y*57.0; 22 | return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); 23 | } 24 | 25 | vec2 map( vec2 p ) 26 | { 27 | p.x += 0.1*sin( iGlobalTime + 2.0*p.y ) ; 28 | p.y += 0.1*sin( iGlobalTime + 2.0*p.x ) ; 29 | 30 | float a = noise(p*1.5 + sin(0.1*iGlobalTime))*6.2831; 31 | a -= iGlobalTime + gl_FragCoord.x/iResolution.x; 32 | return vec2( cos(a), sin(a) ); 33 | } 34 | 35 | void main( void ) 36 | { 37 | vec2 p = gl_FragCoord.xy / iResolution.xy; 38 | vec2 uv = -1.0 + 2.0*p; 39 | uv.x *= iResolution.x / iResolution.y; 40 | 41 | float acc = 0.0; 42 | vec3 col = vec3(0.0); 43 | for( int i=0; i<32; i++ ) { 44 | 45 | vec2 dir = map( uv ); 46 | 47 | float h = float(i)/32.0; 48 | float w = 4.0*h*(1.0-h); 49 | 50 | vec3 ttt = w*texture2D( iChannel0, uv ).xyz; 51 | ttt *= mix( vec3(0.6,0.7,0.7), vec3(1.0,0.95,0.9), 0.5 - 0.5*dot( reflect(vec3(dir,0.0), vec3(1.0,0.0,0.0)).xy, vec2(0.707) ) ); 52 | col += w*ttt; 53 | acc += w; 54 | 55 | uv += 0.008*dir; 56 | } 57 | 58 | col /= acc; 59 | 60 | float gg = dot( col, vec3(0.333) ); 61 | vec3 nor = normalize( vec3( dFdx(gg), 0.5, dFdy(gg) ) ); 62 | col += vec3(0.4)*dot( nor, vec3(0.7,0.01,0.7) ); 63 | 64 | vec2 di = map( uv ); 65 | col *= 0.65 + 0.35*dot( di, vec2(0.707) ); 66 | col *= 0.20 + 0.80*pow( 4.0*p.x*(1.0-p.x), 0.1 ); 67 | col *= 1.7; 68 | 69 | gl_FragColor = vec4( col, 1.0 ); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4sBXRc_texture_swirl.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Texture Swirl 3 | // 4 | // https://www.shadertoy.com/view/4sBXRc 5 | // 6 | 7 | // Does not work without a noise image on Channel1 - tex12 8 | // Channel0 is the texture to swirl 9 | // 10 | 11 | float noise( in vec3 x ) // From iq 12 | { 13 | vec3 p = floor(x); 14 | vec3 f = fract(x); 15 | f = f*f*(3.0-2.0*f); 16 | 17 | vec2 uv = (p.xy+vec2(37.0,17.0)*p.z) + f.xy; 18 | vec2 rg = texture2D( iChannel1, (uv+0.5)/256.0, -100.0 ).yx; 19 | return mix( rg.x, rg.y, f.z )*2.0 - 1.0; 20 | } 21 | 22 | vec2 offset(vec2 p, float phase) { 23 | return vec2(noise(vec3(p.xy*10.0+iGlobalTime*0.25,phase)), 24 | noise(vec3(p.yx*10.0+iGlobalTime*0.25,phase)))*0.02; 25 | } 26 | 27 | void main(void) 28 | { 29 | vec2 p = gl_FragCoord.xy / iResolution.xy * vec2(1, -1); 30 | p.x *= iResolution.x / iResolution.y; 31 | vec4 color = vec4(1); 32 | for (int i = 0; i < 3; i++) { 33 | float phase = float(i)/3.0; 34 | vec4 s1 = texture2D(iChannel0, p + offset(p, fract(phase))); 35 | vec4 s2 = texture2D(iChannel0, p + offset(p, fract(phase+0.5))); 36 | color += mix(s1, s2, abs(mod(phase*2.0, 2.0)-1.0))*color*color; 37 | } 38 | gl_FragColor = (color)/15.0; 39 | } 40 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4sf3Rn_planet.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Planet 3 | // 4 | // https://www.shadertoy.com/view/4sf3Rn 5 | // 6 | 7 | // Created by inigo quilez - iq/2013 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | // Needs a texture image on channel0 - tex06 11 | vec3 doit( in vec2 pix ) 12 | { 13 | vec2 p = -1.0 + 2.0*pix; 14 | p.x *= iResolution.x/iResolution.y; 15 | 16 | vec3 ro = vec3( 0.0, 0.0, 2.5 ); 17 | vec3 rd = normalize( vec3( p, -2.0 ) ); 18 | 19 | vec3 col = vec3(0.1); 20 | 21 | // intersect sphere 22 | float b = dot(ro,rd); 23 | float c = dot(ro,ro) - 1.0; 24 | float h = b*b - c; 25 | if( h>0.0 ) 26 | { 27 | float t = -b - sqrt(h); 28 | vec3 pos = ro + t*rd; 29 | vec3 nor = pos; 30 | 31 | // texture mapping 32 | vec2 uv; 33 | uv.x = atan(nor.x,nor.z)/6.2831 - 0.03*iGlobalTime - iMouse.x/iResolution.x; 34 | uv.y = acos(nor.y)/3.1416; 35 | uv.y *= 0.5; 36 | col = texture2D( iChannel0, uv ).xyz; 37 | 38 | float o = smoothstep( 0.3,0.4,col.x); 39 | col = mix( vec3(0.2,0.3,0.4), col, o ); 40 | 41 | // lighting 42 | col *= 0.1 + 0.9*max(nor.x*2.0+nor.z,0.0); 43 | } 44 | else 45 | { 46 | c = dot(ro,ro) - 10.0; 47 | h = b*b - c; 48 | float t = -b - sqrt(h); 49 | vec3 pos = ro + t*rd; 50 | vec3 nor = pos; 51 | 52 | vec2 uv; 53 | uv.x = 16.0*atan(nor.x,nor.z)/6.2831 - 0.05*iGlobalTime - iMouse.x/iResolution.x; 54 | uv.y = 2.0*acos(nor.y)/3.1416; 55 | col = texture2D( iChannel0, uv, 1.0 ).xyz; 56 | col = col*col; col = col*col; col = col*col; 57 | col *= 0.7; 58 | vec3 sta = texture2D( iChannel0, 0.5*uv, 5.0 ).xyz; 59 | sta = sta*sta; 60 | col += sta*0.1; 61 | 62 | } 63 | 64 | col = 0.5*(col+sqrt(col)); 65 | return col; 66 | } 67 | 68 | void main(void) 69 | { 70 | // render this with four sampels per pixel 71 | vec3 col0 = doit( (gl_FragCoord.xy+vec2(0.0,0.0) )/iResolution.xy ); 72 | vec3 col1 = doit( (gl_FragCoord.xy+vec2(0.5,0.0) )/iResolution.xy ); 73 | vec3 col2 = doit( (gl_FragCoord.xy+vec2(0.0,0.5) )/iResolution.xy ); 74 | vec3 col3 = doit( (gl_FragCoord.xy+vec2(0.5,0.5) )/iResolution.xy ); 75 | vec3 col = 0.25*(col0 + col1 + col2 + col3); 76 | 77 | gl_FragColor = vec4(col,1.0); 78 | } 79 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4sl3Dr_digital_brain.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/4sl3Dr 3 | // 4 | 5 | // 6 | // Digital Brain 7 | // 8 | // 9 | // by srtuss, 2013 10 | // was trying to find some sort of "mechanical" fractal for texture/heightmap 11 | // generation, but then i ended up with this. 12 | 13 | // rotate position around axis 14 | vec2 rotate(vec2 p, float a) 15 | { 16 | return vec2(p.x * cos(a) - p.y * sin(a), p.x * sin(a) + p.y * cos(a)); 17 | } 18 | 19 | // 1D random numbers 20 | float rand(float n) 21 | { 22 | return fract(sin(n) * 43758.5453123); 23 | } 24 | 25 | // 2D random numbers 26 | vec2 rand2(in vec2 p) 27 | { 28 | return fract(vec2(sin(p.x * 591.32 + p.y * 154.077), cos(p.x * 391.32 + p.y * 49.077))); 29 | } 30 | 31 | // 1D noise 32 | float noise1(float p) 33 | { 34 | float fl = floor(p); 35 | float fc = fract(p); 36 | return mix(rand(fl), rand(fl + 1.0), fc); 37 | } 38 | 39 | // voronoi distance noise, based on iq's articles 40 | float voronoi(in vec2 x) 41 | { 42 | vec2 p = floor(x); 43 | vec2 f = fract(x); 44 | 45 | vec2 res = vec2(8.0); 46 | for(int j = -1; j <= 1; j ++) 47 | { 48 | for(int i = -1; i <= 1; i ++) 49 | { 50 | vec2 b = vec2(i, j); 51 | vec2 r = vec2(b) - f + rand2(p + b); 52 | 53 | // chebyshev distance, one of many ways to do this 54 | float d = max(abs(r.x), abs(r.y)); 55 | 56 | if(d < res.x) 57 | { 58 | res.y = res.x; 59 | res.x = d; 60 | } 61 | else if(d < res.y) 62 | { 63 | res.y = d; 64 | } 65 | } 66 | } 67 | return res.y - res.x; 68 | } 69 | 70 | 71 | float flicker = noise1(iGlobalTime * 2.0) * 0.8 + 0.4; 72 | 73 | void main(void) 74 | { 75 | vec2 uv = gl_FragCoord.xy / iResolution.xy; 76 | uv = (uv - 0.5) * 2.0; 77 | vec2 suv = uv; 78 | uv.x *= iResolution.x / iResolution.y; 79 | 80 | 81 | float v = 0.0; 82 | 83 | // that looks highly interesting: 84 | //v = 1.0 - length(uv) * 1.3; 85 | 86 | 87 | // a bit of camera movement 88 | uv *= 0.6 + sin(iGlobalTime * 0.1) * 0.4; 89 | uv = rotate(uv, sin(iGlobalTime * 0.3) * 1.0); 90 | uv += iGlobalTime * 0.4; 91 | 92 | 93 | // add some noise octaves 94 | float a = 0.6, f = 1.0; 95 | 96 | for(int i = 0; i < 3; i ++) // 4 octaves also look nice, its getting a bit slow though 97 | { 98 | float v1 = voronoi(uv * f + 5.0); 99 | float v2 = 0.0; 100 | 101 | // make the moving electrons-effect for higher octaves 102 | if(i > 0) 103 | { 104 | // of course everything based on voronoi 105 | v2 = voronoi(uv * f * 0.5 + 50.0 + iGlobalTime); 106 | 107 | float va = 0.0, vb = 0.0; 108 | va = 1.0 - smoothstep(0.0, 0.1, v1); 109 | vb = 1.0 - smoothstep(0.0, 0.08, v2); 110 | v += a * pow(va * (0.5 + vb), 2.0); 111 | } 112 | 113 | // make sharp edges 114 | v1 = 1.0 - smoothstep(0.0, 0.3, v1); 115 | 116 | // noise is used as intensity map 117 | v2 = a * (noise1(v1 * 5.5 + 0.1)); 118 | 119 | // octave 0's intensity changes a bit 120 | if(i == 0) 121 | v += v2 * flicker; 122 | else 123 | v += v2; 124 | 125 | f *= 3.0; 126 | a *= 0.7; 127 | } 128 | 129 | // slight vignetting 130 | v *= exp(-0.6 * length(suv)) * 1.2; 131 | 132 | // use texture channel0 for color? why not. 133 | vec3 cexp = texture2D(iChannel0, uv * 0.001).xyz * 3.0 + texture2D(iChannel0, uv * 0.01).xyz;//vec3(1.0, 2.0, 4.0); 134 | cexp *= 1.4; 135 | 136 | // old blueish color set 137 | //vec3 cexp = vec3(6.0, 4.0, 2.0); 138 | 139 | vec3 col = vec3(pow(v, cexp.x), pow(v, cexp.y), pow(v, cexp.z)) * 2.0; 140 | 141 | gl_FragColor = vec4(col, 1.0); 142 | } 143 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-4slSzj_glass-polyhedron.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Glass polyhedron - by Nrx 3 | // 4 | // https://www.shadertoy.com/view/4slSzj 5 | // 6 | // Forked from: https://www.shadertoy.com/view/ldfXzn 7 | 8 | #ifdef GL_ES 9 | precision highp float; 10 | #endif 11 | 12 | #define DELTA 0.001 13 | #define RAY_COUNT 7 14 | #define RAY_LENGTH_MAX 100.0 15 | #define RAY_STEP_MAX 100 16 | #define LIGHT vec3 (1.0, 1.0, -1.0) 17 | #define REFRACT_FACTOR 0.6 18 | #define REFRACT_INDEX 1.6 19 | #define AMBIENT 0.2 20 | #define SPECULAR_POWER 3.0 21 | #define SPECULAR_INTENSITY 0.5 22 | #define FADE_POWER 1.0 23 | #define M_PI 3.1415926535897932384626433832795 24 | #define GLOW_FACTOR 1.5 25 | #define LUMINOSITY_FACTOR 2.0 26 | 27 | mat3 mRotate (in vec3 angle) { 28 | float c = cos (angle.x); 29 | float s = sin (angle.x); 30 | mat3 rx = mat3 (1.0, 0.0, 0.0, 0.0, c, s, 0.0, -s, c); 31 | 32 | c = cos (angle.y); 33 | s = sin (angle.y); 34 | mat3 ry = mat3 (c, 0.0, -s, 0.0, 1.0, 0.0, s, 0.0, c); 35 | 36 | c = cos (angle.z); 37 | s = sin (angle.z); 38 | mat3 rz = mat3 (c, s, 0.0, -s, c, 0.0, 0.0, 0.0, 1.0); 39 | 40 | return rz * ry * rx; 41 | } 42 | 43 | vec3 k; 44 | float getDistance (in vec3 p) { 45 | float repeat = 20.0; 46 | vec3 q = p + repeat * 0.5; 47 | k = floor (q / repeat); 48 | q -= repeat * (k + 0.5); 49 | p = mRotate (k) * q; 50 | 51 | float top = p.y - 3.0; 52 | float angleStep = M_PI / max (2.0, abs (k.x + 2.0 * k.y + 4.0 * k.z)); 53 | float angle = angleStep * (0.5 + floor (atan (p.x, p.z) / angleStep)); 54 | float side = cos (angle) * p.z + sin (angle) * p.x - 2.0; 55 | float bottom = -p.y - 3.0; 56 | 57 | return max (top, max (side, bottom)); 58 | } 59 | 60 | vec3 getFragmentColor (in vec3 origin, in vec3 direction) { 61 | vec3 lightDirection = normalize (LIGHT); 62 | vec2 delta = vec2 (DELTA, 0.0); 63 | 64 | vec3 fragColor = vec3 (0.0, 0.0, 0.0); 65 | float intensity = 1.0; 66 | 67 | float distanceFactor = 1.0; 68 | float refractionRatio = 1.0 / REFRACT_INDEX; 69 | float rayStepCount = 0.0; 70 | for (int rayIndex = 0; rayIndex < RAY_COUNT; ++rayIndex) { 71 | 72 | // Ray marching 73 | float dist = RAY_LENGTH_MAX; 74 | float rayLength = 0.0; 75 | for (int rayStep = 0; rayStep < RAY_STEP_MAX; ++rayStep) { 76 | dist = distanceFactor * getDistance (origin); 77 | float distMin = max (dist, DELTA); 78 | rayLength += distMin; 79 | if (dist < 0.0 || rayLength > RAY_LENGTH_MAX) { 80 | break; 81 | } 82 | origin += direction * distMin; 83 | ++rayStepCount; 84 | } 85 | 86 | // Check whether we hit something 87 | vec3 backColor = vec3 (0.0, 0.0, 0.1 + 0.2 * max (0.0, dot (-direction, lightDirection))); 88 | if (dist >= 0.0) { 89 | fragColor = fragColor * (1.0 - intensity) + backColor * intensity; 90 | break; 91 | } 92 | 93 | // Get the normal 94 | vec3 normal = normalize (distanceFactor * vec3 ( 95 | getDistance (origin + delta.xyy) - getDistance (origin - delta.xyy), 96 | getDistance (origin + delta.yxy) - getDistance (origin - delta.yxy), 97 | getDistance (origin + delta.yyx) - getDistance (origin - delta.yyx))); 98 | 99 | // Basic lighting 100 | vec3 reflection = reflect (direction, normal); 101 | if (distanceFactor > 0.0) { 102 | float relfectionDiffuse = max (0.0, dot (normal, lightDirection)); 103 | float relfectionSpecular = pow (max (0.0, dot (reflection, lightDirection)), SPECULAR_POWER) * SPECULAR_INTENSITY; 104 | float fade = pow (1.0 - rayLength / RAY_LENGTH_MAX, FADE_POWER); 105 | 106 | vec3 localColor = max (sin (k * k), 0.2); 107 | localColor = (AMBIENT + relfectionDiffuse) * localColor + relfectionSpecular; 108 | localColor = mix (backColor, localColor, fade); 109 | 110 | fragColor = fragColor * (1.0 - intensity) + localColor * intensity; 111 | intensity *= REFRACT_FACTOR; 112 | } 113 | 114 | // Next ray... 115 | vec3 refraction = refract (direction, normal, refractionRatio); 116 | if (dot (refraction, refraction) < DELTA) { 117 | direction = reflection; 118 | origin += direction * DELTA * 2.0; 119 | } 120 | else { 121 | direction = refraction; 122 | distanceFactor = -distanceFactor; 123 | refractionRatio = 1.0 / refractionRatio; 124 | } 125 | } 126 | 127 | // Return the fragment color 128 | return fragColor * LUMINOSITY_FACTOR + GLOW_FACTOR * rayStepCount / float (RAY_STEP_MAX * RAY_COUNT); 129 | } 130 | 131 | void main () { 132 | 133 | // Define the ray corresponding to this fragment 134 | vec2 frag = (2.0 * gl_FragCoord.xy - iResolution.xy) / iResolution.y; 135 | vec3 direction = normalize (vec3 (frag, 2.0)); 136 | 137 | // Set the camera 138 | vec3 origin = vec3 ((15.0 * cos (iGlobalTime * 0.1)), 10.0 * sin (iGlobalTime * 0.2), 15.0 * sin (iGlobalTime * 0.1)); 139 | vec3 forward = -origin; 140 | vec3 up = vec3 (sin (iGlobalTime * 0.3), 2.0, 0.0); 141 | mat3 rotation; 142 | rotation [2] = normalize (forward); 143 | rotation [0] = normalize (cross (up, forward)); 144 | rotation [1] = cross (rotation [2], rotation [0]); 145 | direction = rotation * direction; 146 | 147 | // Set the fragment color 148 | gl_FragColor = vec4 (getFragmentColor (origin, direction), 1.0); 149 | } 150 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-Md2GRc_fractal_lines.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/Md2GRc 3 | // 4 | 5 | // Fractal Lines of Symmetry - by gleruop 6 | // 7 | 8 | vec3 hsv(in float h, in float s, in float v) 9 | { 10 | return mix(vec3(1.0), clamp((abs(fract(h + vec3(3, 2, 1) / 3.0) * 6.0 - 3.0) - 1.0), 0.0 , 1.0), s) * v; 11 | } 12 | 13 | vec3 formula(in vec2 p, in vec2 c) 14 | { 15 | const float n = 2.0; 16 | const int iters = 12; 17 | 18 | float time = iGlobalTime*0.1; 19 | vec3 col = vec3(0); 20 | float t = 1.0; 21 | float dpp = dot(p, p); 22 | float lp = sqrt(dpp); 23 | float r = smoothstep(0.0, 0.2, lp); 24 | 25 | for (int i = 0; i < iters; i++) { 26 | // The transformation 27 | p = abs(mod(p/dpp + c, n) - n/2.0); 28 | 29 | dpp = dot(p, p); 30 | lp = sqrt(dpp); 31 | 32 | //Shade the lines of symmetry black 33 | #if 0 34 | // Get constant width lines with fwidth() 35 | float nd = fwidth(dpp); 36 | float md = fwidth(lp); 37 | t *= smoothstep(0.0, 0.5, abs((n/2.0-p.x)/nd*n)) 38 | * smoothstep(0.0, 0.5, abs((n/2.0-p.y)/nd*n)) 39 | * smoothstep(0.0, 0.5, abs(p.x/md)) 40 | * smoothstep(0.0, 0.5, abs(p.y/md)); 41 | #else 42 | // Variable width lines 43 | t *= smoothstep(0.0, 0.01, abs(n/2.0-p.x)*lp) 44 | * smoothstep(0.0, 0.01, abs(n/2.0-p.y)*lp) 45 | * smoothstep(0.0, 0.01, abs(p.x)*2.0) 46 | * smoothstep(0.0, 0.01, abs(p.y)*2.0); 47 | #endif 48 | 49 | // Fade out the high density areas, they just look like noise 50 | r *= smoothstep(0.0, 0.2, lp); 51 | 52 | // Add to colour using hsv 53 | col += hsv(1.0 - max(p.x, p.y) + t*2.0 + time, 2.0-lp+t, r); 54 | 55 | } 56 | 57 | return (-cos(col/4.0)*0.5 + 0.5)*(t); 58 | } 59 | 60 | void main() { 61 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / iResolution.xy; 62 | p.x *= iResolution.x / iResolution.y; 63 | p *= 2.0; 64 | const vec2 e = vec2(0.06545465634, -0.05346356485); 65 | vec2 c = iGlobalTime*e; 66 | //c = 8.0*iMouse.xy/iResolution.xy; 67 | float d = 1.0; 68 | vec3 col = vec3(0.0); 69 | const float blursamples = 4.0; 70 | float sbs = sqrt(blursamples); 71 | float mbluramount = 1.0/iResolution.x/length(e)/blursamples*2.0; 72 | float aabluramount = 1.0/iResolution.x/sbs*4.0; 73 | for (float b = 0.0; b < blursamples; b++) { 74 | col += formula( 75 | p + vec2(mod(b, sbs)*aabluramount, b/sbs*aabluramount), 76 | c + e*mbluramount*b); 77 | } 78 | col /= blursamples; 79 | gl_FragColor = vec4(col, 1.0); 80 | } 81 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-MdBSDt_bacterium.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Shaders/More shaders/ShaderToy-MdBSDt_bacterium.txt -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-MdX3zr_flame.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/MdX3zr 3 | // 4 | 5 | // flame - by xt95 6 | 7 | 8 | float noise(vec3 p) //Thx to Las^Mercury 9 | { 10 | vec3 i = floor(p); 11 | vec4 a = dot(i, vec3(1., 57., 21.)) + vec4(0., 57., 21., 78.); 12 | vec3 f = cos((p-i)*acos(-1.))*(-.5)+.5; 13 | a = mix(sin(cos(a)*a),sin(cos(1.+a)*(1.+a)), f.x); 14 | a.xy = mix(a.xz, a.yw, f.y); 15 | return mix(a.x, a.y, f.z); 16 | } 17 | 18 | float sphere(vec3 p, vec4 spr) 19 | { 20 | return length(spr.xyz-p) - spr.w; 21 | } 22 | 23 | float flame(vec3 p) 24 | { 25 | float d = sphere(p*vec3(1.,.5,1.), vec4(.0,-1.,.0,1.)); 26 | return d + (noise(p+vec3(.0,iGlobalTime*2.,.0)) + noise(p*3.)*.5)*.25*(p.y) ; 27 | } 28 | 29 | float scene(vec3 p) 30 | { 31 | return min(100.-length(p) , abs(flame(p)) ); 32 | } 33 | 34 | vec4 raymarch(vec3 org, vec3 dir) 35 | { 36 | float d = 0.0, glow = 0.0, eps = 0.02; 37 | vec3 p = org; 38 | bool glowed = false; 39 | 40 | for(int i=0; i<64; i++) 41 | { 42 | d = scene(p) + eps; 43 | p += d * dir; 44 | if( d>eps ) 45 | { 46 | if(flame(p) < .0) 47 | glowed=true; 48 | if(glowed) 49 | glow = float(i)/64.; 50 | } 51 | } 52 | return vec4(p,glow); 53 | } 54 | 55 | void main() 56 | { 57 | vec2 v = -1.0 + 2.0 * gl_FragCoord.xy / iResolution.xy; 58 | v.x *= iResolution.x/iResolution.y; 59 | 60 | vec3 org = vec3(0., -2., 4.); 61 | vec3 dir = normalize(vec3(v.x*1.6, -v.y, -1.5)); 62 | 63 | vec4 p = raymarch(org, dir); 64 | float glow = p.w; 65 | 66 | vec4 col = mix(vec4(1.,.5,.1,1.), vec4(0.1,.5,1.,1.), p.y*.02+.4); 67 | 68 | gl_FragColor = mix(vec4(0.), col, pow(glow*2.,4.)); 69 | //gl_FragColor = mix(vec4(1.), mix(vec4(1.,.5,.1,1.),vec4(0.1,.5,1.,1.),p.y*.02+.4), pow(glow*2.,4.)); 70 | 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-MdXGDH_old_school_plasma.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/MdXGDH 3 | // 4 | 5 | // 6 | // Old School Plasma - by TriggerHLM 7 | // 8 | // 9 | const float PI = 3.14159265; 10 | 11 | float time = iGlobalTime *0.2; 12 | 13 | void main(void ) { 14 | 15 | float color1, color2, color; 16 | 17 | color1 = (sin(dot(gl_FragCoord.xy,vec2(sin(time*3.0),cos(time*3.0)))*0.02+time*3.0)+1.0)/2.0; 18 | 19 | vec2 center = vec2(640.0/2.0, 360.0/2.0) + vec2(640.0/2.0*sin(-time*3.0),360.0/2.0*cos(-time*3.0)); 20 | 21 | color2 = (cos(length(gl_FragCoord.xy - center)*0.03)+1.0)/2.0; 22 | 23 | color = (color1+ color2)/2.0; 24 | 25 | float red = (cos(PI*color/0.5+time*3.0)+1.0)/2.0; 26 | float green = (sin(PI*color/0.5+time*3.0)+1.0)/2.0; 27 | float blue = (sin(+time*3.0)+1.0)/2.0; 28 | 29 | gl_FragColor = vec4(red, green, blue, 1.0); 30 | } 31 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-MdfSzn_metatunnel.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/MdfSzn 3 | // 4 | 5 | // 6 | // MetaTunnel 7 | // 8 | 9 | 10 | // Created by anatole duprat - XT95/2014 11 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 12 | 13 | 14 | // http://www.pouet.net/prod.php?which=52777 15 | 16 | float time = iGlobalTime*.5; 17 | 18 | const float s=0.4; //Density threshold 19 | 20 | 21 | //The scene define by density 22 | float obj(vec3 p) 23 | { 24 | float d = 1.0; 25 | d *= distance(p, vec3(cos(time)+sin(time*0.2),0.3,2.0+cos(time*0.5)*0.5) ); 26 | d = distance(p,vec3(-cos(time*0.7),0.3,2.0+sin(time*0.5))); 27 | d *= distance(p,vec3(-sin(time*0.2)*0.5,sin(time),2.0)); 28 | d *=cos(p.y)*cos(p.x)-0.1-cos(p.z*7.+time*7.)*cos(p.x*3.)*cos(p.y*4.)*0.1; 29 | return d; 30 | } 31 | 32 | 33 | 34 | void main() 35 | { 36 | vec2 q = gl_FragCoord.xy/iResolution.xy; 37 | vec2 v = -1.0+2.0*q; 38 | v.x *= iResolution.x/iResolution.y*.5+.5; 39 | 40 | vec3 o = vec3(v.x,v.y,0.0); 41 | vec3 d = normalize(vec3(v.x+cos(time)*.3,v.y,1.0))/64.0; 42 | 43 | vec3 color = vec3(0.0); 44 | float t = 0.0; 45 | bool hit = false; 46 | 47 | for(int i=0; i<100; i++) 48 | { 49 | if(!hit) 50 | { 51 | if(obj(o+d*t) < s) 52 | { 53 | t-=5.0; 54 | for(int j=0; j<5; j++) 55 | if(obj(o+d*t) > s) 56 | t+=1.0; 57 | 58 | vec3 e=vec3(0.01,.0,.0); 59 | vec3 n=vec3(0.0); 60 | n.x=obj(o+d*t)-obj(vec3(o+d*t+e.xyy)); 61 | n.y=obj(o+d*t)-obj(vec3(o+d*t+e.yxy)); 62 | n.z=obj(o+d*t)-obj(vec3(o+d*t+e.yyx)); 63 | n = normalize(n); 64 | 65 | color = vec3(1.) * max(dot(vec3(0.0,0.0,-0.5),n),0.0)+max(dot(vec3(0.0,-0.5,0.5),n),0.0)*0.5; 66 | hit=true; 67 | } 68 | 69 | t+=5.0; 70 | } 71 | } 72 | gl_FragColor= vec4(color,1.)+vec4(0.1,0.2,0.5,1.0)*(t*0.025); 73 | } 74 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-Mds3Rn_road_to_hell.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/Mds3Rn 3 | // 4 | 5 | // The road to Hell 6 | // 7 | const float PI=3.14159265358979323846; 8 | 9 | float speed=iGlobalTime*0.2975; 10 | float ground_x=1.0-0.325*sin(PI*speed*0.25); 11 | float ground_y=1.0; 12 | float ground_z=0.5; 13 | 14 | vec2 rotate(vec2 k,float t) 15 | { 16 | return vec2(cos(t)*k.x-sin(t)*k.y,sin(t)*k.x+cos(t)*k.y); 17 | } 18 | 19 | float draw_scene(vec3 p) 20 | { 21 | float tunnel_m=0.125*cos(PI*p.z*1.0+speed*4.0-PI); 22 | float tunnel1_p=2.0; 23 | float tunnel1_w=tunnel1_p*0.225; 24 | float tunnel1=length(mod(p.xy,tunnel1_p)-tunnel1_p*0.5)-tunnel1_w; // tunnel1 25 | float tunnel2_p=2.0; 26 | float tunnel2_w=tunnel2_p*0.2125+tunnel2_p*0.0125*cos(PI*p.y*8.0)+tunnel2_p*0.0125*cos(PI*p.z*8.0); 27 | float tunnel2=length(mod(p.xy,tunnel2_p)-tunnel2_p*0.5)-tunnel2_w; // tunnel2 28 | float hole1_p=1.0; 29 | float hole1_w=hole1_p*0.5; 30 | float hole1=length(mod(p.xz,hole1_p).xy-hole1_p*0.5)-hole1_w; // hole1 31 | float hole2_p=0.25; 32 | float hole2_w=hole2_p*0.375; 33 | float hole2=length(mod(p.yz,hole2_p).xy-hole2_p*0.5)-hole2_w; // hole2 34 | float hole3_p=0.5; 35 | float hole3_w=hole3_p*0.25+0.125*sin(PI*p.z*2.0); 36 | float hole3=length(mod(p.xy,hole3_p).xy-hole3_p*0.5)-hole3_w; // hole3 37 | float tube_m=0.075*sin(PI*p.z*1.0); 38 | float tube_p=0.5+tube_m; 39 | float tube_w=tube_p*0.025+0.00125*cos(PI*p.z*128.0); 40 | float tube=length(mod(p.xy,tube_p)-tube_p*0.5)-tube_w; // tube 41 | float bubble_p=0.05; 42 | float bubble_w=bubble_p*0.5+0.025*cos(PI*p.z*2.0); 43 | float bubble=length(mod(p.yz,bubble_p)-bubble_p*0.5)-bubble_w; // bubble 44 | return max(min(min(-tunnel1,mix(tunnel2,-bubble,0.375)),max(min(-hole1,hole2),-hole3)),-tube); 45 | } 46 | 47 | void main(void) 48 | { 49 | vec2 position=(gl_FragCoord.xy/iResolution.xy); 50 | vec2 p=-1.0+2.0*position; 51 | vec3 dir=normalize(vec3(p*vec2(1.77,1.0),1.0)); // screen ratio (x,y) fov (z) 52 | //dir.yz=rotate(dir.yz,PI*0.5*sin(PI*speed*0.125)); // rotation x 53 | dir.zx=rotate(dir.zx,-PI*speed*0.25); // rotation y 54 | dir.xy=rotate(dir.xy,-speed*0.5); // rotation z 55 | vec3 ray=vec3(ground_x,ground_y,ground_z-speed*2.5); 56 | float t=0.0; 57 | const int ray_n=96; 58 | for(int i=0;i 0.99 ) continue; 122 | vec3 pos = ro + t*rd; 123 | vec4 col = map( pos ); 124 | 125 | col.a *= 0.5; 126 | col.rgb = mix( bg, col.rgb, exp(-0.002*t*t*t) ) * col.a; 127 | 128 | sum = sum + col*(1.0 - sum.a); 129 | 130 | t += 0.05; 131 | } 132 | 133 | vec3 col = clamp( mix( bg, sum.xyz/(0.001+sum.w), sum.w ), 0.0, 1.0 ); 134 | 135 | //-------------------------------------- 136 | // contrast + vignetting 137 | //-------------------------------------- 138 | col = col*col*(3.0-2.0*col)*1.4 - 0.4; 139 | 140 | col *= 0.25 + 0.75*pow( 16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y), 0.1 ); 141 | 142 | gl_FragColor = vec4( col, 1.0 ); 143 | } 144 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-MsXGz8_isolines.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // https://www.shadertoy.com/view/MsXGz8 4 | // 5 | // Isolines 6 | // 7 | 8 | // LJ does not work 9 | 10 | // Created by inigo quilez - iq/2013 11 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 12 | 13 | vec2 doit( in vec2 p, in float off, float amp ) 14 | { 15 | float f = 0.0; 16 | float a = 0.0; 17 | 18 | for( int i=0; i<10; i++ ) { 19 | 20 | float h = float(i)/10.0; 21 | float g = texture2D( iChannel1, vec2(0.01+h*0.5, 0.25)).x; 22 | float k = 1.0 + 0.4*g*g; 23 | 24 | vec2 q; 25 | q.x = sin(iGlobalTime*0.015+0.67*g*(1.0+amp) + off + float(i)*121.45) * 0.5 + 0.5; 26 | q.y = cos(iGlobalTime*0.016+0.63*g*(1.0+amp) + off + float(i)*134.76) * 0.5 + 0.5; 27 | vec2 d = p - q; 28 | float at = 1.0/(0.01+dot(d,d)); 29 | f += k*0.1*at; 30 | a += 0.5 + 0.5*sin(2.0*atan(d.y,d.x));//*at; 31 | } 32 | 33 | return vec2(f,a); 34 | } 35 | 36 | void main(void) 37 | { 38 | vec2 p = gl_FragCoord.xy / iResolution.xy; 39 | 40 | float ChannelTime = iGlobalTime; // LJ 41 | 42 | // float isTripy = smoothstep( 86.5, 87.5, iChannelTime[1] ) - smoothstep( 100.5, 108.0, iChannelTime[1] ); 43 | float isTripy = smoothstep( 86.5, 87.5, ChannelTime ) - smoothstep( 100.5, 108.0, ChannelTime ); 44 | 45 | vec2 ref = doit( p, 0.0, isTripy ); 46 | float b = ref.x; 47 | 48 | 49 | vec3 col = texture2D( iChannel0, vec2(pow(0.25*ref.x,0.25), 0.5)).xyz * texture2D( iChannel0, vec2(0.1*pow(ref.y,1.2), 0.6)).xyz; 50 | col = sqrt(col)*2.0; 51 | 52 | vec3 col2 = col; 53 | col2 = 4.0*col2*(1.0-col2); 54 | col2 = 4.0*col2*(1.0-col2); 55 | col2 = 4.0*col2*(1.0-col2); 56 | 57 | col = mix( col, col2, isTripy ); 58 | 59 | // float useLights = 0.5 + 1.5*smoothstep( 45.0, 45.2, iChannelTime[1] ); 60 | float useLights = 0.5 + 1.5*smoothstep( 45.0, 45.2, ChannelTime ); 61 | 62 | col += useLights*0.5*pow( b*0.1, 4.0 ) * pow( texture2D( iChannel1, vec2(0.1,0.25) ).x, 2.0 ); 63 | 64 | gl_FragColor = vec4( col, 1.0 );; 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-Msl3WH_warp_speed.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/Msl3WH 3 | // 4 | 5 | // 6 | // 7 | // 'Warp Speed' by David Hoskins 2013. 8 | // Adapted it from here:- https://www.shadertoy.com/view/MssGD8 9 | // I tried to find gaps and variation in the star cloud for a feeling of structure. 10 | // 11 | 12 | float time = (iGlobalTime+29.) * 60.0; 13 | void main(void) 14 | { 15 | float s = 0.0, v = 0.0; 16 | vec2 uv = (gl_FragCoord.xy / iResolution.xy) * 2.0 - 1.0; 17 | float t = time*0.005; 18 | uv.x = (uv.x * iResolution.x / iResolution.y) + sin(t) * 0.5; 19 | float si = sin(t + 2.17); // ...Squiffy rotation matrix! 20 | float co = cos(t); 21 | uv *= mat2(co, si, -si, co); 22 | vec3 col = vec3(0.0); 23 | vec3 init = vec3(0.25, 0.25 + sin(time * 0.001) * 0.4, floor(time) * 0.0008); 24 | for (int r = 0; r < 100; r++) 25 | { 26 | vec3 p = init + s * vec3(uv, 0.143); 27 | p.z = mod(p.z, 2.0); 28 | for (int i=0; i < 10; i++) p = abs(p * 2.04) / dot(p, p) - 0.75; 29 | v += length(p * p) * smoothstep(0.0, 0.5, 0.9 - s) * .002; 30 | // Get a purple and cyan effect by biasing the RGB in different ways... 31 | col += vec3(v * 0.8, 1.1 - s * 0.5, .7 + v * 0.5) * v * 0.013; 32 | s += .01; 33 | } 34 | gl_FragColor = vec4(col, 1.0); 35 | } 36 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-MssGW4_iterations_guts.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Iterations Guts 3 | // 4 | // https://www.shadertoy.com/view/MssGW4 5 | // 6 | 7 | // Channel0 texture - tex09 8 | 9 | // Created by inigo quilez - iq/2013 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | //#define PROCEDURAL 13 | 14 | float hash( float n ) 15 | { 16 | return fract(sin(n)*43758.5453); 17 | } 18 | 19 | float noise( in vec2 x ) 20 | { 21 | vec2 p = floor(x); 22 | vec2 f = fract(x); 23 | f = f*f*(3.0-2.0*f); 24 | float n = p.x + p.y*57.0; 25 | return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); 26 | } 27 | 28 | const mat2 ma = mat2( 0.8, -0.6, 0.6, 0.8 ); 29 | 30 | vec2 map( vec2 p ) 31 | { 32 | float a = 0.7*noise(p)*6.2831*6.0; 33 | p = ma*p*3.0; 34 | 35 | a += 0.3*noise(p)*6.2831*6.0; 36 | 37 | a += 0.2*iGlobalTime; 38 | 39 | return vec2( cos(a), sin(a) ); 40 | } 41 | 42 | vec3 texture( in vec2 p ) 43 | { 44 | float f = 0.0; 45 | 46 | vec2 q = p; 47 | 48 | p *= 32.0; 49 | f += 0.500*noise( p ); p = ma*p*2.02; 50 | f += 0.250*noise( p ); p = ma*p*2.03; 51 | f += 0.125*noise( p ); p = ma*p*2.01; 52 | f /= 0.875; 53 | 54 | vec3 col = 0.53 + 0.47*sin( f*4.5 + vec3(0.0,0.65,1.1) + 0.6 ); 55 | 56 | col *= 0.7*clamp( 1.65*noise( 16.0*q.yx ), 0.0, 1.0 ); 57 | 58 | return col; 59 | 60 | } 61 | 62 | void main( void ) 63 | { 64 | vec2 p = gl_FragCoord.xy / iResolution.xy; 65 | vec2 uv = -1.0 + 2.0*p; 66 | uv.x *= iResolution.x / iResolution.y; 67 | vec2 or = uv; 68 | 69 | float acc = 0.0; 70 | vec3 col = vec3(0.0); 71 | for( int i=0; i<64; i++ ) 72 | { 73 | vec2 dir = map( uv ); 74 | 75 | float h = float(i)/64.0; 76 | float w = 1.0-h; 77 | #ifdef PROCEDURAL 78 | vec3 ttt = w*texture(0.5*uv ); 79 | #else 80 | vec3 ttt = w*texture2D( iChannel0, 0.5*uv ).xyz; 81 | #endif 82 | ttt *= mix( 0.8*vec3(0.4,0.55,0.65), vec3(1.0,0.9,0.8), 0.5 + 0.5*dot( dir, -vec2(0.707) ) ); 83 | 84 | col += w*ttt; 85 | acc += w; 86 | 87 | uv += 0.015*dir; 88 | } 89 | col /= acc; 90 | 91 | 92 | float ll = length(uv-or); 93 | vec3 nor = normalize( vec3(dFdx(ll), 4.0/iResolution.x, dFdy(ll) ) ); 94 | 95 | float tex = texture2D(iChannel0,4.0*uv + 4.0*p).x; 96 | vec3 bnor = normalize( vec3(dFdx(tex), 400.0/iResolution.x, dFdy(tex)) ); 97 | nor = normalize( nor + 0.5*normalize(bnor) ); 98 | 99 | vec2 di = map( uv ); 100 | 101 | col *= 0.8 + 0.2*dot( di, -vec2(0.707) ); 102 | col *= 2.5; 103 | col += vec3(1.0,0.5,0.2)*0.15*dot(nor,normalize(vec3(0.8,0.2,-0.8)) ); 104 | col += 0.12*pow(nor.y,16.0); 105 | col += ll*vec3(1.0,0.8,0.6)*col*0.5*(1.0-pow(nor.y,1.0)); 106 | col *= 0.5 + ll; 107 | col *= 0.2 + 0.8*pow( 4.0*p.x*(1.0-p.x), 0.25 ); 108 | 109 | gl_FragColor = vec4( col, 1.0 ); 110 | } 111 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-Xd2GR3_hexagons_distance.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Hexagons Distance 3 | // 4 | // https://www.shadertoy.com/view/Xd2GR3 5 | // 6 | 7 | // Original has a noise image on Channel0 - tex12 8 | 9 | // Created by inigo quilez - iq/2014 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | // { 2d cell id, distance to border, distnace to center ) 13 | vec4 hexagon( vec2 p ) 14 | { 15 | vec2 q = vec2( p.x*2.0*0.5773503, p.y + p.x*0.5773503 ); 16 | 17 | vec2 pi = floor(q); 18 | vec2 pf = fract(q); 19 | 20 | float v = mod(pi.x + pi.y, 3.0); 21 | 22 | float ca = step(1.0,v); 23 | float cb = step(2.0,v); 24 | vec2 ma = step(pf.xy,pf.yx); 25 | 26 | // distance to borders 27 | float e = dot( ma, 1.0-pf.yx + ca*(pf.x+pf.y-1.0) + cb*(pf.yx-2.0*pf.xy) ); 28 | 29 | // distance to center 30 | p = vec2( q.x + floor(0.5+p.y/1.5), 4.0*p.y/3.0 )*0.5 + 0.5; 31 | float f = length( (fract(p) - 0.5)*vec2(1.0,0.85) ); 32 | 33 | return vec4( pi + ca - cb*ma, e, f ); 34 | } 35 | 36 | float hash1( vec2 p ) { float n = dot(p,vec2(127.1,311.7) ); return fract(sin(n)*43758.5453); } 37 | 38 | float noise( in vec3 x ) 39 | { 40 | vec3 p = floor(x); 41 | vec3 f = fract(x); 42 | f = f*f*(3.0-2.0*f); 43 | vec2 uv = (p.xy+vec2(37.0,17.0)*p.z) + f.xy; 44 | vec2 rg = texture2D( iChannel0, (uv+0.5)/256.0, -100.0 ).yx; 45 | return mix( rg.x, rg.y, f.z ); 46 | } 47 | 48 | 49 | void main( void ) 50 | { 51 | vec2 uv = gl_FragCoord.xy/iResolution.xy; 52 | vec2 pos = (-iResolution.xy + 2.0*gl_FragCoord.xy)/iResolution.y; 53 | 54 | // distort 55 | pos *= 1.0 + 0.3*length(pos); 56 | 57 | // gray 58 | vec4 h = hexagon(8.0*pos + 0.5*iGlobalTime); 59 | float n = noise( vec3(0.3*h.xy+iGlobalTime*0.1,iGlobalTime) ); 60 | vec3 col = 0.15 + 0.15*hash1(h.xy+1.2)*vec3(1.0); 61 | col *= smoothstep( 0.10, 0.11, h.z ); 62 | col *= smoothstep( 0.10, 0.11, h.w ); 63 | col *= 1.0 + 0.15*sin(40.0*h.z); 64 | col *= 0.75 + 0.5*h.z*n; 65 | 66 | 67 | // red 68 | h = hexagon(6.0*pos + 0.6*iGlobalTime); 69 | n = noise( vec3(0.3*h.xy+iGlobalTime*0.1,iGlobalTime) ); 70 | vec3 colb = 0.9 + 0.8*sin( hash1(h.xy)*1.5 + 2.0 + vec3(0.0,1.0,1.0) ); 71 | colb *= smoothstep( 0.10, 0.11, h.z ); 72 | colb *= 1.0 + 0.15*sin(40.0*h.z); 73 | colb *= 0.75 + 0.5*h.z*n; 74 | 75 | h = hexagon(6.0*(pos+0.1*vec2(-1.3,1.0)) + 0.6*iGlobalTime); 76 | col *= 1.0-0.8*smoothstep(0.45,0.451,noise( vec3(0.3*h.xy+iGlobalTime*0.1,iGlobalTime) )); 77 | 78 | col = mix( col, colb, smoothstep(0.45,0.451,n) ); 79 | 80 | 81 | col *= pow( 16.0*uv.x*(1.0-uv.x)*uv.y*(1.0-uv.y), 0.1 ); 82 | 83 | gl_FragColor = vec4( col, 1.0 ); 84 | } 85 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-XdBSzd_tissue.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/XdBSzd 3 | // 4 | 5 | // 6 | // Tissue 7 | // 8 | 9 | // Created by inigo quilez - iq/2014 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | 13 | // Needs two images 14 | // 1) tex07 (colour - affects appearance) 15 | // 2) tex12 (noise image) 16 | 17 | #define HSAMPLES 128 // try 256 18 | #define MSAMPLES 4 // try 12 19 | 20 | #define DISABLE_MIPMAP // slower, but if fixes errors in some systems 21 | 22 | void main( void ) 23 | { 24 | vec2 p = (-iResolution.xy+2.0*gl_FragCoord.xy)/iResolution.y; 25 | float t = iGlobalTime + 10.0*iMouse.x/iResolution.x; 26 | #ifdef DISABLE_MIPMAP 27 | float lodbias = -100.0; 28 | #else 29 | float lodbias = 0.0; 30 | #endif 31 | float ran = texture2D( iChannel1, gl_FragCoord.xy/iChannelResolution[1].xy ).x; 32 | float dof = dot( p, p ); 33 | 34 | vec3 tot = vec3(0.0); 35 | for( int j=0; j Lmax) break; 90 | Lp = L; L += d * 1.5; 91 | } 92 | if (L < Lmax) { 93 | for (int i = 0; i < 5; ++i) { 94 | float Lm = (Lp + L) * .5; 95 | if (world(O + D * Lm) < .01*Lm) L = Lm; else Lp = Lm; 96 | } 97 | } 98 | iter /= 32.; 99 | return L; 100 | } 101 | 102 | float shadowtrace(vec3 p, vec3 d, float lmax) { 103 | float v = .02; 104 | for (int i = 1; i < 9; ++i) { 105 | v = min(v, world(p+d*lmax*float(i)/12.)); 106 | } 107 | return smoothstep(.0, .02, v); 108 | 109 | } 110 | 111 | vec3 enlight(vec3 p, vec3 v, vec3 n, mat_t m, vec3 lpos, vec3 lcolor) { 112 | vec3 ldir = lpos - p; 113 | float ldist2 = dot(ldir, ldir); 114 | float ldist = sqrt(ldist2); 115 | ldir /= ldist; 116 | float shadow = shadowtrace(p, ldir, ldist-.2); 117 | return shadow * lcolor * ( 118 | m.diffuse * max(0., dot(n,ldir)) 119 | + m.specular.rgb * pow(max(0.,dot(normalize(ldir-v), n)), m.specular.w) 120 | * (m.specular.w + 2.) * (m.specular.w + 4.) / (24. * (m.specular.w + pow(2., -m.specular.w/2.))) 121 | ) / ldist2; 122 | } 123 | 124 | vec3 lightball(vec3 lpos, vec3 lcolor, vec3 O, vec3 D, float L) { 125 | vec3 ldir = lpos-O; 126 | float ldist = length(ldir); 127 | if (ldist > L) return vec3(0.); 128 | float pw = pow(max(0.,dot(normalize(ldir),D)), 20000.); 129 | return (normalize(lcolor)+vec3(1.)) * pw; 130 | } 131 | 132 | void main(void) { 133 | for (int i = 0; i < N; ++i) { 134 | float fi = float(i)*.7; 135 | b1[i] = vec3(3.7*sin(t+fi), 1.+10.*cos(t*1.1+fi), 2.3*sin(t*2.3+fi)); 136 | fi = float(i)*1.2; 137 | b2[i] = vec3(4.4*cos(t*.4+fi),-1.-10.*cos(t*0.7+fi), -2.1*sin(t*1.3+fi)); 138 | } 139 | 140 | vec2 uv = gl_FragCoord.xy / resolution.xy * 2. - 1.; 141 | uv.x *= resolution.x / resolution.y; 142 | 143 | vec3 O = vec3(0.,0.,20.); 144 | vec3 D = normalize(vec3(uv,-1.6)); 145 | 146 | if (iMouse.z > 0.) 147 | { 148 | vec2 m = iMouse.xy/iResolution.xy*2.-1.; 149 | float a = - m.x * 2. * 3.1415926; 150 | float s = sin(a), c = cos(a); 151 | O = vec3(s*20.,-m.y*10.,c*20.); 152 | vec3 fw = normalize(vec3(0.) - O); 153 | vec3 rg = cross(fw,vec3(0.,1.,0.)); 154 | D = normalize(mat3(rg, cross(rg, fw), -fw) * D); 155 | } 156 | 157 | float L = trace(O, D, 0., 40.); 158 | vec3 color = vec3(0.); 159 | if (L < 40.) { 160 | vec3 p = O + D * L; 161 | vec3 n = normal(p); 162 | mat_t m = material(p); 163 | color = .001 * m.diffuse * n; 164 | color += enlight(p, D, n, m, l1pos, l1color); 165 | color += enlight(p, D, n, m, l2pos, l2color); 166 | color += enlight(p, D, n, m, l3pos, l3color); 167 | color += enlight(p, D, n, m, l4pos, l4color); 168 | color *= (1. - smoothstep(10., 20., length(p))); 169 | } else L = 100.; 170 | 171 | color += lightball(l1pos, l1color, O, D, L); 172 | color += lightball(l2pos, l2color, O, D, L); 173 | color += lightball(l3pos, l3color, O, D, L); 174 | color += lightball(l4pos, l4color, O, D, L); 175 | 176 | gl_FragColor = vec4(pow(color,vec3(.7)),1.0); 177 | } 178 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-XsX3Rn#_deform_fly.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Deform Fly 3 | // 4 | 5 | // Original had Brick texture on channel0 - tex00 6 | 7 | // 8 | // 9 | // https://www.shadertoy.com/view/XsX3Rn# 10 | // 11 | 12 | // Created by inigo quilez - iq/2013 13 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 14 | // 15 | void main(void) 16 | { 17 | vec2 p = -1.0+2.0*gl_FragCoord.xy/iResolution.y; 18 | 19 | float an = iGlobalTime*0.1; 20 | float x = p.x*cos(an)-p.y*sin(an); 21 | float y = p.x*sin(an)+p.y*cos(an); 22 | 23 | vec2 uv = 0.2*vec2(x, 1.0)/abs(y); 24 | uv.xy += 0.20*iGlobalTime; 25 | 26 | float w = max(-0.1, 0.6-abs(y) ); 27 | 28 | gl_FragColor = vec4( texture2D(iChannel0, uv).xyz+w, 1.0); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-XsXGzn_clover.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/XsXGzn 3 | // 4 | 5 | // 6 | // Clover 7 | // 8 | 9 | // Created by inigo quilez - iq/2013 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | void main(void) 13 | { 14 | vec2 q = 0.6 * (2.0*gl_FragCoord.xy-iResolution.xy)/min(iResolution.y,iResolution.x); 15 | 16 | float a = atan(q.x,q.y); 17 | float r = length(q); 18 | float s = 0.5 + 0.5*sin(3.0*a + iGlobalTime); 19 | float g = sin(1.57+3.0*a+iGlobalTime); 20 | float d = 0.15 + 0.3*sqrt(s) + 0.15*g*g; 21 | float h = r/d; 22 | float f = 1.0-smoothstep( 0.95, 1.0, h ); 23 | h *= 1.0-0.5*(1.0-h)*smoothstep(0.95+0.05*h,1.0,sin(3.0*a+iGlobalTime)); 24 | 25 | vec3 bcol = vec3(0.9+0.1*q.y,1.0,0.9-0.1*q.y); 26 | bcol *= 1.0 - 0.5*r; 27 | h = 0.1 + h; 28 | vec3 col = mix( bcol, 1.2*vec3(0.6*h,0.2+0.5*h,0.0), f ); 29 | 30 | gl_FragColor = vec4( col, 1.0 ); 31 | } 32 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-XsjXR1_worms.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Worms 3 | // 4 | // https://www.shadertoy.com/view/XsjXR1 5 | // 6 | 7 | // Needs a noise image on Channel0 - tex12 8 | 9 | // Created by inigo quilez - iq/2014 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | const float maxdist = 32.0; 13 | 14 | float hash( vec2 p ) 15 | { 16 | //return 0.5 + 0.5*sin( 0.5 + p.x + sin( 0.5 + p.y ) ); 17 | float h = 1.0+dot(p,vec2(127.1,311.7)); 18 | return fract(sin(h)*43758.5453123); 19 | } 20 | 21 | vec2 sincos( float x ) 22 | { 23 | return vec2( sin(x), cos(x) ); 24 | } 25 | 26 | vec2 sdSegment( in vec3 p, in vec3 a, in vec3 b ) 27 | { 28 | vec3 pa = p - a; 29 | vec3 ba = b - a; 30 | float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 ); 31 | return vec2( length( pa - ba*h ), h ); 32 | } 33 | 34 | vec3 opU( vec3 d1, vec3 d2 ){ return (d1.xmaxdist ) break; 71 | h.x = min( h.x, 0.5 ); 72 | t += h.x*0.7; 73 | } 74 | return res; 75 | } 76 | 77 | //------------------------------------------------------- 78 | 79 | vec3 calcNormal( in vec3 pos ) 80 | { 81 | const vec2 e = vec2(1.0,-1.0)*0.004; 82 | 83 | return normalize( e.xyy*map( pos + e.xyy ).x + 84 | e.yyx*map( pos + e.yyx ).x + 85 | e.yxy*map( pos + e.yxy ).x + 86 | e.xxx*map( pos + e.xxx ).x ); 87 | } 88 | 89 | float calcOcc( in vec3 pos, in vec3 nor ) 90 | { 91 | const float h = 0.1; 92 | float ao = 0.0; 93 | for( int i=0; i<8; i++ ) 94 | { 95 | vec3 dir = sin( float(i)*vec3(1.0,7.13,13.71)+vec3(0.0,2.0,4.0) ); 96 | //dir *= sign( dot(dir,nor) ); 97 | dir = dir + 2.0*nor*max(0.0,-dot(nor,dir)); 98 | 99 | float d = map( pos + h*dir ).x; 100 | ao += (h-d); 101 | } 102 | return clamp( 1.0 - 0.7*ao, 0.0, 1.0 ); 103 | } 104 | 105 | //------------------------------------------------------- 106 | 107 | void main( void ) 108 | { 109 | vec2 p = (-iResolution.xy+2.0*gl_FragCoord.xy)/iResolution.y; 110 | 111 | vec3 ro = 0.6*vec3(1.0,4.0,2.0); 112 | vec3 ta = 0.5*vec3(0.0,0.0,0.0); 113 | float fl = 3.0; 114 | vec3 ww = normalize( ta - ro); 115 | vec3 uu = normalize( cross( vec3(0.0,1.0,0.0), ww ) ); 116 | vec3 vv = normalize( cross(ww,uu) ); 117 | vec3 rd = normalize( p.x*uu + p.y*vv + fl*ww ); 118 | 119 | vec3 col = vec3(0.0); 120 | 121 | vec3 res = intersect( ro, rd, fl ); 122 | float t = res.x; 123 | if( t < maxdist ) 124 | { 125 | 126 | vec3 pos = ro + t*rd; 127 | vec3 nor = calcNormal( pos ); 128 | 129 | float occ = calcOcc( pos, nor ); 130 | 131 | vec2 id = floor( (pos.xz+1.0)/2.0); 132 | float fid = hash( id ); 133 | float ve = hash(id); 134 | 135 | col = 0.5 + 0.5*cos( res.y*0.4 + fid*30.0 + vec3(0.0,4.4,4.0) ); 136 | col *= 0.5 + 1.5*nor.y; 137 | col += 1.0*clamp(1.0+dot(rd,nor),0.0,1.0); 138 | col *= 0.2 + 0.8*texture2D( iChannel0, vec2( 50.0*res.z - 1.0*ve*iGlobalTime,0.5) ).xyz; 139 | col *= 2.0; 140 | col *= occ; 141 | 142 | float fl = mod( ve*1.0*iGlobalTime + fid*7.0 + res.y*13.0, 4.0 )/4.0; 143 | float gl = 1.0-smoothstep(0.02,0.04,abs(res.z-fl)); 144 | col *= 1.0 + 1.5*gl; 145 | 146 | col *= exp( -0.1*t ); 147 | col *= 1.0 - smoothstep( 20.0, 30.0, t ); 148 | } 149 | 150 | col = pow( col, vec3(0.5,1.0,1.0) ); 151 | 152 | vec2 q = gl_FragCoord.xy/iResolution.xy; 153 | col *= pow(16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.1); 154 | 155 | gl_FragColor = vec4( col, 1.0 ); 156 | 157 | } 158 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-Xsl3zn_warping_texture.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/Xsl3zn 3 | // 4 | 5 | // 6 | // Warping Texture 7 | // 8 | 9 | // Created by inigo quilez - iq/2013 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | void main(void) 13 | { 14 | vec2 uv = 0.5*gl_FragCoord.xy / iResolution.xy; 15 | 16 | float d = length(uv); 17 | vec2 st = uv*0.1 + 0.2*vec2(cos(0.071*iGlobalTime+d), sin(0.073*iGlobalTime-d)); 18 | 19 | vec3 col = texture2D( iChannel0, st ).xyz; 20 | float w = col.x; 21 | col *= 1.0 - texture2D( iChannel0, 0.4*uv + 0.1*col.xy ).xyy; 22 | col *= w*2.0; 23 | 24 | col *= 1.0 + 2.0*d; 25 | gl_FragColor = vec4(col,1.0); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-ldBXDd_Crease_Machine.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/ldBXDd 3 | // 4 | 5 | // 6 | // Crease Machine - by timeiskey 7 | // 8 | 9 | void main(void) 10 | { 11 | vec2 p = gl_FragCoord.xy / iResolution.xy; 12 | 13 | 14 | 15 | 16 | //shape position 17 | vec2 shapeCenter = vec2( 0.5, 0.5); 18 | //distance from pixel to shape center 19 | vec2 distanceToShape = p - shapeCenter; 20 | 21 | //color vector 22 | vec3 col = vec3( 0.0, 1.0, 1.0 ); 23 | 24 | //shape radius 25 | float shapeRadius = 0.2 + 0.1*cos( atan(distanceToShape.x, distanceToShape.y) 26 | *iGlobalTime ); 27 | //shape sharpness (smaller is sharper) 28 | float sharpnessMod = 0.008; 29 | 30 | col *= smoothstep( shapeRadius, shapeRadius+sharpnessMod, length(distanceToShape)); 31 | col = vec3( 1.0, 1.0, 1.0) - col; 32 | 33 | //finally changes the color 34 | gl_FragColor = vec4(col,1.0); 35 | } 36 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-ldS3Rh_icosahedron.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/ldS3Rh 3 | // 4 | 5 | // 6 | // Icosahedron 7 | // 8 | // Tracer code by Ben Weston - 2013 9 | // Geometry, colouring and and animation by Wouter van Nifterick 2013 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | const float pi2 = 6.28318530717958647692; 13 | 14 | const float epsilon = .003; 15 | const float normalPrecision = .1; 16 | const float shadowOffset = .2; 17 | const int traceDepth = 50; // takes time 18 | const float drawDistance = 150.0; 19 | const float stepScale = .9; 20 | 21 | const vec3 CamPos = vec3(0,20.0,-20.0); 22 | const vec3 CamLook = vec3(0,0,0); 23 | 24 | const vec3 lightDir = vec3(0,1,1); 25 | const vec3 fillLightDir = vec3(0,0,-1); 26 | const vec3 lightColour = vec3(1,.8,.6); 27 | const vec3 fillLightColour = vec3(.05,.15,.25); 28 | 29 | 30 | float Isosurface( vec3 at ) 31 | { 32 | float res=.6; 33 | float n=(1.0+sqrt(5.0))*0.49; 34 | 35 | at /= 2.5; 36 | if(length(at) < 5.9) 37 | { 38 | float t = 39 | res =2.0 - 40 | (cos(at.x + n * at.y) + 41 | cos(at.x - n * at.y) + 42 | cos(at.y + n * at.z) + 43 | cos(at.y - n * at.z) + 44 | cos(at.z + n * at.x) + 45 | cos(at.z - n * at.x)) ; 46 | } 47 | return res; 48 | } 49 | 50 | vec3 Shading( vec3 pos, vec3 norm, float shadow, vec3 rd ) 51 | { 52 | vec3 albedo = vec3(.4); 53 | 54 | vec3 l = shadow*lightColour*max(0.0,dot(norm,lightDir)); 55 | vec3 fl = fillLightColour*(dot(norm,fillLightDir)*.5+.5); 56 | 57 | vec3 view = normalize(-rd); 58 | vec3 h = normalize(view+lightDir); 59 | float specular = pow(max(0.0,dot(h,norm)),200.0); 60 | vec3 res = albedo*(l+fl) + shadow*specular*22.0*lightColour*0.1; 61 | return res; 62 | } 63 | 64 | 65 | float Trace( vec3 ro, vec3 rd ) 66 | { 67 | float t = 0.0; 68 | float dist = 1.0; 69 | for ( int i=0; i < traceDepth; i++ ) 70 | { 71 | if ( abs(dist) < epsilon || t > drawDistance || t < 0.0 ) 72 | continue; 73 | dist = Isosurface( ro+rd*t ); 74 | t = t+dist*stepScale; 75 | } 76 | 77 | return t; 78 | } 79 | 80 | // get normal 81 | vec3 GetNormal( vec3 pos ) 82 | { 83 | const vec2 delta = vec2(normalPrecision, 0); 84 | vec3 n; 85 | n.x = Isosurface( pos + delta.xyy ) - Isosurface( pos - delta.xyy ); 86 | n.y = Isosurface( pos + delta.yxy ) - Isosurface( pos - delta.yxy ); 87 | n.z = Isosurface( pos + delta.yyx ) - Isosurface( pos - delta.yyx ); 88 | return normalize(n); 89 | } 90 | 91 | // camera function by TekF 92 | // compute ray from camera parameters 93 | vec3 GetRay( vec3 dir, float zoom, vec2 uv ) 94 | { 95 | uv = uv - .5; 96 | uv.x *= iResolution.x/iResolution.y; 97 | 98 | dir = zoom*normalize(dir); 99 | vec3 right = normalize(cross(vec3(0,1,0),dir)); 100 | vec3 up = normalize(cross(dir,right)); 101 | 102 | return dir + right*uv.x + up*uv.y; 103 | } 104 | 105 | void main(void) 106 | { 107 | vec2 uv = gl_FragCoord.xy / iResolution.xy; 108 | 109 | vec3 camPos = CamPos; 110 | vec3 camLook = CamLook; 111 | 112 | vec2 camRot = .5*pi2*(iMouse.xy-iResolution.xy*.5)/iResolution.x; 113 | camRot += iGlobalTime*0.5; 114 | camRot.y = 0.0; 115 | 116 | camPos.yz = cos(camRot.y)*camPos.yz* (0.5+sin (iGlobalTime)*0.2) + sin(camRot.y)*camPos.zy*vec2(1,-1); 117 | camPos.xz = cos(camRot.x)*camPos.xz + sin(camRot.x)*camPos.zx*vec2(1,-1); 118 | 119 | vec3 rd, ro = camPos; 120 | rd = GetRay( camLook-camPos, 1.0, uv ); 121 | 122 | float t = Trace(ro,rd); 123 | 124 | vec3 result = vec3(0); 125 | if ( t > 0.0 && t < drawDistance ) 126 | { 127 | vec3 pos = ro+t*rd; 128 | 129 | vec3 norm = GetNormal(pos); 130 | 131 | // shadow test 132 | float shadow = 0.0; 133 | if ( Trace( pos+lightDir*shadowOffset, lightDir ) < drawDistance ) 134 | shadow = 0.15; 135 | 136 | result = Shading( pos, norm, shadow, rd )*6.0; 137 | 138 | // fog 139 | result = mix ( vec3(.6+sin(1.0+iGlobalTime)*0.6,.9+cos(iGlobalTime)*0.2,1.1+sin(iGlobalTime)*0.1), result, exp(-t*t*.0005) )*2.0-0.5; 140 | result -= distance(vec2(0),pos.xy)*0.03; 141 | } 142 | 143 | gl_FragColor = vec4( result, 1.0 ); 144 | } 145 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-ldjXD3_Texture_Flow_III.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // https://www.shadertoy.com/view/ldjXD3 4 | // 5 | 6 | // 7 | // Texture flow III 8 | // 9 | 10 | // Created by inigo quilez - iq/2014 11 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 12 | 13 | // Needs 2 textures 14 | // 1) tex12 (noise image) 15 | // 2) tex05 (material image) 16 | 17 | 18 | vec4 texture0( in vec2 x ) 19 | { 20 | vec2 res = iChannelResolution[0].xy; 21 | vec2 u = x*res - 0.5; 22 | vec2 p = floor(u); 23 | vec2 f = fract(u); 24 | f = f*f*(3.0-2.0*f); 25 | vec4 a = texture2D( iChannel0, (p+vec2(0.5,0.5))/res, -64.0 ); 26 | vec4 b = texture2D( iChannel0, (p+vec2(1.5,0.5))/res, -64.0 ); 27 | vec4 c = texture2D( iChannel0, (p+vec2(0.5,1.5))/res, -64.0 ); 28 | vec4 d = texture2D( iChannel0, (p+vec2(1.5,1.5))/res, -64.0 ); 29 | return mix(mix(a,b,f.x), mix(c,d,f.x),f.y); 30 | } 31 | 32 | vec2 flow( vec2 uv, in mat2 m ) 33 | { 34 | for( int i=0; i<50; i++ ) 35 | uv += 0.00015 * m * (-1.0+2.0*texture0(0.5*uv).xz); 36 | return uv; 37 | } 38 | 39 | void main( void ) 40 | { 41 | vec2 p = gl_FragCoord.xy / iResolution.xy; 42 | 43 | // animate 44 | float an = 0.5*iGlobalTime; 45 | float co = cos(an); 46 | float si = sin(an); 47 | mat2 ma = mat2( co, -si, si, co ); 48 | 49 | // orbit, distance and distance gradient 50 | vec2 uva = 0.05*(p + vec2(1.0,0.0)/iResolution.xy); 51 | vec2 uvb = 0.05*(p + vec2(0.0,1.0)/iResolution.xy); 52 | vec2 uvc = 0.05*p; 53 | vec2 nuva = flow( uva, ma ); 54 | vec2 nuvb = flow( uvb, ma ); 55 | vec2 nuvc = flow( uvc, ma ); 56 | float fa = length(nuva-uva)*95.0; 57 | float fb = length(nuvb-uvb)*95.0; 58 | float fc = length(nuvc-uvc)*95.0; 59 | vec3 nor = normalize( vec3((fa-fc)*iResolution.x,1.0,(fb-fc)*iResolution.y ) ); 60 | 61 | // material 62 | vec3 col = 0.2 + 0.8*texture2D(iChannel1, 50.0*nuvc).xyz; 63 | col *= 1.0 + 0.15*nor; 64 | float ss, sw; 65 | ss = sin(6000.0*nuvc.x); sw = fwidth(ss); col *= 0.5 + 0.5*smoothstep(-sw,sw,ss+0.95); 66 | ss = sin(6000.0*nuvc.y); sw = fwidth(ss); col *= 0.5 + 0.5*smoothstep(-sw,sw,ss+0.95); 67 | 68 | // ilumination 69 | vec3 lig = normalize( vec3( 1.0,1.0,-0.4 ) ); 70 | col *= vec3(0.7,0.8,0.9) + vec3(0.6,0.5,0.4)*clamp( dot(nor,lig), 0.0, 1.0 ); 71 | col += 0.40*pow( nor.y, 4.0 ); 72 | col += 0.15*pow( nor.y, 2.0 ); 73 | col *= sqrt( fc*fc*fc ); 74 | 75 | // postpro 76 | col = 1.5*pow( col+vec3(0.0,0.0,0.015), vec3(0.6,0.8,1.0) ); 77 | col *= 0.5 + 0.5*sqrt( 16.0*p.x*p.y*(1.0-p.x)*(1.0-p.y) ); 78 | 79 | gl_FragColor = vec4( col, 1.0 ); 80 | } 81 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lsBXD1_GTC_Conference.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lsBXD1 3 | // 4 | 5 | // 6 | // GTC Conference 7 | // 8 | 9 | // Created by inigo quilez - iq/2014 10 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 11 | 12 | // Live coded demo during out talk at GTC 2014. See here for comentary: 13 | // http://on-demand.gputechconf.com/gtc/2014/video/S4550-shadertoy-fragment-shader.mp4 14 | 15 | float map( in vec3 p ) 16 | { 17 | 18 | vec3 q = mod( p+2.0, 4.0 ) - 2.0; 19 | 20 | float d1 = length( q ) - 1.0; 21 | 22 | d1 += 0.1*sin(10.0*p.x)*sin(10.0*p.y + iGlobalTime )*sin(10.0*p.z); 23 | 24 | float d2 = p.y + 1.0; 25 | 26 | float k = 1.5; 27 | float h = clamp( 0.5 + 0.5*(d1-d2)/k, 0.0, 1.0 ); 28 | return mix( d1, d2, h ) - k*h*(1.0-h); 29 | } 30 | 31 | vec3 calcNormal( in vec3 p ) 32 | { 33 | vec2 e = vec2( 0.0001, 0.0 ); 34 | 35 | return normalize( vec3( map(p+e.xyy) - map(p-e.xyy), 36 | map(p+e.yxy) - map(p-e.yxy), 37 | map(p+e.yyx) - map(p-e.yyx) ) ); 38 | } 39 | 40 | void main( void ) 41 | { 42 | vec2 uv = gl_FragCoord.xy / iResolution.xy; 43 | vec2 p = -1.0 + 2.0*uv; 44 | 45 | p.x *= iResolution.x/iResolution.y; 46 | 47 | vec3 ro = vec3( 0.0, 0.0, 2.0 ); 48 | 49 | vec3 rd = normalize( vec3(p, -1.0) ); 50 | 51 | vec3 col = vec3(0.0); 52 | 53 | 54 | float tmax = 20.0; 55 | float h = 1.0; 56 | float t = 0.0; 57 | for( int i=0; i<100; i++ ) 58 | { 59 | if( h<0.0001 || t>tmax ) break; 60 | h = map( ro + t*rd ); 61 | t += h; 62 | } 63 | 64 | vec3 lig = vec3(0.5773); 65 | 66 | if( t 0.0 ) { 77 | u = vec2( h, r.x ); 78 | d = vec2( 0.866*abs(r.x)+0.5*r.y, 0.5*step(0.0,r.x) ); 79 | } 80 | 81 | if( d.x0.6 ) { 137 | float pa = sin(c.w+(1.0-0.7*c.y)*25.0*uv.y)*sin((1.0-0.7*c.y)*25.0*uv.x); 138 | col *= smoothstep( 0.0, 0.3, abs(pa-0.6) ); 139 | col *= 1.0 - 0.35*smoothstep( 0.6, 0.7, pa ); 140 | } 141 | 142 | // wireframe 143 | col *= 1.0 - d; 144 | 145 | // tint 146 | col = pow( col, vec3(1.0,1.0,0.8) ); 147 | 148 | // vigneting 149 | col *= 0.7 + 0.3*pow( 16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y), 0.2 ); 150 | 151 | 152 | gl_FragColor = vec4( col, 1.0 ); 153 | 154 | } 155 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lsSGzy_flaring.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lsSGzy 3 | // 4 | 5 | // 6 | // Flaring 7 | // 8 | //Flaring by nimitz (stormoid.com) (twitter: @stormoid) 9 | 10 | //change this value (1 to 5) or tweak the settings yourself. 11 | //the gamma and spot brightness parameters can use negative values 12 | #define TYPE 4 13 | 14 | #if TYPE == 1 15 | #define brightness 1. 16 | #define ray_brightness 11. 17 | #define gamma 5. 18 | #define spot_brightness 4. 19 | #define ray_density 1.5 20 | #define curvature .1 21 | #define red 7. 22 | #define green 1.3 23 | #define blue 1. 24 | //1 -> ridged, 2 -> sinfbm, 3 -> pure fbm 25 | #define noisetype 2 26 | #define sin_freq 50. //for type 2 27 | #elif TYPE == 2 28 | #define brightness 1.5 29 | #define ray_brightness 10. 30 | #define gamma 8. 31 | #define spot_brightness 15. 32 | #define ray_density 3.5 33 | #define curvature 15. 34 | #define red 4. 35 | #define green 1. 36 | #define blue .1 37 | #define noisetype 1 38 | #define sin_freq 13. 39 | #elif TYPE == 3 40 | #define brightness 1.5 41 | #define ray_brightness 20. 42 | #define gamma 4. 43 | #define spot_brightness .95 44 | #define ray_density 3.14 45 | #define curvature 17. 46 | #define red 2.9 47 | #define green .7 48 | #define blue 3.5 49 | #define noisetype 2 50 | #define sin_freq 15. 51 | #elif TYPE == 4 52 | #define brightness 3. 53 | #define ray_brightness 5. 54 | #define gamma 6. 55 | #define spot_brightness 1.5 56 | #define ray_density 6. 57 | #define curvature 90. 58 | #define red 1.8 59 | #define green 3. 60 | #define blue .5 61 | #define noisetype 1 62 | #define sin_freq 6. 63 | #define YO_DAWG 64 | #elif TYPE == 5 65 | #define brightness 2. 66 | #define ray_brightness 5. 67 | #define gamma 5. 68 | #define spot_brightness 1.7 69 | #define ray_density 30. 70 | #define curvature 1. 71 | #define red 1. 72 | #define green 4.0 73 | #define blue 4.9 74 | #define noisetype 2 75 | #define sin_freq 5. //for type 2 76 | #endif 77 | 78 | 79 | //#define PROCEDURAL_NOISE 80 | //#define YO_DAWG 81 | 82 | 83 | float hash( float n ) 84 | { 85 | return fract(sin(n)*43758.5453); 86 | } 87 | 88 | float noise( in vec2 x ) 89 | { 90 | #ifdef PROCEDURAL_NOISE 91 | vec2 p = floor(x); 92 | vec2 f = fract(x); 93 | 94 | f = f*f*(3.0-2.0*f); 95 | 96 | float n = p.x + p.y*57.0; 97 | 98 | float res = mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), 99 | mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); 100 | return res; 101 | #else 102 | return texture2D(iChannel0, x*.01).x; 103 | #endif 104 | } 105 | 106 | mat2 m2 = mat2( 0.80, 0.60, -0.60, 0.80 ); 107 | float fbm( in vec2 p ) 108 | { 109 | float z=2.; 110 | float rz = 0.; 111 | p *= 0.25; 112 | for (float i= 1.;i < 6.;i++ ) 113 | { 114 | #if noisetype == 1 115 | rz+= abs((noise(p)-0.5)*2.)/z; 116 | #elif noisetype == 2 117 | rz+= (sin(noise(p)*sin_freq)*0.5+0.5) /z; 118 | #else 119 | rz+= noise(p)/z; 120 | #endif 121 | z = z*2.; 122 | p = p*2.*m2; 123 | } 124 | return rz; 125 | } 126 | 127 | void main(void) 128 | { 129 | float t = -iGlobalTime*0.03; 130 | vec2 uv = gl_FragCoord.xy / iResolution.xy-0.5; 131 | uv.x *= iResolution.x/iResolution.y; 132 | uv*= curvature*.05+0.0001; 133 | 134 | float r = sqrt(dot(uv,uv)); 135 | float x = dot(normalize(uv), vec2(.5,0.))+t; 136 | float y = dot(normalize(uv), vec2(.0,.5))+t; 137 | 138 | #ifdef YO_DAWG 139 | x = fbm(vec2(y*ray_density*0.5,r+x*ray_density*.2)); 140 | y = fbm(vec2(r+y*ray_density*0.1,x*ray_density*.5)); 141 | #endif 142 | 143 | float val; 144 | val = fbm(vec2(r+y*ray_density,r+x*ray_density-y)); 145 | val = smoothstep(gamma*.02-.1,ray_brightness+(gamma*0.02-.1)+.001,val); 146 | val = sqrt(val); 147 | 148 | vec3 col = val/vec3(red,green,blue); 149 | col = clamp(1.-col,0.,1.); 150 | col = mix(col,vec3(1.),spot_brightness-r/0.1/curvature*200./brightness); 151 | 152 | gl_FragColor = vec4(col,1.0); 153 | } 154 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lsXSDn#_matrix_rain.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lsXSDn# 3 | // 4 | 5 | // Matrix Rain shader - by raja 6 | 7 | #define RAIN_SPEED 1.75 // Speed of rain droplets 8 | #define DROP_SIZE 3.0 // Higher value lowers, the size of individual droplets 9 | 10 | float rand(vec2 co){ 11 | return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 12 | } 13 | 14 | float rchar(vec2 outer, vec2 inner, float globalTime) { 15 | //return float(rand(floor(inner * 2.0) + outer) > 0.9); 16 | 17 | vec2 seed = floor(inner * 4.0) + outer.y; 18 | if (rand(vec2(outer.y, 23.0)) > 0.98) { 19 | seed += floor((globalTime + rand(vec2(outer.y, 49.0))) * 3.0); 20 | } 21 | 22 | return float(rand(seed) > 0.5); 23 | } 24 | 25 | void main( void ) { 26 | 27 | vec2 position = gl_FragCoord.xy / iResolution.xy; 28 | vec2 uv = position; 29 | position.x /= iResolution.x / iResolution.y; 30 | float globalTime = iGlobalTime * RAIN_SPEED; 31 | 32 | float scaledown = DROP_SIZE; 33 | float rx = gl_FragCoord.x / (40.0 * scaledown); 34 | float mx = 40.0*scaledown*fract(position.x * 30.0 * scaledown); 35 | vec4 result; 36 | 37 | if (mx > 12.0 * scaledown) { 38 | result = vec4(0.0); 39 | } else 40 | { 41 | float x = floor(rx); 42 | float r1x = floor(gl_FragCoord.x / (15.0)); 43 | 44 | 45 | float ry = position.y*600.0 + rand(vec2(x, x * 3.0)) * 100000.0 + globalTime* rand(vec2(r1x, 23.0)) * 120.0; 46 | float my = mod(ry, 15.0); 47 | if (my > 12.0 * scaledown) { 48 | result = vec4(0.0); 49 | } else { 50 | 51 | float y = floor(ry / 15.0); 52 | 53 | float b = rchar(vec2(rx, floor((ry) / 15.0)), vec2(mx, my) / 12.0, globalTime); 54 | float col = max(mod(-y, 24.0) - 4.0, 0.0) / 20.0; 55 | vec3 c = col < 0.8 ? vec3(0.0, col / 0.8, 0.0) : mix(vec3(0.0, 1.0, 0.0), vec3(1.0), (col - 0.8) / 0.2); 56 | 57 | result = vec4(c * b, 1.0) ; 58 | } 59 | } 60 | 61 | position.x += 0.05; 62 | 63 | scaledown = DROP_SIZE; 64 | rx = gl_FragCoord.x / (40.0 * scaledown); 65 | mx = 40.0*scaledown*fract(position.x * 30.0 * scaledown); 66 | 67 | if (mx > 12.0 * scaledown) { 68 | result += vec4(0.0); 69 | } else 70 | { 71 | float x = floor(rx); 72 | float r1x = floor(gl_FragCoord.x / (12.0)); 73 | 74 | 75 | float ry = position.y*700.0 + rand(vec2(x, x * 3.0)) * 100000.0 + globalTime* rand(vec2(r1x, 23.0)) * 120.0; 76 | float my = mod(ry, 15.0); 77 | if (my > 12.0 * scaledown) { 78 | result += vec4(0.0); 79 | } else { 80 | 81 | float y = floor(ry / 15.0); 82 | 83 | float b = rchar(vec2(rx, floor((ry) / 15.0)), vec2(mx, my) / 12.0, globalTime); 84 | float col = max(mod(-y, 24.0) - 4.0, 0.0) / 20.0; 85 | vec3 c = col < 0.8 ? vec3(0.0, col / 0.8, 0.0) : mix(vec3(0.0, 1.0, 0.0), vec3(1.0), (col - 0.8) / 0.2); 86 | 87 | result += vec4(c * b, 1.0) ; 88 | } 89 | } 90 | 91 | result = result * length(texture2D(iChannel0,uv).rgb) + 0.22 * vec4(0.,texture2D(iChannel0,uv).g,0.,1.); 92 | if(result.b < 0.5) 93 | result.b = result.g * 0.5 ; 94 | gl_FragColor = result; 95 | } 96 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lsf3R4_wavy_texture.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lsf3R4 3 | // 4 | 5 | // 6 | // Wavy Texture 7 | // 8 | 9 | void main(void) 10 | { 11 | vec2 uv = gl_FragCoord.xy / iResolution.xy; 12 | uv.y += (sin((uv.x + (iGlobalTime * 0.5)) * 10.0) * 0.1) + 13 | (sin((uv.x + (iGlobalTime * 0.2)) * 32.0) * 0.01); 14 | vec4 texColor = texture2D(iChannel0, uv); 15 | gl_FragColor = texColor; 16 | } -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lsf3RH_ball_of_fire.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lsf3RH 3 | // 4 | 5 | // 6 | // Ball of fire 7 | // 8 | 9 | float snoise(vec3 uv, float res) 10 | { 11 | const vec3 s = vec3(1e0, 1e2, 1e3); 12 | 13 | uv *= res; 14 | 15 | vec3 uv0 = floor(mod(uv, res))*s; 16 | vec3 uv1 = floor(mod(uv+vec3(1.), res))*s; 17 | 18 | vec3 f = fract(uv); f = f*f*(3.0-2.0*f); 19 | 20 | vec4 v = vec4(uv0.x+uv0.y+uv0.z, uv1.x+uv0.y+uv0.z, 21 | uv0.x+uv1.y+uv0.z, uv1.x+uv1.y+uv0.z); 22 | 23 | vec4 r = fract(sin(v*1e-1)*1e3); 24 | float r0 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y); 25 | 26 | r = fract(sin((v + uv1.z - uv0.z)*1e-1)*1e3); 27 | float r1 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y); 28 | 29 | return mix(r0, r1, f.z)*2.-1.; 30 | } 31 | 32 | void main(void) 33 | { 34 | vec2 p = -.5 + gl_FragCoord.xy / iResolution.xy; 35 | p.x *= iResolution.x/iResolution.y; 36 | 37 | float color = 3.0 - (3.*length(2.*p)); 38 | 39 | vec3 coord = vec3(atan(p.x,p.y)/6.2832+.5, length(p)*.4, .5); 40 | 41 | for(int i = 1; i <= 7; i++) 42 | { 43 | float power = pow(2.0, float(i)); 44 | color += (1.5 / power) * snoise(coord + vec3(0.,-iGlobalTime*.05, iGlobalTime*.01), power*16.); 45 | } 46 | gl_FragColor = vec4( color, pow(max(color,0.),2.)*0.4, pow(max(color,0.),3.)*0.15 , 1.0); 47 | } -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lslXRS_lava.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lslXRS 3 | // 4 | 5 | // Noise animation - Lava 6 | // 7 | //Noise animation - Lava 8 | //by nimitz (stormoid.com) (twitter: @stormoid) 9 | 10 | 11 | //Somewhat inspired by the concepts behind "flow noise" 12 | //every octave of noise is modulated separately 13 | //with displacement using a rotated vector field 14 | 15 | //This is a more standard use of the flow noise 16 | //unlike my normalized vector field version (https://www.shadertoy.com/view/MdlXRS) 17 | //the noise octaves are actually displaced to create a directional flow 18 | 19 | //Sinus ridged fbm is used for better effect. 20 | 21 | #define time iGlobalTime*0.1 22 | 23 | float hash21(in vec2 n){ return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); } 24 | mat2 makem2(in float theta){float c = cos(theta);float s = sin(theta);return mat2(c,-s,s,c);} 25 | float noise( in vec2 x ){return texture2D(iChannel0, x*.01).x;} 26 | 27 | vec2 gradn(vec2 p) 28 | { 29 | float ep = .09; 30 | float gradx = noise(vec2(p.x+ep,p.y))-noise(vec2(p.x-ep,p.y)); 31 | float grady = noise(vec2(p.x,p.y+ep))-noise(vec2(p.x,p.y-ep)); 32 | return vec2(gradx,grady); 33 | } 34 | 35 | float flow(in vec2 p) 36 | { 37 | float z=2.; 38 | float rz = 0.; 39 | vec2 bp = p; 40 | for (float i= 1.;i < 7.;i++ ) 41 | { 42 | //primary flow speed 43 | p += time*.6; 44 | 45 | //secondary flow speed (speed of the perceived flow) 46 | bp += time*1.9; 47 | 48 | //displacement field (try changing time multiplier) 49 | vec2 gr = gradn(i*p*.34+time*1.); 50 | 51 | //rotation of the displacement field 52 | gr*=makem2(time*6.-(0.05*p.x+0.03*p.y)*40.); 53 | 54 | //displace the system 55 | p += gr*.5; 56 | 57 | //add noise octave 58 | rz+= (sin(noise(p)*7.)*0.5+0.5)/z; 59 | 60 | //blend factor (blending displaced system with base system) 61 | //you could call this advection factor (.5 being low, .95 being high) 62 | p = mix(bp,p,.77); 63 | 64 | //intensity scaling 65 | z *= 1.4; 66 | //octave scaling 67 | p *= 2.; 68 | bp *= 1.9; 69 | } 70 | return rz; 71 | } 72 | 73 | void main(void) 74 | { 75 | vec2 p = gl_FragCoord.xy / iResolution.xy-0.5; 76 | p.x *= iResolution.x/iResolution.y; 77 | p*= 3.; 78 | float rz = flow(p); 79 | 80 | vec3 col = vec3(.2,0.07,0.01)/rz; 81 | col=pow(col,vec3(1.4)); 82 | gl_FragColor = vec4(col,1.0); 83 | } 84 | -------------------------------------------------------------------------------- /Shaders/More shaders/ShaderToy-lss3WS_simplicity.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/lss3WS 3 | // 4 | 5 | // 6 | // Simplicity - by JoshP 7 | // 8 | // 9 | // http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/ 10 | float field(in vec3 p) { 11 | float strength = 7. + .03 * log(1.e-6 + fract(sin(iGlobalTime) * 4373.11)); 12 | float accum = 0.; 13 | float prev = 0.; 14 | float tw = 0.; 15 | for (int i = 0; i < 32; ++i) { 16 | float mag = dot(p, p); 17 | p = abs(p) / mag + vec3(-.5, -.4, -1.5); 18 | float w = exp(-float(i) / 7.); 19 | accum += w * exp(-strength * pow(abs(mag - prev), 2.3)); 20 | tw += w; 21 | prev = mag; 22 | } 23 | return max(0., 5. * accum / tw - .7); 24 | } 25 | 26 | void main() { 27 | vec2 uv = 2. * gl_FragCoord.xy / iResolution.xy - 1.; 28 | vec2 uvs = uv * iResolution.xy / max(iResolution.x, iResolution.y); 29 | vec3 p = vec3(uvs / 4., 0) + vec3(1., -1.3, 0.); 30 | p += .2 * vec3(sin(iGlobalTime / 16.), sin(iGlobalTime / 12.), sin(iGlobalTime / 128.)); 31 | float t = field(p); 32 | float v = (1. - exp((abs(uv.x) - 1.) * 6.)) * (1. - exp((abs(uv.y) - 1.) * 6.)); 33 | gl_FragColor = mix(.4, 1., v) * vec4(1.8 * t * t * t, 1.4 * t * t, t, 1.0); 34 | } 35 | -------------------------------------------------------------------------------- /Shaders/Revised/README.TXT: -------------------------------------------------------------------------------- 1 | The ShaderToy specification now includes a "mainImage" function instead of "main". 2 | 3 | Changes made to ShaderLoader now allow these shaders to work. 4 | The older format is still suported. -------------------------------------------------------------------------------- /Shaders/Revised/ShaderToy-ldl3W8#_voronoi-distances.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/ldl3W8# 3 | // 4 | // Voronoi - distances 5 | // 6 | // 7 | // Created by inigo quilez - iq/2013 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | 11 | // I've not seen anybody out there computing correct cell interior distances for Voronoi 12 | // patterns yet. That's why they cannot shade the cell interior correctly, and why you've 13 | // never seen cell boundaries rendered correctly. 14 | 15 | // However, here's how you do mathematically correct distances (note the equidistant and non 16 | // degenerated grey isolines inside the cells) and hence edges (in yellow): 17 | 18 | // http://www.iquilezles.org/www/articles/voronoilines/voronoilines.htm 19 | 20 | #define ANIMATE 21 | 22 | vec2 hash2( vec2 p ) 23 | { 24 | // texture based white noise 25 | // return texture2D( iChannel0, (p+0.5)/256.0, -100.0 ).xy; 26 | 27 | // procedural white noise 28 | return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3))))*43758.5453); 29 | } 30 | 31 | vec3 voronoi( in vec2 x ) 32 | { 33 | vec2 n = floor(x); 34 | vec2 f = fract(x); 35 | 36 | //---------------------------------- 37 | // first pass: regular voronoi 38 | //---------------------------------- 39 | vec2 mg, mr; 40 | 41 | float md = 8.0; 42 | for( int j=-1; j<=1; j++ ) 43 | for( int i=-1; i<=1; i++ ) 44 | { 45 | vec2 g = vec2(float(i),float(j)); 46 | vec2 o = hash2( n + g ); 47 | #ifdef ANIMATE 48 | o = 0.5 + 0.5*sin( iGlobalTime + 6.2831*o ); 49 | #endif 50 | vec2 r = g + o - f; 51 | float d = dot(r,r); 52 | 53 | if( d0.00001 ) 76 | md = min( md, dot( 0.5*(mr+r), normalize(r-mr) ) ); 77 | } 78 | 79 | return vec3( md, mr ); 80 | } 81 | 82 | void mainImage( out vec4 fragColor, in vec2 fragCoord ) 83 | { 84 | vec2 p = fragCoord.xy/iResolution.xx; 85 | 86 | vec3 c = voronoi( 8.0*p ); 87 | 88 | // isolines 89 | vec3 col = c.x*(0.5 + 0.5*sin(64.0*c.x))*vec3(1.0); 90 | 91 | // borders 92 | col = mix( vec3(1.0,0.6,0.0), col, smoothstep( 0.04, 0.07, c.x ) ); 93 | 94 | // feature points 95 | float dd = length( c.yz ); 96 | col = mix( vec3(1.0,0.6,0.1), col, smoothstep( 0.0, 0.12, dd) ); 97 | col += vec3(1.0,0.6,0.1)*(1.0-smoothstep( 0.0, 0.04, dd)); 98 | 99 | fragColor = vec4(col,1.0); 100 | } 101 | 102 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4dBSRK_color_grid.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Color Grid 3 | // 4 | // https://www.shadertoy.com/view/4dBSRK 5 | // 6 | 7 | 8 | // Created by inigo quilez - iq/2014 9 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 10 | 11 | void main( void ) 12 | { 13 | vec2 px = 4.0*(-iResolution.xy + 2.0*gl_FragCoord.xy) / iResolution.y; 14 | 15 | float id = 0.5 + 0.5*cos(iGlobalTime + sin(dot(floor(px+0.5),vec2(113.1,17.81)))*43758.545); 16 | 17 | vec3 co = 0.5 + 0.5*cos(iGlobalTime + 3.5*id + vec3(0.0,1.57,3.14) ); 18 | 19 | vec2 pa = smoothstep( 0.0, 0.2, id*(0.5 + 0.5*cos(6.2831*px)) ); 20 | 21 | gl_FragColor = vec4( co*pa.x*pa.y, 1.0 ); 22 | } 23 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4dl3zn_bubbles.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Bubbles 3 | // 4 | // https://www.shadertoy.com/view/4dl3zn 5 | // 6 | // Created by inigo quilez - iq/2013 7 | // 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | void main(void) 11 | { 12 | vec2 uv = -1.0 + 2.0*gl_FragCoord.xy / iResolution.xy; 13 | uv.x *= iResolution.x / iResolution.y; 14 | 15 | // background 16 | vec3 color = vec3(0.8 + 0.2*uv.y); 17 | 18 | // bubbles 19 | for( int i=0; i<40; i++ ) 20 | { 21 | // bubble seeds 22 | float pha = sin(float(i)*546.13+1.0)*0.5 + 0.5; 23 | float siz = pow( sin(float(i)*651.74+5.0)*0.5 + 0.5, 4.0 ); 24 | float pox = sin(float(i)*321.55+4.1) * iResolution.x / iResolution.y; 25 | 26 | // buble size, position and color 27 | float rad = 0.1 + 0.5*siz; 28 | vec2 pos = vec2( pox, -1.0-rad + (2.0+2.0*rad)*mod(pha+0.1*iGlobalTime*(0.2+0.8*siz),1.0)); 29 | float dis = length( uv - pos ); 30 | vec3 col = mix( vec3(0.94,0.3,0.0), vec3(0.1,0.4,0.8), 0.5+0.5*sin(float(i)*1.2+1.9)); 31 | // col+= 8.0*smoothstep( rad*0.95, rad, dis ); 32 | 33 | // render 34 | float f = length(uv-pos)/rad; 35 | f = sqrt(clamp(1.0-f*f,0.0,1.0)); 36 | color -= col.zyx *(1.0-smoothstep( rad*0.95, rad, dis )) * f; 37 | } 38 | 39 | // vigneting 40 | color *= sqrt(1.5-0.5*length(uv)); 41 | 42 | gl_FragColor = vec4(color,1.0); 43 | } 44 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4ds3zn_apollonian.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Apollonian 3 | // 4 | // https://www.shadertoy.com/view/4ds3zn 5 | // 6 | 7 | 8 | // Created by inigo quilez - iq/2013 9 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 10 | // 11 | // I can't recall where I learnt about this fractal. 12 | // 13 | // Coloring and fake occlusions are done by orbit trapping, as usual. 14 | 15 | 16 | // Antialiasing level. Make it 2 or 3 if you have a fast machine 17 | #define AA 1 18 | 19 | vec4 orb; 20 | float ss; 21 | float map( vec3 p ) 22 | { 23 | float scale = 1.0; 24 | 25 | orb = vec4(1000.0); 26 | 27 | for( int i=0; i<8;i++ ) 28 | { 29 | p = -1.0 + 2.0*fract(0.5*p+0.5); 30 | 31 | float r2 = dot(p,p); 32 | 33 | orb = min( orb, vec4(abs(p),r2) ); 34 | 35 | float k = max(ss/r2,0.1); 36 | p *= k; 37 | scale *= k; 38 | } 39 | 40 | return 0.25*abs(p.y)/scale; 41 | } 42 | 43 | float trace( in vec3 ro, in vec3 rd ) 44 | { 45 | float maxd = 30.0; 46 | float t = 0.01; 47 | for( int i=0; i<200; i++ ) 48 | { 49 | float precis = 0.001 * t; 50 | 51 | float h = map( ro+rd*t ); 52 | if( hmaxd ) break; 53 | t += h; 54 | } 55 | 56 | if( t>maxd ) t=-1.0; 57 | return t; 58 | } 59 | 60 | vec3 calcNormal( in vec3 pos, in float t ) 61 | { 62 | float precis = 0.001 * t; 63 | 64 | vec2 e = vec2(1.0,-1.0)*precis; 65 | return normalize( e.xyy*map( pos + e.xyy ) + 66 | e.yyx*map( pos + e.yyx ) + 67 | e.yxy*map( pos + e.yxy ) + 68 | e.xxx*map( pos + e.xxx ) ); 69 | } 70 | 71 | void main( void ) 72 | { 73 | float time = iGlobalTime*0.25 + 0.01*iMouse.x; 74 | ss = 1.1 + 0.5*smoothstep( -0.3, 0.3, cos(0.1*iGlobalTime) ); 75 | 76 | 77 | vec3 tot = vec3(0.0); 78 | #if AA>1 79 | for( int jj=0; jj0.0 ) 102 | { 103 | vec4 tra = orb; 104 | vec3 pos = ro + t*rd; 105 | vec3 nor = calcNormal( pos, t ); 106 | 107 | // lighting 108 | vec3 light1 = vec3( 0.577, 0.577, -0.577 ); 109 | vec3 light2 = vec3( -0.707, 0.000, 0.707 ); 110 | float key = clamp( dot( light1, nor ), 0.0, 1.0 ); 111 | float bac = clamp( 0.2 + 0.8*dot( light2, nor ), 0.0, 1.0 ); 112 | float amb = (0.7+0.3*nor.y); 113 | float ao = pow( clamp(tra.w*2.0,0.0,1.0), 1.2 ); 114 | 115 | vec3 brdf = 1.0*vec3(0.40,0.40,0.40)*amb*ao; 116 | brdf += 1.0*vec3(1.00,1.00,1.00)*key*ao; 117 | brdf += 1.0*vec3(0.40,0.40,0.40)*bac*ao; 118 | 119 | // material 120 | vec3 rgb = vec3(1.0); 121 | rgb = mix( rgb, vec3(1.0,0.80,0.2), clamp(6.0*tra.y,0.0,1.0) ); 122 | rgb = mix( rgb, vec3(1.0,0.55,0.0), pow(clamp(1.0-2.0*tra.z,0.0,1.0),8.0) ); 123 | 124 | // color 125 | col = rgb*brdf*exp(-0.2*t); 126 | } 127 | 128 | col = sqrt(col); 129 | tot += col; 130 | } 131 | 132 | tot = tot/float(AA*AA); 133 | 134 | gl_FragColor = vec4( tot, 1.0 ); 135 | 136 | // gl_FragColor=vec4(col,1.0); 137 | } 138 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4sX3Rn_menger_sponge.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 'Merger Sponge' by iq (2010) 3 | // 4 | // https://www.shadertoy.com/view/4sX3Rn? 5 | // 6 | // Created by inigo quilez 7 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 8 | // 9 | // http://www.iquilezles.org/apps/shadertoy/index2.html 10 | // 11 | // Three iterations of the famous fractal structure (pretty much inspired by untraceable/TBC). 12 | // See http://www.iquilezles.org/articles/menger/menger.htm for the full explanation of how this was done 13 | // 14 | 15 | float maxcomp(in vec3 p ) { return max(p.x,max(p.y,p.z));} 16 | float sdBox( vec3 p, vec3 b ) 17 | { 18 | vec3 di = abs(p) - b; 19 | float mc = maxcomp(di); 20 | return min(mc,length(max(di,0.0))); 21 | } 22 | 23 | mat3 ma = mat3( 0.60, 0.00, 0.80, 24 | 0.00, 1.00, 0.00, 25 | -0.80, 0.00, 0.60 ); 26 | 27 | vec4 map( in vec3 p ) 28 | { 29 | float d = sdBox(p,vec3(1.0)); 30 | vec4 res = vec4( d, 1.0, 0.0, 0.0 ); 31 | 32 | float ani = smoothstep( -0.2, 0.2, -cos(0.5*iGlobalTime) ); 33 | float off = 1.5*sin( 0.01*iGlobalTime ); 34 | 35 | float s = 1.0; 36 | for( int m=0; m<4; m++ ) 37 | { 38 | 39 | p = mix( p, ma*(p+off), ani ); 40 | 41 | vec3 a = mod( p*s, 2.0 )-1.0; 42 | s *= 3.0; 43 | vec3 r = abs(1.0 - 3.0*abs(a)); 44 | float da = max(r.x,r.y); 45 | float db = max(r.y,r.z); 46 | float dc = max(r.z,r.x); 47 | float c = (min(da,min(db,dc))-1.0)/s; 48 | 49 | if( c>d ) 50 | { 51 | d = c; 52 | res = vec4( d, min(res.y,0.2*da*db*dc), (1.0+float(m))/4.0, 0.0 ); 53 | } 54 | } 55 | 56 | return res; 57 | } 58 | 59 | vec4 intersect( in vec3 ro, in vec3 rd ) 60 | { 61 | float t = 0.0; 62 | vec4 res = vec4(-1.0); 63 | vec4 h = vec4(1.0); 64 | for( int i=0; i<64; i++ ) 65 | { 66 | if( h.x<0.002 || t>10.0 ) break; 67 | h = map(ro + rd*t); 68 | res = vec4(t,h.yzw); 69 | t += h.x; 70 | } 71 | if( t>10.0 ) res=vec4(-1.0); 72 | return res; 73 | } 74 | 75 | float softshadow( in vec3 ro, in vec3 rd, float mint, float k ) 76 | { 77 | float res = 1.0; 78 | float t = mint; 79 | float h = 1.0; 80 | for( int i=0; i<32; i++ ) 81 | { 82 | h = map(ro + rd*t).x; 83 | res = min( res, k*h/t ); 84 | t += clamp( h, 0.005, 0.1 ); 85 | } 86 | return clamp(res,0.0,1.0); 87 | } 88 | 89 | vec3 calcNormal(in vec3 pos) 90 | { 91 | vec3 eps = vec3(.001,0.0,0.0); 92 | vec3 nor; 93 | nor.x = map(pos+eps.xyy).x - map(pos-eps.xyy).x; 94 | nor.y = map(pos+eps.yxy).x - map(pos-eps.yxy).x; 95 | nor.z = map(pos+eps.yyx).x - map(pos-eps.yyx).x; 96 | return normalize(nor); 97 | } 98 | 99 | void main(void) 100 | { 101 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / iResolution.xy; 102 | p.x *= 1.33; 103 | 104 | // light 105 | vec3 light = normalize(vec3(1.0,0.9,0.3)); 106 | 107 | float ctime = iGlobalTime; 108 | // camera 109 | vec3 ro = 1.1*vec3(2.5*sin(0.25*ctime),1.0+1.0*cos(ctime*.13),2.5*cos(0.25*ctime)); 110 | vec3 ww = normalize(vec3(0.0) - ro); 111 | vec3 uu = normalize(cross( vec3(0.0,1.0,0.0), ww )); 112 | vec3 vv = normalize(cross(ww,uu)); 113 | vec3 rd = normalize( p.x*uu + p.y*vv + 2.5*ww ); 114 | 115 | // background color 116 | vec3 col = mix( vec3(0.3,0.2,0.1)*0.5, vec3(0.7, 0.9, 1.0), 0.5 + 0.5*rd.y ); 117 | 118 | vec4 tmat = intersect(ro,rd); 119 | if( tmat.x>0.0 ) 120 | { 121 | vec3 pos = ro + tmat.x*rd; 122 | vec3 nor = calcNormal(pos); 123 | 124 | float occ = tmat.y; 125 | float sha = softshadow( pos, light, 0.01, 64.0 ); 126 | 127 | float dif = max(0.1 + 0.9*dot(nor,light),0.0); 128 | float sky = 0.5 + 0.5*nor.y; 129 | float bac = max(0.4 + 0.6*dot(nor,vec3(-light.x,light.y,-light.z)),0.0); 130 | 131 | vec3 lin = vec3(0.0); 132 | lin += 1.00*dif*vec3(1.10,0.85,0.60)*sha; 133 | lin += 0.50*sky*vec3(0.10,0.20,0.40)*occ; 134 | lin += 0.10*bac*vec3(1.00,1.00,1.00)*(0.5+0.5*occ); 135 | lin += 0.25*occ*vec3(0.15,0.17,0.20); 136 | 137 | vec3 matcol = vec3( 138 | 0.5+0.5*cos(0.0+2.0*tmat.z), 139 | 0.5+0.5*cos(1.0+2.0*tmat.z), 140 | 0.5+0.5*cos(2.0+2.0*tmat.z) ); 141 | col = matcol * lin; 142 | } 143 | 144 | col = pow( col, vec3(0.4545) ); 145 | 146 | gl_FragColor = vec4(col,1.0); 147 | } 148 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4sXGDN_iterations_coral.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Iterations coral 3 | // 4 | // https://www.shadertoy.com/view/4sXGDN 5 | // 6 | 7 | // Created by inigo quilez - iq/2013 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | float hash( vec2 p ) 11 | { 12 | float h = dot(p,vec2(127.1,311.7)); 13 | 14 | return -1.0 + 2.0*fract(sin(h)*43758.5453123); 15 | } 16 | 17 | float noise( in vec2 p ) 18 | { 19 | vec2 i = floor( p ); 20 | vec2 f = fract( p ); 21 | 22 | vec2 u = f*f*(3.0-2.0*f); 23 | 24 | return mix( mix( hash( i + vec2(0.0,0.0) ), 25 | hash( i + vec2(1.0,0.0) ), u.x), 26 | mix( hash( i + vec2(0.0,1.0) ), 27 | hash( i + vec2(1.0,1.0) ), u.x), u.y); 28 | } 29 | 30 | 31 | vec2 iterate( in vec2 p, in vec4 t ) 32 | { 33 | float an = noise(13.0*p)*3.1416; 34 | an += noise(10.0*p)*3.1416; 35 | 36 | return p + 0.01*vec2(cos(an),sin(an)); 37 | } 38 | 39 | void main( void ) 40 | { 41 | vec2 q = gl_FragCoord.xy / iResolution.xy; 42 | vec2 p = -1.0 + 2.0*q; 43 | p.x *= iResolution.x/iResolution.y; 44 | 45 | p *= 0.85; 46 | 47 | p *= 3.0 + 2.0*cos(3.1*iGlobalTime/10.0); 48 | 49 | vec4 t = 0.15*iGlobalTime*vec4( 1.0, -1.5, 1.2, -1.6 ) + vec4(0.0,2.0,3.0,1.0); 50 | 51 | vec2 z = p; 52 | vec2 s = vec2(0.0); 53 | for( int i=0; i<100; i++ ) 54 | { 55 | z = iterate( z, t ); 56 | 57 | float d = dot( z-p, z-p ); 58 | s.x += abs(p.x-z.x); 59 | s.y = max( s.y, d ); 60 | } 61 | s.x /= 100.0; 62 | 63 | 64 | vec3 col = 0.5 + 0.5*cos( s.y*3.2 + 0.5+vec3(4.5,2.4,1.5) ); 65 | col *= s.x*4.0; 66 | 67 | vec3 nor = normalize( vec3( dFdx(s.x), 0.001, dFdy(s.x) ) ); 68 | col -= vec3(0.2)*dot( nor, vec3(0.7,0.1,0.7) ); 69 | 70 | col *= 1.4*s.y; 71 | 72 | col = sqrt(col)-0.16; 73 | 74 | col += 0.3*s.x*s.y*noise(p*100.0 + 40.0*s.y); 75 | 76 | col *= vec3(1.0,1.,1.4); 77 | 78 | col *= 0.5 + 0.5*pow( 16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y), 0.1 ); 79 | 80 | gl_FragColor = vec4( col, 1.0 ); 81 | } 82 | 83 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4slGD4_mountains.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Shaders/ShaderToy-4slGD4_mountains.txt -------------------------------------------------------------------------------- /Shaders/ShaderToy-4slSR4_S4550_tutorial_part_2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Shaders/ShaderToy-4slSR4_S4550_tutorial_part_2.txt -------------------------------------------------------------------------------- /Shaders/ShaderToy-4tfGRr_supernovae.txt: -------------------------------------------------------------------------------- 1 | 2 | // Supernovae 3 | 4 | // https://www.shadertoy.com/view/4tfGRr 5 | 6 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 7 | 8 | 9 | 10 | 11 | vec2 cmul( vec2 a, vec2 b ) { return vec2( a.x*b.x - a.y*b.y, a.x*b.y + a.y*b.x ); } 12 | vec2 csqr( vec2 a ) { return vec2( a.x*a.x - a.y*a.y, 2.*a.x*a.y ); } 13 | 14 | vec3 dmul( vec3 a, vec3 b ) { 15 | float r = length(a); 16 | 17 | b.xy=cmul(normalize(a.xy), b.xy); 18 | b.yz=cmul(normalize(a.yz), b.yz); 19 | // b.xz=cmul(normalize(a.xz), b.xz); 20 | 21 | return r*b; 22 | } 23 | 24 | 25 | vec3 pow4( vec3 z){ 26 | z=dmul(z,z);return dmul(z,z); 27 | } 28 | 29 | vec3 pow3( vec3 z){ 30 | float r2 = dot(z,z); 31 | vec2 a = z.xy;a=csqr(a)/dot( a,a); 32 | vec2 b = z.yz;b=csqr(b)/dot( b,b); 33 | vec2 c = z.xz;c=csqr(c)/dot( c,c); 34 | z.xy = cmul(a,z.xy); 35 | z.yz = cmul(b,z.yz); 36 | z.xz = cmul(c,z.xz); 37 | return r2*z; 38 | } 39 | 40 | mat2 rot(float a) { 41 | return mat2(cos(a),sin(a),-sin(a),cos(a)); 42 | } 43 | 44 | float zoom=4.; 45 | 46 | 47 | 48 | float field(in vec3 p) { 49 | 50 | float res = 0.; 51 | 52 | vec3 c = p; 53 | for (int i = 0; i < 10; ++i) { 54 | 55 | p = abs(p) / dot(p,p) -1.; 56 | p = dmul(p,p)+.7; 57 | res += exp(-6. * abs(dot(p,c)-.15)); 58 | 59 | } 60 | return max(0., res/3.); 61 | } 62 | 63 | 64 | 65 | vec3 raycast( in vec3 ro, vec3 rd ) 66 | { 67 | float t = 6.0; 68 | float dt = .05; 69 | vec3 col= vec3(0.); 70 | for( int i=0; i<64; i++ ) 71 | { 72 | 73 | float c = field(ro+t*rd); 74 | t+=dt/(.35+c*c); 75 | c = max(5.0 * c - .9, 0.0); 76 | col = .97*col+ .08*vec3(0.5*c*c*c, .6*c*c, c); 77 | 78 | } 79 | 80 | return col; 81 | } 82 | 83 | 84 | void main(void) 85 | { 86 | float time = iGlobalTime; 87 | vec2 q = gl_FragCoord.xy / iResolution.xy; 88 | vec2 p = -1.0 + 2.0 * q; 89 | p.x *= iResolution.x/iResolution.y; 90 | vec2 m = vec2(0.); 91 | if( iMouse.z>0.0 )m = iMouse.xy/iResolution.xy*3.14; 92 | m-=.5; 93 | 94 | // camera 95 | 96 | vec3 ro = zoom*vec3(1.); 97 | ro.yz*=rot(m.y); 98 | ro.xz*=rot(m.x+ 0.1*time); 99 | vec3 ta = vec3( 0.0 , 0.0, 0.0 ); 100 | vec3 ww = normalize( ta - ro ); 101 | vec3 uu = normalize( cross(ww,vec3(0.0,1.0,0.0) ) ); 102 | vec3 vv = normalize( cross(uu,ww)); 103 | vec3 rd = normalize( p.x*uu + p.y*vv + 4.0*ww ); 104 | 105 | 106 | // raymarch 107 | vec3 col = raycast(ro,rd); 108 | 109 | 110 | // shade 111 | 112 | col = .5 *(log(1.+col)); 113 | col = clamp(col,0.,1.); 114 | gl_FragColor = vec4( sqrt(col), 1.0 ); 115 | 116 | } 117 | 118 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-4ts3zM#_knitted.txt: -------------------------------------------------------------------------------- 1 | // 2 | // knitted_post-process 3 | // 4 | // 5 | // https://www.shadertoy.com/view/4ts3zM# 6 | // 7 | const vec2 tileSize = vec2(16.0, 16.0); 8 | const float threads = 4.0; 9 | 10 | 11 | void main(void) 12 | { 13 | vec2 posInTile = mod(vec2(gl_FragCoord), tileSize); 14 | vec2 tileNum = floor(vec2(gl_FragCoord)/ tileSize); 15 | 16 | vec2 nrmPosInTile = posInTile / tileSize; 17 | tileNum.y += floor(abs(nrmPosInTile.x - 0.5) + nrmPosInTile.y); 18 | 19 | vec2 texCoord = tileNum * tileSize / iResolution.xy; 20 | //texCoord.y = 1.0 - texCoord.y; 21 | 22 | vec3 color = texture2D(iChannel0, texCoord).rgb; 23 | 24 | color *= fract((nrmPosInTile.y + abs(nrmPosInTile.x - 0.5)) * floor(threads)); 25 | 26 | gl_FragColor = vec4(color, 1.0); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-Md2Gzh_fuzzy_field.txt: -------------------------------------------------------------------------------- 1 | // 2 | // https://www.shadertoy.com/view/Md2Gzh 3 | // 4 | 5 | // Fuzzy Field by eiffie 6 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 7 | 8 | // just trying to find a use for the new DoF renderer 9 | const float focalDistance=1.5,aperature=0.01,fudgeFactor=0.9; 10 | 11 | 12 | #define tim iGlobalTime 13 | #define size iResolution 14 | 15 | #define TAO 6.283 16 | // i got this from darkbeam i believe 17 | vec2 Kaleido(vec2 v,float power){ 18 | float angle=floor(.5+atan(v.x,-v.y)*power/TAO)*TAO/power; 19 | return cos(angle)*v+sin(angle)*vec2(v.y,-v.x); 20 | } 21 | float linstep(float a, float b, float t){return clamp((t-a)/(b-a),0.,1.);} 22 | 23 | float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html 24 | return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453); 25 | } 26 | 27 | float DE(vec3 z0) 28 | {//a field of fuzzies 29 | vec4 z = vec4(z0,1.0);z.y=-z.y;//oops upsidedown 30 | float r=length(z.xz); 31 | z.xyz+=sin(vec3(z.z,length(z.xz)*0.5+(z.z+z.x)*0.5,z.x))*0.25; 32 | z.xz=abs(mod(z.xz,3.08)-1.54)-0.77; 33 | float d=max(abs(z.y)-1.0,length(z.xz+vec2(sin(z.y*3.14159)*0.04)))-0.015*clamp(1.5-abs(z.y),0.0,1.0); 34 | z.xyz+=sin(z.zxy*25.0)*0.01; 35 | z.y+=1.0; 36 | z*=3.0; 37 | z.xy=Kaleido(z.xy,8.0); 38 | z.zy=Kaleido(z.zy,8.0); 39 | d=min(d,(max(abs(z.y)-1.0,length(z.xz+vec2(sin(z.y*3.14159)*0.04)))-0.01*clamp(1.0-abs(z.y),0.0,1.0))*0.333); 40 | z.y+=1.0; 41 | z*=3.0; 42 | z.xy=Kaleido(z.xy,8.0); 43 | z.zy=Kaleido(z.zy,8.0); 44 | d=min(d,(max(abs(z.y)-1.0,length(z.xz+vec2(sin(z.y*3.14159)*0.04)))-0.01*clamp(1.0-abs(z.y),0.0,1.0))*0.111); 45 | return d; 46 | } 47 | vec3 mcol; 48 | float CE(vec3 z0){mcol+=vec3(0.7)+sin(z0*10.0)*0.05;return DE(z0);} 49 | 50 | float pixelSize; 51 | float CircleOfConfusion(float t){//calculates the radius of the circle of confusion at length t 52 | return abs(focalDistance-t)*aperature+pixelSize*(1.0+t); 53 | } 54 | mat3 lookat(vec3 fw,vec3 up){ 55 | fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw); 56 | } 57 | void main() { 58 | pixelSize=1.0/size.y; 59 | vec3 ro=vec3(tim*0.7+cos(tim),0.5+sin(tim*0.7)*0.5,tim+sin(tim)); 60 | vec3 rd=lookat(vec3(1.0,1.7-ro.y*0.75,0.7),vec3(0.0,1.0,0.0))*normalize(vec3((2.0*gl_FragCoord.xy-size.xy)/size.y,1.0)); 61 | vec3 L=normalize(ro+vec3(0.5,2.5,0.5)); 62 | vec4 col=vec4(0.0);//color accumulator 63 | float t=0.0;//distance traveled 64 | for(int i=1;i<48;i++){//march loop 65 | if(col.w>0.9 || t>20.0)continue;//bail if we hit a surface or go out of bounds 66 | float rCoC=CircleOfConfusion(t);//calc the radius of CoC 67 | float d=DE(ro)+0.5*rCoC; 68 | if(dob(pp))c=mix(c,vec4(cos(time*.3)*.5+.5,cos(time*.2)*.5+.5,sin(time*.3)*.5+.5,1.),.3); 77 | 78 | //Final Color 79 | vec4 fcolor = ((c+vec4(f))+(1.-min(pp.y+1.9,1.))*vec4(1.,.8,.7,1.))*min(time*.5,1.); 80 | gl_FragColor=vec4(fcolor.xyz,1.0); 81 | } 82 | 83 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-MslGD8_voronoi_basic.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Voronoi Basic 3 | // 4 | // https://www.shadertoy.com/view/MslGD8 5 | // 6 | 7 | 8 | // Created by inigo quilez - iq/2013 9 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 10 | 11 | vec2 hash( vec2 p ) { p=vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))); return fract(sin(p)*43758.5453); } 12 | 13 | // return distance, and cell id 14 | vec2 voronoi( in vec2 x ) 15 | { 16 | vec2 n = floor( x ); 17 | vec2 f = fract( x ); 18 | 19 | vec3 m = vec3( 8.0 ); 20 | for( int j=-1; j<=1; j++ ) 21 | for( int i=-1; i<=1; i++ ) 22 | { 23 | vec2 g = vec2( float(i), float(j) ); 24 | vec2 o = hash( n + g ); 25 | //vec2 r = g - f + o; 26 | vec2 r = g - f + (0.5+0.5*sin(iGlobalTime+6.2831*o)); 27 | float d = dot( r, r ); 28 | if( d= end) { 107 | return end; 108 | } 109 | } 110 | return end; 111 | } 112 | 113 | // get ray direction 114 | vec3 ray_dir( float fov, vec2 size, vec2 pos ) { 115 | vec2 xy = pos - size * 0.5; 116 | 117 | float cot_half_fov = tan( ( 90.0 - fov * 0.5 ) * DEG_TO_RAD ); 118 | float z = size.y * 0.5 * cot_half_fov; 119 | 120 | return normalize( vec3( xy, -z ) ); 121 | } 122 | 123 | // camera rotation : pitch, yaw 124 | mat3 rotationXY( vec2 angle ) { 125 | vec2 c = cos( angle ); 126 | vec2 s = sin( angle ); 127 | 128 | return mat3( 129 | c.y , 0.0, -s.y, 130 | s.y * s.x, c.x, c.y * s.x, 131 | s.y * c.x, -s.x, c.y * c.x 132 | ); 133 | } 134 | 135 | void main(void) 136 | { 137 | // default ray dir 138 | vec3 dir = ray_dir( 45.0, iResolution.xy, gl_FragCoord.xy ); 139 | 140 | // default ray origin 141 | vec3 eye = vec3( 0.0, 0.0, 10.0 ); 142 | 143 | // rotate camera 144 | mat3 rot = rotationXY( vec2( iGlobalTime ) ); 145 | dir = rot * dir; 146 | eye = rot * eye; 147 | 148 | // ray marching 149 | float depth = ray_marching( eye, dir, 0.0, clip_far ); 150 | if ( depth >= clip_far ) { 151 | discard; 152 | } 153 | 154 | // shading 155 | vec3 pos = eye + dir * depth; 156 | vec3 n = gradient( pos ); 157 | gl_FragColor = vec4( shading( pos, n, eye ), 1.0 ); 158 | } 159 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-XsfSD4_warping_procedural_3.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Warping Procedural 3 3 | // 4 | // https://www.shadertoy.com/view/XsfSD4 5 | // 6 | 7 | // Created by inigo quilez - iq/2014 8 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 9 | 10 | vec2 hash( vec2 p ) 11 | { 12 | p = vec2( dot(p,vec2(2127.1,81.17)), dot(p,vec2(1269.5,283.37)) ); 13 | return fract(sin(p)*43758.5453); 14 | } 15 | 16 | float noise( in vec2 p ) 17 | { 18 | vec2 i = floor( p ); 19 | vec2 f = fract( p ); 20 | 21 | vec2 u = f*f*(3.0-2.0*f); 22 | 23 | float n = mix( mix( dot( -1.0+2.0*hash( i + vec2(0.0,0.0) ), f - vec2(0.0,0.0) ), 24 | dot( -1.0+2.0*hash( i + vec2(1.0,0.0) ), f - vec2(1.0,0.0) ), u.x), 25 | mix( dot( -1.0+2.0*hash( i + vec2(0.0,1.0) ), f - vec2(0.0,1.0) ), 26 | dot( -1.0+2.0*hash( i + vec2(1.0,1.0) ), f - vec2(1.0,1.0) ), u.x), u.y); 27 | return 0.5 + 0.5*n; 28 | } 29 | 30 | float fbm( in vec2 x ) 31 | { 32 | float m = 0.0; 33 | vec2 p = 6.0*x; 34 | 35 | float w = 0.5; 36 | float s = 1.0; 37 | for( int i=0; i<8; i++ ) 38 | { 39 | float n = noise( p*s ); 40 | m += w*n; 41 | 42 | p.y -= 1.25*(-1.0+2.0*n) - 0.1*iGlobalTime*w; // warp 43 | 44 | w *= 0.5; 45 | s *= 2.0; 46 | 47 | } 48 | 49 | return m; 50 | } 51 | 52 | void main( void ) 53 | { 54 | vec2 p = gl_FragCoord.xy/iResolution.x; 55 | 56 | // pattern 57 | float n = fbm( p ); 58 | 59 | // normal 60 | vec2 e = vec2(0.03,0.0); 61 | vec3 nor = normalize( vec3( fbm(p-e.xy)-fbm(p+e.xy), 2.0*e.x, fbm(p-e.yx)-fbm(p+e.yx) ) ); 62 | 63 | // color 64 | float c = pow(n,4.0)*6.0; 65 | vec3 col = 0.5 + 0.5*cos( 5.0 + n*12.0 + vec3(0.8,0.4,0.0) ); 66 | col *= 0.4 + 0.6*c; 67 | 68 | // light 69 | vec3 lig = normalize( vec3(1.0,0.2,1.0) ); 70 | col *= vec3(0.6,0.7,0.8) + 1.0*vec3(1.0,0.7,0.5)*clamp( 0.3 + 0.7*dot(nor,lig), 0.0, 1.0 ); 71 | col += 1.5*vec3(1.0,0.5,0.0)*pow(1.0-nor.y,2.0)*c; 72 | 73 | // postpro 74 | col = sqrt(col)-0.15; 75 | col *= sqrt(1.0-0.5*abs(p.x-0.5)); 76 | 77 | gl_FragColor = vec4( col, 1.0 ); 78 | } 79 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-Xsl3zN_fire.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Fire 3 | // 4 | // https://www.shadertoy.com/view/Xsl3zN 5 | 6 | // by @301z 7 | 8 | float rand(vec2 n) { 9 | return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); 10 | } 11 | 12 | float noise(vec2 n) { 13 | const vec2 d = vec2(0.0, 1.0); 14 | vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n)); 15 | return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y); 16 | } 17 | 18 | float fbm(vec2 n) { 19 | float total = 0.0, amplitude = 1.0; 20 | for (int i = 0; i < 7; i++) { 21 | total += noise(n) * amplitude; 22 | n += n; 23 | amplitude *= 0.5; 24 | } 25 | return total; 26 | } 27 | 28 | void main() { 29 | const vec3 c1 = vec3(0.1, 0.0, 0.0); 30 | const vec3 c2 = vec3(0.7, 0.0, 0.0); 31 | const vec3 c3 = vec3(0.2, 0.0, 0.0); 32 | const vec3 c4 = vec3(1.0, 0.9, 0.0); 33 | const vec3 c5 = vec3(0.1); 34 | const vec3 c6 = vec3(0.9); 35 | vec2 p = gl_FragCoord.xy * 8.0 / iResolution.xx; 36 | float q = fbm(p - iGlobalTime * 0.1); 37 | vec2 r = vec2(fbm(p + q + iGlobalTime * 0.7 - p.x - p.y), fbm(p + q - iGlobalTime * 0.4)); 38 | vec3 c = mix(c1, c2, fbm(p + r)) + mix(c3, c4, r.x) - mix(c5, c6, r.y); 39 | gl_FragColor = vec4(c * cos(1.57 * gl_FragCoord.y / iResolution.y), 1.0); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-XslGRr_clouds.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Clouds 3 | // 4 | // https://www.shadertoy.com/view/XslGRr 5 | // 6 | // Created by inigo quilez - iq/2013 7 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 8 | // 9 | 10 | // hash based 3d value noise 11 | float hash( float n ) 12 | { 13 | return fract(sin(n)*43758.5453); 14 | } 15 | 16 | float noise( in vec3 x ) 17 | { 18 | vec3 p = floor(x); 19 | vec3 f = fract(x); 20 | 21 | f = f*f*(3.0-2.0*f); 22 | float n = p.x + p.y*57.0 + 113.0*p.z; 23 | return mix(mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), 24 | mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y), 25 | mix(mix( hash(n+113.0), hash(n+114.0),f.x), 26 | mix( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z); 27 | } 28 | 29 | 30 | vec4 map( in vec3 p ) 31 | { 32 | float d = 0.2 - p.y; 33 | 34 | vec3 q = p - vec3(1.0,0.1,0.0)*iGlobalTime; 35 | float f; 36 | f = 0.5000*noise( q ); q = q*2.02; 37 | f += 0.2500*noise( q ); q = q*2.03; 38 | f += 0.1250*noise( q ); q = q*2.01; 39 | f += 0.0625*noise( q ); 40 | 41 | d += 3.0 * f; 42 | 43 | d = clamp( d, 0.0, 1.0 ); 44 | 45 | vec4 res = vec4( d ); 46 | 47 | res.xyz = mix( 1.15*vec3(1.0,0.95,0.8), vec3(0.7,0.7,0.7), res.x ); 48 | 49 | return res; 50 | } 51 | 52 | 53 | vec3 sundir = vec3(-1.0,0.0,0.0); 54 | 55 | 56 | vec4 raymarch( in vec3 ro, in vec3 rd ) 57 | { 58 | vec4 sum = vec4(0, 0, 0, 0); 59 | 60 | float t = 0.0; 61 | for(int i=0; i<64; i++) { 62 | if( sum.a > 0.99 ) continue; 63 | vec3 pos = ro + t*rd; 64 | vec4 col = map( pos ); 65 | 66 | #if 1 67 | float dif = clamp((col.w - map(pos+0.3*sundir).w)/0.6, 0.0, 1.0 ); 68 | vec3 lin = vec3(0.65,0.68,0.7)*1.35 + 0.45*vec3(0.7, 0.5, 0.3)*dif; 69 | col.xyz *= lin; 70 | #endif 71 | 72 | col.a *= 0.35; 73 | col.rgb *= col.a; 74 | 75 | sum = sum + col*(1.0 - sum.a); 76 | 77 | #if 0 78 | t += 0.1; 79 | #else 80 | t += max(0.1,0.025*t); 81 | #endif 82 | 83 | } 84 | 85 | sum.xyz /= (0.001+sum.w); 86 | 87 | return clamp( sum, 0.0, 1.0 ); 88 | } 89 | 90 | 91 | void main(void) 92 | { 93 | vec2 q = gl_FragCoord.xy / iResolution.xy; 94 | vec2 p = -1.0 + 2.0*q; 95 | p.x *= iResolution.x/ iResolution.y; 96 | vec2 mo = -1.0 + 2.0*iMouse.xy / iResolution.xy; 97 | 98 | // camera 99 | vec3 ro = 4.0*normalize(vec3(cos(2.75-3.0*mo.x), 0.7+(mo.y+1.0), sin(2.75-3.0*mo.x))); 100 | vec3 ta = vec3(0.0, 1.0, 0.0); 101 | vec3 ww = normalize( ta - ro); 102 | vec3 uu = normalize(cross( vec3(0.0,1.0,0.0), ww )); 103 | vec3 vv = normalize(cross(ww,uu)); 104 | vec3 rd = normalize( p.x*uu + p.y*vv + 1.5*ww ); 105 | 106 | vec4 res = raymarch( ro, rd ); 107 | float sun = clamp( dot(sundir,rd), 0.0, 1.0 ); 108 | 109 | vec3 col = vec3(0.6,0.71,0.75) - rd.y*0.2*vec3(1.0,0.5,1.0) + 0.15*0.5; 110 | 111 | col += 0.2*vec3(1.0,.6,0.1)*pow( sun, 8.0 ); 112 | col *= 0.95; 113 | col = mix( col, res.xyz, res.w ); 114 | col += 0.1*vec3(1.0,0.4,0.2)*pow( sun, 3.0 ); 115 | 116 | gl_FragColor = vec4( col, 1.0 ); 117 | } 118 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-XssXz4_neon_parallax.txt: -------------------------------------------------------------------------------- 1 | 2 | // https://www.shadertoy.com/view/XssXz4 3 | 4 | //Neon parallax by nimitz (stormoid.com) (twitter: @stormoid) 5 | 6 | #define t iGlobalTime 7 | 8 | float pulse(float cn, float wi, float x) 9 | { 10 | return 1.-smoothstep(0., wi, abs(x-cn)); 11 | } 12 | 13 | float hash11(float n) 14 | { 15 | return fract(sin(n)*43758.5453); 16 | } 17 | 18 | vec2 hash22(vec2 p) 19 | { 20 | p = vec2( dot(p,vec2(127.1, 311.7)), dot(p,vec2(269.5, 183.3))); 21 | return fract(sin(p)*43758.5453); 22 | } 23 | 24 | vec2 field(in vec2 p) 25 | { 26 | vec2 n = floor(p); 27 | vec2 f = fract(p); 28 | vec2 m = vec2(1.); 29 | vec2 o = hash22(n)*0.17; 30 | vec2 r = f+o-0.5; 31 | float d = abs(r.x) + abs(r.y); 32 | if(d0.0 && v1<1.0 && u1>0.0 && u1<1.0; 41 | bool b2 = v2>0.0 && v2<1.0 && u2>0.0 && u2<1.0; 42 | 43 | vec2 res = vec2(-1.0); 44 | 45 | if( b1 && !b2 ) res = vec2( u1, v1 ); 46 | if( !b1 && b2 ) res = vec2( u2, v2 ); 47 | 48 | return res; 49 | } 50 | 51 | float sdSegment( in vec2 p, in vec2 a, in vec2 b ) 52 | { 53 | vec2 pa = p - a; 54 | vec2 ba = b - a; 55 | float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 ); 56 | return length( pa - ba*h ); 57 | } 58 | 59 | vec3 hash3( float n ) { return fract(sin(vec3(n,n+1.0,n+2.0))*43758.5453123); } 60 | 61 | void main( void ) 62 | { 63 | vec2 p = (-iResolution.xy + 2.0*gl_FragCoord.xy)/iResolution.y; 64 | 65 | // background 66 | vec3 col = vec3( 0.35 + 0.1*p.y ); 67 | 68 | // move points 69 | vec2 a = cos( 1.11*iGlobalTime + vec2(0.1,4.0) ); 70 | vec2 b = cos( 1.13*iGlobalTime + vec2(1.0,3.0) ); 71 | vec2 c = cos( 1.17*iGlobalTime + vec2(2.0,2.0) ); 72 | vec2 d = cos( 1.15*iGlobalTime + vec2(3.0,1.0) ); 73 | 74 | // area of the quad 75 | vec2 uv = invBilinear( p, a, b, c, d ); 76 | if( uv.x>-0.5 ) 77 | { 78 | col = texture2D( iChannel0, uv ).xyz; 79 | } 80 | 81 | // quad borders 82 | float h = 2.0/iResolution.y; 83 | col = mix( col, vec3(1.0,0.7,0.2), 1.0-smoothstep(h,2.0*h,sdSegment(p,a,b))); 84 | col = mix( col, vec3(1.0,0.7,0.2), 1.0-smoothstep(h,2.0*h,sdSegment(p,b,c))); 85 | col = mix( col, vec3(1.0,0.7,0.2), 1.0-smoothstep(h,2.0*h,sdSegment(p,c,d))); 86 | col = mix( col, vec3(1.0,0.7,0.2), 1.0-smoothstep(h,2.0*h,sdSegment(p,d,a))); 87 | 88 | col += (1.0/255.0)*hash3(p.x+13.0*p.y); 89 | 90 | gl_FragColor = vec4( col, 1.0 ); 91 | } 92 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-iq2014_voronoise.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Voronoise 3 | // 4 | // Created by inigo quilez - iq/2014 5 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 6 | // 7 | // This is a procedural pattern that has 2 parameters, that generalizes cell-noise, 8 | // perlin-noise and voronoi, all of which can be written in terms of the former as: 9 | // 10 | // cellnoise(x) = pattern(0,0,x) 11 | // perlin(x) = pattern(0,1,x) 12 | // voronoi(x) = pattern(1,0,x) 13 | // 14 | // From this generalization of the three famouse patterns, a new one (which I call 15 | // "Voronoise") emerges naturally. It's like perlin noise a bit, but within a jittered 16 | // grid like voronoi): 17 | // 18 | // voronoise(x) = pattern(1,1,x) 19 | // 20 | // Not sure what one would use this generalization for, because it's slightly slower 21 | // than perlin or voronoise (and certainly much slower than cell noise), and in the 22 | // end as a shading TD you just want one or another depending of the type of visual 23 | // features you are looking for, I can't see a blending being needed in real life. 24 | // But well, if only for the math fun it was worth trying. And they say a bit of 25 | // mathturbation can be healthy anyway! 26 | 27 | 28 | // Use the mouse to blend between different patterns: 29 | 30 | // ell noise u=0,v=0 31 | // voronoi u=1,v=0 32 | // perlin noise u=0,v1= 33 | // voronoise u=1,v=1 34 | 35 | // More info here: http://iquilezles.org/www/articles/voronoise/voronoise.htm 36 | 37 | vec3 hash3( vec2 p ) 38 | { 39 | vec3 q = vec3( dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)), dot(p,vec2(419.2,371.9)) ); 40 | return fract(sin(q)*43758.5453); 41 | } 42 | 43 | float iqnoise( in vec2 x, float u, float v ) 44 | { 45 | vec2 p = floor(x); 46 | vec2 f = fract(x); 47 | 48 | float k = 1.0+63.0*pow(1.0-v,4.0); 49 | 50 | float va = 0.0; 51 | float wt = 0.0; 52 | for( int j=-2; j<=2; j++ ) { 53 | for( int i=-2; i<=2; i++ ) { 54 | vec2 g = vec2( float(i),float(j) ); 55 | vec3 o = hash3( p + g )*vec3(u,u,1.0); 56 | vec2 r = g - f + o.xy; 57 | float d = dot(r,r); 58 | float ww = pow( 1.0-smoothstep(0.0,1.414,sqrt(d)), k ); 59 | va += o.z*ww; 60 | wt += ww; 61 | } 62 | } 63 | 64 | return va/wt; 65 | } 66 | 67 | 68 | void main(void) 69 | { 70 | vec2 p; 71 | 72 | vec2 uv = gl_FragCoord.xy / iResolution.xx; 73 | 74 | // p = 0.5 - 0.5*sin( vec2(1.01, 1.71) ); // squares 75 | // p = 0.5 - 0.5*sin( 4.0*vec2(1.01, 1.71) ); // voronoi 76 | 77 | p = 0.5 - 0.5*sin( iGlobalTime*vec2(1.01, 1.71) ); 78 | 79 | // Uncomment this for control over voronoi and blur with mouse x and y 80 | // if( iMouse.w > 0.001 ) p = vec2(0.0, 1.0) + vec2(1.0,-1.0)*iMouse.xy/iResolution.xy; 81 | 82 | p = p*p*(3.0-2.0*p); 83 | p = p*p*(3.0-2.0*p); 84 | p = p*p*(3.0-2.0*p); 85 | 86 | float f = iqnoise( 24.0*uv, p.x, p.y ); 87 | 88 | gl_FragColor = vec4( f, f, f, 1.0 ); 89 | 90 | } 91 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-ldf3DN_mandelbrot_orbit_traps.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leadedge/ShaderLoader/44c9205cb9eeb7bc3154d428fe0ea08c451e6f38/Shaders/ShaderToy-ldf3DN_mandelbrot_orbit_traps.txt -------------------------------------------------------------------------------- /Shaders/ShaderToy-lsXGz8_time.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Input Time 3 | // 4 | // https://www.shadertoy.com/view/lsXGz8 5 | // 6 | 7 | 8 | // Created by inigo quilez - iq/2013 9 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 10 | 11 | float sdSegment( in vec2 p, in vec2 a, in vec2 b ) 12 | { 13 | vec2 pa = p-a, ba = b-a; 14 | float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 ); 15 | return length( pa - ba*h ); 16 | } 17 | 18 | vec3 line( in vec3 buf, in vec2 a, in vec2 b, in vec2 p, in vec2 w, in vec4 col ) 19 | { 20 | float f = sdSegment( p, a, b ); 21 | float g = fwidth(f)*w.y; 22 | return mix( buf, col.xyz, col.w*(1.0-smoothstep(w.x-g, w.x+g, f)) ); 23 | } 24 | 25 | vec3 hash3( float n ) { return fract(sin(vec3(n,n+1.0,n+2.0))*43758.5453123); } 26 | 27 | void main( void ) 28 | { 29 | // get time 30 | float mils = fract(iDate.w); 31 | float secs = mod( floor(iDate.w), 60.0 ); 32 | float mins = mod( floor(iDate.w/60.0), 60.0 ); 33 | float hors = mod( floor(iDate.w/3600.0), 24.0 ); 34 | 35 | // enable this for subsecond resolution 36 | //secs += mils; 37 | 38 | vec2 uv = (2.0*gl_FragCoord.xy-iResolution.xy)/min(iResolution.y,iResolution.x); 39 | 40 | float r = length( uv ); 41 | float a = atan( uv.y, uv.x )+3.1415926; 42 | 43 | // background color 44 | vec3 nightColor = vec3( 0.2, 0.2, 0.2 ) + 0.1*uv.y; 45 | vec3 dayColor = vec3( 0.5, 0.6, 0.7 ) + 0.2*uv.y; 46 | vec3 col = mix( nightColor, dayColor, smoothstep( 5.0, 7.0, hors ) - 47 | smoothstep(19.0,21.0, hors ) ); 48 | 49 | // inner watch body 50 | col = mix( col, vec3(0.9-0.4*pow(r,4.0)), 1.0-smoothstep(0.94,0.95,r) ); 51 | 52 | // 5 minute marks 53 | float f = abs(2.0*fract(0.5+a*60.0/6.2831)-1.0); 54 | float g = 1.0-smoothstep( 0.0, 0.1, abs(2.0*fract(0.5+a*12.0/6.2831)-1.0) ); 55 | float w = fwidth(f); 56 | f = 1.0 - smoothstep( 0.1*g+0.05-w, 0.1*g+0.05+w, f ); 57 | f *= smoothstep( 0.85, 0.86, r+0.05*g ) - smoothstep( 0.94, 0.95, r ); 58 | col = mix( col, vec3(0.0), f ); 59 | 60 | // seconds hand 61 | vec2 dir; 62 | dir = vec2( sin(6.2831*secs/60.0), cos(6.2831*secs/60.0) ); 63 | col = line( col, vec2(0.0), dir*0.9, uv+0.05, vec2(0.005,4.0), vec4(0.0,0.0,0.0,0.2) ); 64 | col = line( col, vec2(0.0), dir*0.9, uv, vec2(0.005,1.0), vec4(0.5,0.0,0.0,1.0) ); 65 | 66 | // minutes hand 67 | dir = vec2( sin(6.2831*mins/60.0), cos(6.2831*mins/60.0) ); 68 | col = line( col, vec2(0.0), dir*0.7, uv+0.05, vec2(0.015,4.0), vec4(0.0,0.0,0.0,0.2) ); 69 | col = line( col, vec2(0.0), dir*0.7, uv, vec2(0.015,1.0), vec4(0.0,0.0,0.0,1.0) ); 70 | 71 | // hours hand 72 | dir = vec2( sin(6.2831*hors/12.0), cos(6.2831*hors/12.0) ); 73 | col = line( col, vec2(0.0), dir*0.4, uv+0.05, vec2(0.015,4.0), vec4(0.0,0.0,0.0,0.2) ); 74 | col = line( col, vec2(0.0), dir*0.4, uv, vec2(0.015,1.0), vec4(0.0,0.0,0.0,1.0) ); 75 | 76 | // center mini circle 77 | col = mix( col, vec3(0.5), 1.0-smoothstep(0.050,0.055,r) ); 78 | col = mix( col, vec3(0.0), 1.0-smoothstep(0.005,0.01,abs(r-0.055)) ); 79 | 80 | // border of watch 81 | col = mix( col, vec3(0.0), 1.0-smoothstep(0.01,0.02,abs(r-0.95)) ); 82 | 83 | // dithering 84 | col += (1.0/255.0)*hash3(uv.x+13.0*uv.y); 85 | 86 | gl_FragColor = vec4( col,1.0 ); 87 | } 88 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-lsf3RH_ball_of_fire.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Ball of Fire 3 | // 4 | // https://www.shadertoy.com/view/lsf3RH 5 | // 6 | 7 | float snoise(vec3 uv, float res) 8 | { 9 | const vec3 s = vec3(1e0, 1e2, 1e3); 10 | 11 | uv *= res; 12 | 13 | vec3 uv0 = floor(mod(uv, res))*s; 14 | vec3 uv1 = floor(mod(uv+vec3(1.), res))*s; 15 | 16 | vec3 f = fract(uv); f = f*f*(3.0-2.0*f); 17 | 18 | vec4 v = vec4(uv0.x+uv0.y+uv0.z, uv1.x+uv0.y+uv0.z, 19 | uv0.x+uv1.y+uv0.z, uv1.x+uv1.y+uv0.z); 20 | 21 | vec4 r = fract(sin(v*1e-1)*1e3); 22 | float r0 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y); 23 | 24 | r = fract(sin((v + uv1.z - uv0.z)*1e-1)*1e3); 25 | float r1 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y); 26 | 27 | return mix(r0, r1, f.z)*2.-1.; 28 | } 29 | 30 | void main(void) 31 | { 32 | vec2 p = -.5 + gl_FragCoord.xy / iResolution.xy; 33 | p.x *= iResolution.x/iResolution.y; 34 | 35 | float color = 3.0 - (3.*length(2.*p)); 36 | 37 | vec3 coord = vec3(atan(p.x,p.y)/6.2832+.5, length(p)*.4, .5); 38 | 39 | for(int i = 1; i <= 7; i++) 40 | { 41 | float power = pow(2.0, float(i)); 42 | color += (1.5 / power) * snoise(coord + vec3(0.,-iGlobalTime*.05, iGlobalTime*.01), power*16.); 43 | } 44 | gl_FragColor = vec4( color, pow(max(color,0.),2.)*0.4, pow(max(color,0.),3.)*0.15 , 1.0); 45 | } 46 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-lsfGDB_disk_intersection.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Disk Intersection 3 | // 4 | // https://www.shadertoy.com/view/lsfGDB 5 | // 6 | 7 | 8 | // Created by inigo quilez - iq/2013 9 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 10 | 11 | #if 1 12 | // 13 | // Elegant way to intersect a planar coordinate system (3x3 linear system) 14 | // 15 | vec3 intersectCoordSys( in vec3 o, in vec3 d, vec3 c, vec3 u, vec3 v ) 16 | { 17 | vec3 q = o - c; 18 | return vec3( 19 | dot( cross(u,v), q ), 20 | dot( cross(q,u), d ), 21 | dot( cross(v,q), d ) ) / 22 | dot( cross(v,u), d ); 23 | } 24 | 25 | #else 26 | // 27 | // Ugly (but faster) way to intersect a planar coordinate system: plane + projection 28 | // 29 | vec3 intersectCoordSys( in vec3 o, in vec3 d, vec3 c, vec3 u, vec3 v ) 30 | { 31 | vec3 q = o - c; 32 | vec3 n = cross(u,v); 33 | float t = -dot(n,q)/dot(d,n); 34 | float r = dot(u,q + d*t); 35 | float s = dot(v,q + d*t); 36 | return vec3(t,s,r); 37 | } 38 | 39 | #endif 40 | 41 | vec3 hash3( float n ) 42 | { 43 | return fract(sin(vec3(n,n+1.0,n+2.0))*vec3(43758.5453123,12578.1459123,19642.3490423)); 44 | } 45 | 46 | vec3 shade( in vec4 res ) 47 | { 48 | float ra = length(res.yz); 49 | float an = atan(res.y,res.z) + 8.0*iGlobalTime; 50 | float pa = sin(3.0*an); 51 | 52 | vec3 cola = 0.5 + 0.5*sin( (res.w/64.0)*3.5 + vec3(0.0,1.0,2.0) ); 53 | 54 | vec3 col = vec3(0.0); 55 | col += cola*0.4*(1.0-smoothstep( 0.90, 1.00, ra) ); 56 | col += cola*1.0*(1.0-smoothstep( 0.00, 0.03, abs(ra-0.8)))*(0.5+0.5*pa); 57 | col += cola*1.0*(1.0-smoothstep( 0.00, 0.20, abs(ra-0.8)))*(0.5+0.5*pa); 58 | col += cola*0.5*(1.0-smoothstep( 0.05, 0.10, abs(ra-0.5)))*(0.5+0.5*pa); 59 | col += cola*0.7*(1.0-smoothstep( 0.00, 0.30, abs(ra-0.5)))*(0.5+0.5*pa); 60 | 61 | return col*0.3; 62 | } 63 | 64 | void main( void ) 65 | { 66 | vec2 q = gl_FragCoord.xy / iResolution.xy; 67 | vec2 p = -1.0 + 2.0 * q; 68 | p.x *= iResolution.x/iResolution.y; 69 | 70 | // camera 71 | vec3 ro = 2.0*vec3(cos(0.5*iGlobalTime*1.1),0.0,sin(0.5*iGlobalTime*1.1)); 72 | vec3 ta = vec3(0.0,0.0,0.0); 73 | // camera matrix 74 | vec3 ww = normalize( ta - ro ); 75 | vec3 uu = normalize( cross(ww,vec3(0.0,1.0,0.0) ) ); 76 | vec3 vv = normalize( cross(uu,ww)); 77 | // create view ray 78 | vec3 rd = normalize( p.x*uu + p.y*vv + 1.0*ww ); 79 | 80 | // raytrace 81 | vec3 col = vec3( 0.0 ); 82 | for( int i=0; i<64; i++ ) 83 | { 84 | // position disk 85 | vec3 r = 2.5*(-1.0 + 2.0*hash3( float(i) )); 86 | 87 | // orientate disk 88 | vec3 u = normalize( r.zxy ); 89 | vec3 v = normalize( cross( u, vec3(0.0,1.0,0.0 ) ) ); 90 | 91 | // intersect coord sys 92 | vec3 tmp = intersectCoordSys( ro, rd, r, u, v ); 93 | 94 | if( dot(tmp.yz,tmp.yz)<1.0 && tmp.x>0.0 ) 95 | { 96 | // shade 97 | col += shade( vec4(tmp,float(i)) ); 98 | } 99 | } 100 | 101 | gl_FragColor = vec4( col, 1.0 ); 102 | } 103 | -------------------------------------------------------------------------------- /Shaders/ShaderToy-lsl3RH_warping_procedural_2.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Warping Procedural 2 3 | // 4 | // https://www.shadertoy.com/view/lsl3RH? 5 | // 6 | // Created by inigo quilez - iq/2013 7 | // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 8 | 9 | // See here for a tutorial on how to make this: http://www.iquilezles.org/www/articles/warp/warp.htm 10 | 11 | const mat2 m = mat2( 0.80, 0.60, -0.60, 0.80 ); 12 | 13 | float noise( in vec2 x ) 14 | { 15 | return sin(1.5*x.x)*sin(1.5*x.y); 16 | } 17 | 18 | float fbm4( vec2 p ) 19 | { 20 | float f = 0.0; 21 | f += 0.5000*noise( p ); p = m*p*2.02; 22 | f += 0.2500*noise( p ); p = m*p*2.03; 23 | f += 0.1250*noise( p ); p = m*p*2.01; 24 | f += 0.0625*noise( p ); 25 | return f/0.9375; 26 | } 27 | 28 | float fbm6( vec2 p ) 29 | { 30 | float f = 0.0; 31 | f += 0.500000*(0.5+0.5*noise( p )); p = m*p*2.02; 32 | f += 0.250000*(0.5+0.5*noise( p )); p = m*p*2.03; 33 | f += 0.125000*(0.5+0.5*noise( p )); p = m*p*2.01; 34 | f += 0.062500*(0.5+0.5*noise( p )); p = m*p*2.04; 35 | f += 0.031250*(0.5+0.5*noise( p )); p = m*p*2.01; 36 | f += 0.015625*(0.5+0.5*noise( p )); 37 | return f/0.96875; 38 | } 39 | 40 | 41 | float func( vec2 q, out vec4 ron ) 42 | { 43 | float ql = length( q ); 44 | q.x += 0.05*sin(0.27*iGlobalTime+ql*4.1); 45 | q.y += 0.05*sin(0.23*iGlobalTime+ql*4.3); 46 | q *= 0.5; 47 | 48 | vec2 o = vec2(0.0); 49 | o.x = 0.5 + 0.5*fbm4( vec2(2.0*q ) ); 50 | o.y = 0.5 + 0.5*fbm4( vec2(2.0*q+vec2(5.2)) ); 51 | 52 | float ol = length( o ); 53 | o.x += 0.02*sin(0.12*iGlobalTime+ol)/ol; 54 | o.y += 0.02*sin(0.14*iGlobalTime+ol)/ol; 55 | 56 | vec2 n; 57 | n.x = fbm6( vec2(4.0*o+vec2(9.2)) ); 58 | n.y = fbm6( vec2(4.0*o+vec2(5.7)) ); 59 | 60 | vec2 p = 4.0*q + 4.0*n; 61 | 62 | float f = 0.5 + 0.5*fbm4( p ); 63 | 64 | f = mix( f, f*f*f*3.5, f*abs(n.x) ); 65 | 66 | float g = 0.5 + 0.5*sin(4.0*p.x)*sin(4.0*p.y); 67 | f *= 1.0-0.5*pow( g, 8.0 ); 68 | 69 | ron = vec4( o, n ); 70 | 71 | return f; 72 | } 73 | 74 | 75 | 76 | vec3 doMagic(vec2 p) 77 | { 78 | vec2 q = p*0.6; 79 | 80 | vec4 on = vec4(0.0); 81 | float f = func(q, on); 82 | 83 | vec3 col = vec3(0.0); 84 | col = mix( vec3(0.2,0.1,0.4), vec3(0.3,0.05,0.05), f ); 85 | col = mix( col, vec3(0.9,0.9,0.9), dot(on.zw,on.zw) ); 86 | col = mix( col, vec3(0.4,0.3,0.3), 0.5*on.y*on.y ); 87 | col = mix( col, vec3(0.0,0.2,0.4), 0.5*smoothstep(1.2,1.3,abs(on.z)+abs(on.w)) ); 88 | col = clamp( col*f*2.0, 0.0, 1.0 ); 89 | 90 | vec3 nor = normalize( vec3( dFdx(f)*iResolution.x, 6.0, dFdy(f)*iResolution.y ) ); 91 | vec3 lig = normalize( vec3( 0.9, -0.2, -0.4 ) ); 92 | float dif = clamp( 0.3+0.7*dot( nor, lig ), 0.0, 1.0 ); 93 | 94 | vec3 bdrf; 95 | bdrf = vec3(0.70,0.90,0.95)*(nor.y*0.5+0.5); 96 | bdrf += vec3(0.15,0.10,0.05)*dif; 97 | col *= 1.2*bdrf; 98 | col = 1.0-col; 99 | 100 | return 1.1*col*col; 101 | 102 | } 103 | void main(void) 104 | { 105 | vec2 q = gl_FragCoord.xy / iResolution.xy; 106 | vec2 p = -1.0 + 2.0 * q; 107 | p.x *= iResolution.x/iResolution.y; 108 | 109 | gl_FragColor = vec4( doMagic( p ), 1.0 ); 110 | } 111 | -------------------------------------------------------------------------------- /Shaders/chocolux.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 'Chocolux' by Auld (2008) 3 | // 4 | // http://www.iquilezles.org/apps/shadertoy/index2.html 5 | // 6 | // Based on a production from the demoscene, the famous 1k intro Chocolux (http://www.pouet.net/prod.php?which=49796) 7 | // 8 | 9 | #ifdef GL_ES 10 | precision highp float; 11 | #endif 12 | 13 | uniform vec2 resolution; 14 | uniform float time; 15 | 16 | void main(void) 17 | { 18 | vec3 s[4]; 19 | s[0]=vec3(0); 20 | s[3]=vec3(sin(time),cos(time),0); 21 | s[1]=s[3].zxy; 22 | s[2]=s[3].zzx; 23 | 24 | float t,b,c,h=0.0; 25 | vec3 m,n; 26 | vec3 p=vec3(.2); 27 | vec3 d=normalize(.001*gl_FragCoord.rgb-p); 28 | for(int i=0;i<4;i++) 29 | { 30 | t=2.0; 31 | for(int i=0;i<4;i++) 32 | { 33 | b=dot(d,n=s[i]-p); 34 | c=b*b+.2-dot(n,n); 35 | if(b-c0.0) 37 | { 38 | m=s[i]; 39 | t=b-c; 40 | } 41 | } 42 | p+=t*d; 43 | d=reflect(d,n=normalize(p-m)); 44 | h+=pow(n.x*n.x,44.)+n.x*n.x*.2; 45 | } 46 | gl_FragColor=vec4(h,h*h,h*h*h*h,1); 47 | } 48 | -------------------------------------------------------------------------------- /Shaders/clod.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'You Massive Clod' by Tigrou (2008) 5 | // 6 | // Code for the 1k intro You Massive Clod from the demoscene (http://www.pouet.net/prod.php?which=51762). 7 | // It made 5th position in the Function 2008 demoparty 8 | // 9 | 10 | #ifdef GL_ES 11 | precision highp float; 12 | #endif 13 | 14 | uniform vec2 resolution; 15 | uniform float time; 16 | 17 | float f(vec3 o) 18 | { 19 | float a=(sin(o.x)+o.y*.25)*.35; 20 | o=vec3(cos(a)*o.x-sin(a)*o.y,sin(a)*o.x+cos(a)*o.y,o.z); 21 | return dot(cos(o)*cos(o),vec3(1))-1.2; 22 | } 23 | 24 | #if 1 25 | // 26 | // modified by iq: 27 | // removed the break inside the marching loop (GLSL compatibility) 28 | // replaced 10 step binary search by a linear interpolation 29 | // 30 | vec3 s(vec3 o,vec3 d) 31 | { 32 | float t=0.0; 33 | float dt = 0.2; 34 | float nh = 0.0; 35 | float lh = 0.0; 36 | for(int i=0;i<50;i++) 37 | { 38 | nh = f(o+d*t); 39 | if(nh>0.0) { lh=nh; t+=dt; } 40 | } 41 | 42 | if( nh>0.0 ) return vec3(.93,.94,.85); 43 | 44 | t = t - dt*nh/(nh-lh); 45 | 46 | vec3 e=vec3(.1,0.0,0.0); 47 | vec3 p=o+d*t; 48 | vec3 n=-normalize(vec3(f(p+e),f(p+e.yxy),f(p+e.yyx))+vec3((sin(p*75.)))*.01); 49 | 50 | return vec3( mix( ((max(-dot(n,vec3(.577)),0.) + 0.125*max(-dot(n,vec3(-.707,-.707,0)),0.)))*(mod 51 | 52 | (length(p.xy)*20.,2.)<1.0?vec3(.71,.85,.25):vec3(.79,.93,.4)) 53 | ,vec3(.93,.94,.85), vec3(pow(t/9.,5.)) ) ); 54 | } 55 | #else 56 | // 57 | // original marching 58 | // 59 | vec3 s(vec3 o,vec3 d) 60 | { 61 | float t=0.,a,b; 62 | for(int i=0;i<75;i++) 63 | { 64 | if(f(o+d*t)<0.0) 65 | { 66 | a=t-.125;b=t; 67 | for(int i=0; i<10;i++) 68 | { 69 | t=(a+b)*.5; 70 | if(f(o+d*t)<0.0) 71 | b=t; 72 | else 73 | a=t; 74 | } 75 | vec3 e=vec3(.1,0.0,0.0); 76 | vec3 p=o+d*t; 77 | vec3 n=-normalize(vec3(f(p+e),f(p+e.yxy),f(p+e.yyx))+vec3((sin(p*75.)))*.01); 78 | 79 | return vec3( mix( ((max(-dot(n,vec3(.577)),0.) + 0.125*max(-dot(n,vec3(-.707,-.707,0)),0.)))*(mod(length(p.xy)*20.,2.)<1.0?vec3(.71,.85,.25):vec3(.79,.93,.4)) 80 | ,vec3(.93,.94,.85), vec3(pow(t/9.,5.)) ) ); 81 | } 82 | t+=.125; 83 | } 84 | return vec3(.93,.94,.85); 85 | } 86 | #endif 87 | 88 | void main() 89 | { 90 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy; 91 | gl_FragColor=vec4(s(vec3(sin(time*1.5)*.5,cos(time)*.5,time), normalize(vec3(p.xy,1.0))),1.0); 92 | } 93 | -------------------------------------------------------------------------------- /Shaders/colour-input_example.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Colour input example 3 | // 4 | // Uses the ShaderLoader specific "inputColour" 5 | // 6 | // This is linked to user controls for Red, Green, Blue and Alpha 7 | // 8 | // For a GLSL Sandbox shader, the uniforms are contained 9 | // within the shader file, so "colourInput" has to be included 10 | // 11 | // uniform vec4 inputColour; // specific for ShaderLoader 12 | // 13 | // 14 | // For a ShaderToy shader, the additional "colourInput" uniform 15 | // is included by ShaderLoader, so can be referred to in the shader. 16 | // 17 | 18 | void main(void) 19 | { 20 | gl_FragColor = vec4(inputColour.r, inputColour.g, inputColour.b, inputColour.a); 21 | } 22 | -------------------------------------------------------------------------------- /Shaders/disco.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'Do It At The Disco' by Tigrou (2009) 5 | // 6 | // Code for the 1k intro Do It At The Disco from the demoscene (http://www.pouet.net/prod.php?which=54087) 7 | // 8 | 9 | #ifdef GL_ES 10 | precision highp float; 11 | #endif 12 | 13 | uniform vec2 resolution; 14 | uniform float time; 15 | uniform sampler2D tex0; 16 | uniform sampler2D tex1; 17 | 18 | vec4 s(vec2 px,float z) 19 | { 20 | float l=3.1415; 21 | float k=time*sign(z); 22 | float x = px.x*320.0*.0065*z; 23 | float y = px.y*240.0*.0060*z; 24 | float c=sqrt(x*x+y*y); 25 | if(c>1.0) 26 | { 27 | return vec4(0.0); 28 | } 29 | else 30 | { 31 | float u=-.4*sign(z)+sin(k*.05); 32 | float v=sqrt(1.0-x*x-y*y); 33 | float q=y*sin(u)-v*cos(u); 34 | y=y*cos(u)+v*sin(u); 35 | v=acos(y); 36 | u=acos(x/sin(v))/(2.0*l)*120.0*sign(q)-k; 37 | v=v*60.0/l; 38 | q=cos(floor(v/l)); 39 | c=pow(abs(cos(u)*sin(v)),.2)*.1/(q+sin(float(int((u+l/2.0)/l))+k*.6+cos(q*25.0)))*pow(1.0-c,.9); 40 | 41 | vec4 res; 42 | if(c<0.0) 43 | res = vec4(-c/2.0*abs(cos(k*.1)),0.0,-c*2.0*abs(sin(k*.04)),1.0); 44 | else 45 | res = vec4(c,c*2.0,c*2.0,1.0); 46 | return res; 47 | } 48 | } 49 | 50 | void main(void) 51 | { 52 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy; 53 | vec4 c = vec4(0.0); 54 | for(int i=80;i>0;i--) 55 | c+=s(p,1.0-float(i)/80.0)*(.008-float(i)*.00005); 56 | vec4 d=s(p,1.0); 57 | gl_FragColor = (d.a==0.0?s(p,-.2)*.02:d)+sqrt(c); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Shaders/dual-texture_example.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // dual-texture_example.txt 4 | // 5 | // Test of two texture inputs - tex0 and tex1 6 | // Not supposed to do anything except test whether the two textures are received OK 7 | // 8 | 9 | uniform float time; 10 | uniform vec2 mouse; 11 | uniform vec2 resolution; 12 | uniform sampler2D tex0; 13 | uniform sampler2D tex1; 14 | 15 | void main(void) { 16 | 17 | vec4 c0 = texture2D(tex0, gl_TexCoord[0].xy); 18 | vec4 c1 = texture2D(tex1, gl_TexCoord[0].xy); 19 | 20 | gl_FragColor = mix(c0, c1, 0.5); 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Shaders/flower.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'Flower' by iq (2010) 5 | // The GLSL version of love 6 | // 7 | // 8 | 9 | #ifdef GL_ES 10 | precision highp float; 11 | #endif 12 | 13 | uniform float time; 14 | uniform vec2 resolution; 15 | uniform vec4 mouse; 16 | 17 | //float u( float x ) { return 0.5+0.5*sign(x); } 18 | float u( float x ) { return (x>0.0)?1.0:0.0; } 19 | //float u( float x ) { return abs(x)/x; } 20 | 21 | void main(void) 22 | { 23 | vec2 p = (2.0*gl_FragCoord.xy-resolution)/resolution.y; 24 | 25 | float a = atan(p.x,p.y); 26 | float r = length(p)*.75; 27 | 28 | float w = cos(3.1415927*time-r*2.0); 29 | float h = 0.5+0.5*cos(12.0*a-w*7.0+r*8.0); 30 | float d = 0.25+0.75*pow(h,1.0*r)*(0.7+0.3*w); 31 | 32 | float col = u( d-r ) * sqrt(1.0-r/d)*r*2.5; 33 | col *= 1.25+0.25*cos((12.0*a-w*7.0+r*8.0)/2.0); 34 | col *= 1.0 - 0.35*(0.5+0.5*sin(r*30.0))*(0.5+0.5*cos(12.0*a-w*7.0+r*8.0)); 35 | gl_FragColor = vec4( 36 | col, 37 | col-h*0.5+r*.2 + 0.35*h*(1.0-r), 38 | col-h*r + 0.1*h*(1.0-r), 39 | 1.0); 40 | } 41 | -------------------------------------------------------------------------------- /Shaders/frei_chen_edge_filter.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Frei-Chen edge detection 3 | // 4 | uniform float time; 5 | uniform vec2 mouse; 6 | uniform vec2 resolution; 7 | uniform sampler2D tex0; 8 | 9 | const mat3 G[9] = mat3[]( 10 | 1.0/(2.0*sqrt(2.0)) * mat3( 1.0, sqrt(2.0), 1.0, 0.0, 0.0, 0.0, -1.0, -sqrt(2.0), -1.0 ), 11 | 1.0/(2.0*sqrt(2.0)) * mat3( 1.0, 0.0, -1.0, sqrt(2.0), 0.0, -sqrt(2.0), 1.0, 0.0, -1.0 ), 12 | 1.0/(2.0*sqrt(2.0)) * mat3( 0.0, -1.0, sqrt(2.0), 1.0, 0.0, -1.0, -sqrt(2.0), 1.0, 0.0 ), 13 | 1.0/(2.0*sqrt(2.0)) * mat3( sqrt(2.0), -1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 1.0, -sqrt(2.0) ), 14 | 1.0/2.0 * mat3( 0.0, 1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 1.0, 0.0 ), 15 | 1.0/2.0 * mat3( -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, -1.0 ), 16 | 1.0/6.0 * mat3( 1.0, -2.0, 1.0, -2.0, 4.0, -2.0, 1.0, -2.0, 1.0 ), 17 | 1.0/6.0 * mat3( -2.0, 1.0, -2.0, 1.0, 4.0, 1.0, -2.0, 1.0, -2.0 ), 18 | 1.0/3.0 * mat3( 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ) 19 | ); 20 | 21 | 22 | void main(void) 23 | { 24 | mat3 I; 25 | float cnv[9]; 26 | vec3 sample; 27 | float M; 28 | float S; 29 | float F = 0.0; 30 | float gamma = mouse.y*2.0; 31 | 32 | vec2 uv = gl_FragCoord.xy / resolution.xy; 33 | 34 | // fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value 35 | for (int i=0; i<3; i++) { 36 | for (int j=0; j<3; j++) { 37 | sample = texture2D(tex0, uv + vec2(i-1.0, j-1.0)/resolution.xy).rgb; 38 | I[i][j] = length(sample); 39 | } 40 | } 41 | 42 | // calculate the convolution values for all the masks 43 | for (int i=0; i<9; i++) { 44 | float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]); 45 | cnv[i] = dp3 * dp3; 46 | } 47 | 48 | M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]); 49 | S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M); 50 | 51 | if(S > 0.001) 52 | F = sqrt(M/S); 53 | else 54 | F = 0.0; 55 | 56 | if(F > 0.001) F = pow(F, 1.0/gamma); // contrast 57 | 58 | F = 1.0-F; // for black on white 59 | 60 | gl_FragColor = vec4(vec3(F), 1.0); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /Shaders/kuwahara_filter.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Kuwahara filter 3 | // 4 | // LJ demo for ShaderLoader FFGL plugin 5 | // 6 | // 7 | // Adapted from : Jan Eric Kyprianidis 8 | // 9 | // 10 | // 11 | 12 | uniform float time; 13 | uniform vec2 mouse; // radius is mouse X postition *10 14 | uniform vec2 resolution; 15 | uniform sampler2D tex0; 16 | 17 | void main (void) { 18 | 19 | float radius = mouse.x*10.0; 20 | 21 | vec2 uv = gl_FragCoord.xy / resolution.xy; 22 | float n = float((radius + 1) * (radius + 1)); 23 | 24 | vec3 m[4]; 25 | vec3 s[4]; 26 | for (int k = 0; k < 4; ++k) { 27 | m[k] = vec3(0.0); 28 | s[k] = vec3(0.0); 29 | } 30 | 31 | for (int j = -radius; j <= 0; ++j) { 32 | for (int i = -radius; i <= 0; ++i) { 33 | vec3 c = texture2D(tex0, uv + vec2(i,j)/resolution.xy).rgb; 34 | m[0] += c; 35 | s[0] += c * c; 36 | } 37 | } 38 | 39 | for (int j = -radius; j <= 0; ++j) { 40 | for (int i = 0; i <= radius; ++i) { 41 | vec3 c = texture2D(tex0, uv + vec2(i,j)/resolution.xy).rgb; 42 | m[1] += c; 43 | s[1] += c * c; 44 | } 45 | } 46 | 47 | for (int j = 0; j <= radius; ++j) { 48 | for (int i = 0; i <= radius; ++i) { 49 | vec3 c = texture2D(tex0, uv + vec2(i,j)/resolution.xy).rgb; 50 | m[2] += c; 51 | s[2] += c * c; 52 | } 53 | } 54 | 55 | for (int j = 0; j <= radius; ++j) { 56 | for (int i = -radius; i <= 0; ++i) { 57 | vec3 c = texture2D(tex0, uv + vec2(i,j)/resolution.xy).rgb; 58 | m[3] += c; 59 | s[3] += c * c; 60 | } 61 | } 62 | 63 | 64 | float min_sigma2 = 1e+2; 65 | for (int k = 0; k < 4; ++k) { 66 | m[k] /= n; 67 | s[k] = abs(s[k] / n - m[k] * m[k]); 68 | 69 | float sigma2 = s[k].r + s[k].g + s[k].b; 70 | if (sigma2 < min_sigma2) { 71 | min_sigma2 = sigma2; 72 | gl_FragColor = vec4(m[k], 1.0); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /Shaders/monjori.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'Monjori' by Mic (2009) 5 | // 6 | // Code for the 1k intro Monjori from the demoscene (http://www.pouet.net/prod.php?which=52761) 7 | // 8 | #ifdef GL_ES 9 | precision highp float; 10 | #endif 11 | 12 | uniform vec2 resolution; 13 | uniform float time; 14 | 15 | void main(void) 16 | { 17 | vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy; 18 | float a = time*40.0; 19 | float d,e,f,g=1.0/40.0,h,i,r,q; 20 | e=400.0*(p.x*0.5+0.5); 21 | f=400.0*(p.y*0.5+0.5); 22 | i=200.0+sin(e*g+a/150.0)*20.0; 23 | d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0; 24 | r=sqrt(pow(i-e,2.0)+pow(d-f,2.0)); 25 | q=f/r; 26 | e=(r*cos(q))-a/2.0;f=(r*sin(q))-a/2.0; 27 | d=sin(e*g)*176.0+sin(e*g)*164.0+r; 28 | h=((f+d)+a/2.0)*g; 29 | i=cos(h+r*p.x/1.3)*(e+e+a)+cos(q*g*6.0)*(r+h/3.0); 30 | h=sin(f*g)*144.0-sin(e*g)*212.0*p.x; 31 | h=(h+(f-e)*q+sin(r-(a+h)/7.0)*10.0+i/4.0)*g; 32 | i+=cos(h*2.3*sin(a/350.0-q))*184.0*sin(q-(r*4.3+a/12.0)*g)+tan(r*g+h)*184.0*cos(r*g+h); 33 | i=mod(i/5.6,256.0)/64.0; 34 | if(i<0.0) i+=4.0; 35 | if(i>=2.0) i=4.0-i; 36 | d=r/350.0; 37 | d+=sin(d*d*8.0)*0.52; 38 | f=(sin(a*g)+1.0)/2.0; 39 | gl_FragColor=vec4(vec3(f*i/1.6,i/2.0+d/13.0,i)*d*p.x+vec3(i/1.3+d/8.0,i/2.0+d/18.0,i)*d*(1.0-p.x),1.0); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Shaders/nautilus.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'Nautilus' by Weyland Yutani (reworked by iq) (2010) 5 | // 6 | // A 1 kilobyte demo from the demoscene, using raymarching and screen space ambient occlusion 7 | // (http://www.pouet.net/prod.php?which=55469). 8 | // 9 | 10 | #ifdef GL_ES 11 | precision highp float; 12 | #endif 13 | 14 | uniform float time; 15 | uniform vec2 resolution; 16 | uniform vec4 mouse; 17 | 18 | float e(vec3 c) 19 | { 20 | c=cos(vec3(cos(c.r+time/6.0)*c.r-cos(c.g*3.0+time/5.0)*c.g, cos(time/4.0)*c.b/3.0*c.r-cos(time/7.0)*c.g, c.r+c.g+c.b+time)); 21 | return dot(c*c,vec3(1.0))-1.0; 22 | } 23 | 24 | void main(void) 25 | { 26 | vec2 c=-1.0+2.0*gl_FragCoord.rg/resolution.xy; 27 | vec3 o=vec3(c.r,c.g,0.0),g=vec3(c.r,c.g,1.0)/64.0,v=vec3(0.5); 28 | float m = 0.4; 29 | // float m = 1.0-1.5*mouse.x/resolution.x; 30 | 31 | for(int r=0;r<100;r++) 32 | { 33 | float h=e(o)-m; 34 | if(h<0.0)break; 35 | o+=h*10.0*g; 36 | v+=h*0.02; 37 | } 38 | // light (who needs a normal?) 39 | v+=e(o+0.1)*vec3(0.4,0.7,1.0); 40 | 41 | // ambient occlusion 42 | float a=0.0; 43 | for(int q=0;q<100;q++) 44 | { 45 | float l = e(o+0.5*vec3(cos(1.1*float(q)),cos(1.6*float(q)),cos(1.4*float(q))))-m; 46 | a+=clamp(4.0*l,0.0,1.0); 47 | } 48 | v*=a/100.0; 49 | gl_FragColor=vec4(v,1.0); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Shaders/pass_through_example.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // Texture pass-through 4 | // 5 | // 6 | 7 | uniform float time; 8 | uniform vec2 mouse; 9 | uniform vec2 resolution; 10 | uniform sampler2D tex0; 11 | 12 | void main(void) { 13 | 14 | vec3 c0 = texture2D(tex0, gl_TexCoord[0].xy).rgb; 15 | gl_FragColor = vec4(c0, 1.0); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Shaders/plasma.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'Plasma' by Viktor Korsun (2011) 5 | // A GLSL version of the oldschool 2D plasma effect 6 | // 7 | 8 | #ifdef GL_ES 9 | precision highp float; 10 | #endif 11 | 12 | uniform vec2 resolution; 13 | uniform float time; 14 | 15 | void main(void) 16 | { 17 | float x = gl_FragCoord.x; 18 | float y = gl_FragCoord.y; 19 | float mov0 = x+y+cos(sin(time)*2.)*100.+sin(x/100.)*1000.; 20 | float mov1 = y / resolution.y / 0.2 + time; 21 | float mov2 = x / resolution.x / 0.2; 22 | float c1 = abs(sin(mov1+time)/2.+mov2/2.-mov1-mov2+time); 23 | float c2 = abs(sin(c1+sin(mov0/1000.+time)+sin(y/40.+time)+sin((x+y)/100.)*3.)); 24 | float c3 = abs(sin(c2+cos(mov1+mov2+c2)+cos(mov2)+sin(x/1000.))); 25 | gl_FragColor = vec4( c1,c2,c3,1.0); 26 | } 27 | -------------------------------------------------------------------------------- /Shaders/quantize_filter.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Simple quantization 3 | // 4 | // 5 | uniform float time; 6 | uniform vec2 mouse; 7 | uniform vec2 resolution; 8 | uniform sampler2D tex0; 9 | 10 | const vec4 grayScaleWeights = vec4(0.30, 0.59, 0.11, 0.0); 11 | 12 | void main() 13 | { 14 | float numColors = mouse.x*10.0; 15 | float gamma = mouse.y; 16 | 17 | if(numColors < 2.0) numColors = 2.0; 18 | 19 | // lookup input color 20 | vec2 texCoord = gl_TexCoord[0].st; 21 | vec4 c = texture2D(tex0, texCoord); 22 | 23 | // calculate luminance 24 | float lum = dot(c, grayScaleWeights); 25 | 26 | vec3 tc = c.rgb; 27 | tc = pow(tc, vec3(gamma, gamma, gamma)); 28 | tc = tc * numColors; 29 | tc = floor(tc); 30 | tc = tc / numColors; 31 | tc = pow(tc, vec3(1.0 / gamma)); 32 | 33 | gl_FragColor = vec4(tc, 1.0); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Shaders/simple.txt: -------------------------------------------------------------------------------- 1 | void main(void) 2 | { 3 | vec2 uv = gl_FragCoord.xy / iResolution.xy; 4 | gl_FragColor = vec4(uv,0.5+0.5*sin(iGlobalTime),1.0); 5 | } 6 | -------------------------------------------------------------------------------- /Shaders/thermal_imaging.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // Thermal imaging 4 | // 5 | // Credit : Peter R. Elespuru 6 | // http://coding-experiments.blogspot.com/2010/10/thermal-vision-pixel-shader.html 7 | // 8 | 9 | uniform float time; 10 | uniform vec2 mouse; 11 | uniform vec2 resolution; 12 | uniform sampler2D tex0; 13 | 14 | void main(void) { 15 | 16 | vec4 pixcol = texture2D(tex0, gl_TexCoord[0].xy); 17 | vec4 colors[3]; 18 | colors[0] = vec4(0.,0.,1.,1.); 19 | colors[1] = vec4(1.,1.,0.,1.); 20 | colors[2] = vec4(1.,0.,0.,1.); 21 | //float lum = (pixcol.r+pixcol.g+pixcol.b)/3.; 22 | // better shadow range 23 | float lum = dot(vec3(0.30, 0.59, 0.11), pixcol.rgb); 24 | int ix = (lum < 0.5)? 0:1; 25 | vec4 thermal = mix(colors[ix],colors[ix+1],(lum-float(ix)*0.5)/0.5); 26 | gl_FragColor = thermal; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Shaders/vlahos_chroma_key.txt: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // vlahos chroma key 4 | // 5 | // Modification of : https://www.shadertoy.com/view/MsS3DW# 6 | // With ideas from : http://magicmusicvisuals.com/forums/viewtopic.php?f=3&t=220 7 | // 8 | // Allows for user definition of the key colour with user inputs 9 | // from the Freeframe plugin controls of ShaderLoader 10 | // 11 | // First texture is the "green screen" picture - the foreground 12 | // Second texture is the background 13 | // Red, Green and Blue user inputs define the key colour 14 | // 15 | // Original had R = 0.350, G = 0.587, B = 0.164 16 | // 17 | 18 | float th = 8.0; // threshold 19 | float a2 = 1.2; 20 | float spill = 1.0; 21 | 22 | vec3 bgColor = inputColour.rgb; // ShaderLoader specific uniform linked to user controls 23 | 24 | float getAlpha(vec4 c){ 25 | 26 | // First Vlahos assumption: Gf <= a2Bf 27 | return 1.0 - th*(c.g-a2*(max(c.r, c.b))); 28 | 29 | } 30 | 31 | vec4 despill(vec4 c){ 32 | 33 | // Second Vlahos assumption: max (Gf - Bf,0) <= max(Bf - Rf, 0) 34 | float sub = max(c.g - mix(c.b, c.r, 0.45), 0.0); 35 | c.g -= sub; 36 | 37 | /* 38 | // Original 39 | c.a -= smoothstep(0.25, 0.5, sub*c.a); 40 | 41 | // restore luminance (kind of, I slightly reduced the green weight) 42 | // Original 43 | float luma = dot(c.rgb, vec3(0.350, 0.587,0.164)); 44 | c.r += sub*c.r*2.0*.350/luma; 45 | c.g += sub*c.g*2.0*.587/luma; 46 | c.b += sub*c.b*2.0*.164/luma; 47 | */ 48 | 49 | // Magic version 50 | float amt = .75*iMouse.x/iResolution.x; 51 | c.a -= smoothstep(amt, amt+.25, sub*c.a); 52 | 53 | //restore luminance (kind of, I slightly reduced the green weight) 54 | float luma = dot(c.rgb, bgColor); 55 | c.r += sub*c.r*2.0*bgColor.r/luma; 56 | c.g += sub*c.g*2.0*bgColor.g/luma; 57 | c.b += sub*c.b*2.0*bgColor.b/luma; 58 | 59 | 60 | return c; 61 | } 62 | 63 | void main(void) 64 | { 65 | vec4 fg = texture2D(iChannel0, gl_FragCoord.xy/iResolution.xy); 66 | vec4 bg = texture2D(iChannel1, gl_FragCoord.xy/iResolution.xy); 67 | 68 | fg.a = clamp(getAlpha(fg), 0.0, 1.0); 69 | fg = despill(fg); 70 | 71 | gl_FragColor.rgb = bg.rgb*(1.0-fg.a) + fg.rgb*fg.a; // For two inputs 72 | // gl_FragColor.rgba = vec4(fg.rgb*fg.a, fg.a); // For an output alpha mask 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Shaders/water.txt: -------------------------------------------------------------------------------- 1 | // 2 | // http://www.iquilezles.org/apps/shadertoy/index2.html 3 | // 4 | // 'Water' by Viktor Korsun (BIT_TEK) (2012) 5 | // A water pulse effect 6 | // 7 | // Also : https://github.com/AlexandreRangel/QuaseCinemaFeijoada/blob/master/QuaseCinemaFeijoada07d/data/water.glsl 8 | // LJ modified - seems to be a problem inverting c1.y 9 | 10 | #ifdef GL_ES 11 | precision highp float; 12 | #endif 13 | 14 | uniform sampler2D tex0; 15 | precision highp float; 16 | uniform float time; 17 | uniform vec2 resolution; 18 | const float PI = 3.1415926535897932; 19 | 20 | //speed 21 | const float speed = 0.2; 22 | const float speed_x = 0.3; 23 | const float speed_y = 0.3; 24 | 25 | // geometry 26 | const float intensity = 3.; 27 | const int steps = 8; 28 | const float frequency = 4.0; 29 | const int angle = 7; // better when a prime 30 | 31 | // reflection and emboss 32 | const float delta = 20.; 33 | const float intence = 400.; 34 | const float emboss = 0.3; 35 | 36 | //---------- crystals effect 37 | 38 | float col(vec2 coord) 39 | { 40 | float delta_theta = 2.0 * PI / float(angle); 41 | float col = 0.0; 42 | float theta = 0.0; 43 | for (int i = 0; i < steps; i++) 44 | { 45 | vec2 adjc = coord; 46 | theta = delta_theta*float(i); 47 | adjc.x += cos(theta)*time*speed + time * speed_x; 48 | adjc.y -= sin(theta)*time*speed - time * speed_y; 49 | col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity; 50 | } 51 | 52 | return cos(col); 53 | } 54 | 55 | //---------- main 56 | void main(void) 57 | { 58 | vec2 p = (gl_FragCoord.xy) / resolution.xy, c1 = p, c2 = p; 59 | float cc1 = col(c1); 60 | 61 | c2.x += resolution.x/delta; 62 | float dx = emboss*(cc1-col(c2))/delta; 63 | 64 | c2.x = p.x; 65 | c2.y += resolution.y/delta; 66 | float dy = emboss*(cc1-col(c2))/delta; 67 | 68 | c1.x += dx; 69 | // c1.y = -(c1.y+dy); // LJ causes an error - wavy vertical lines only 70 | 71 | float alpha = 1.+dot(dx,dy)*intence; 72 | gl_FragColor = texture2D(tex0,c1)*(alpha); 73 | 74 | } 75 | -------------------------------------------------------------------------------- /installation.txt: -------------------------------------------------------------------------------- 1 | Installation 2 | 3 | “ShaderLoader.dll” must then be copied into 4 | the plugin folder for the host application. 5 | 6 | For “Resolume Avenue” or “Resolume Arena”, 7 | you can copy them to the default plugin “vfx” folder. 8 | Or you can define specific folders for effects. 9 | 10 | For "Isadora" copy to the Program files "..\Common Files\Freeframe" folder. 11 | Create this folder if it does not exist. 12 | 13 | Magic allows "additional module folders" to be defined so using 14 | the "..\Common Files\Freeframe" folder is a good idea. 15 | 16 | "SpoutPanel.exe" from the Spout project, is provided with ShaderLoader 17 | and should be copied to the same folder as the host executable to enable 18 | the file selection and warning dialogs. The latest Version 2.03 19 | (after 9th January 2015) is required. 20 | 21 | Shader path 22 | 23 | Shader files can be located in any folder, but if you want to use 24 | a simple name entry instead of the full path, they have to be in a known folder. 25 | 26 | This can be either the same folder as the ShaderLoader plugin 27 | or in a sub-folder under that folder called "Shaders". 28 | 29 | For example you might have put the ShaderLoader plugin in 30 | "..\Program files\Common Files\Freeframe" folder. 31 | If so, you can create a sub-folder "..\Program files\Common Files\Freeframe\Shaders" 32 | and put all the shader files in that. 33 | The same applies for any folder where the ShaderLoader plugin is located. 34 | 35 | Further details are in the ShaderLoader pdf. 36 | --------------------------------------------------------------------------------