Skip to content

Commit

Permalink
[visualisation] Improvements to shadertoy
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed May 27, 2015
1 parent 15288e5 commit 35d7e1c
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 297 deletions.
19 changes: 12 additions & 7 deletions addons/visualization.shadertoy/resources/audiovisual.frag.glsl
Expand Up @@ -7,16 +7,21 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
vec2 uv = fragCoord.xy / iResolution.xy;
float wave = texture2D( iChannel0, vec2(uv.x,0.75) ).x;

for(int i = 1; i<20; i++)
float time = 0.0;
float alpha = 2.*3.14/20.* (iGlobalTime*.9);
float cs = cos(iGlobalTime*.5);
float sn = sin(iGlobalTime*.3);
float sn2 = sin(iGlobalTime);
float sm=smoothstep( 0.0, 0.15, abs(wave - uv.y));
for(int i = 1; i<10; i++)
{
float time = 2.*3.14*float(i)/20.* (iGlobalTime*.9);
float x = sin(time)*1.8*smoothstep( 0.0, 0.15, abs(wave - uv.y));
float y = sin(.5*time) *smoothstep( 0.0, 0.15, abs(wave - uv.y));
y*=.5;
vec2 o = .4*vec2(x*cos(iGlobalTime*.5),y*sin(iGlobalTime*.3));
time += alpha;
float x = sin(time)*1.8*sm;
float y = sin(.5*time)*0.5*sm;
vec2 o = .4*vec2(x*cs,y*sn);
float red = fract(time);
float green = 1.-red;
c+=0.016/(length(p-o))*vec3(red,green,sin(iGlobalTime));
c+=0.016/(length(p-o))*vec3(red,green,sn2);
}
fragColor = vec4(c,1.0);
}
Expand Down
@@ -1,16 +1,11 @@
// Taken from https://www.shadertoy.com/view/4d23Ww

const float Pi = 3.14159;
float beat = 0.;

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
float ct = iChannelTime[0];
if ((ct > 8.0 && ct < 33.5)
|| (ct > 38.0 && ct < 88.5)
|| (ct > 93.0 && ct < 194.5))
beat = pow(sin(ct*3.1416*3.78+1.9)*0.5+0.5,15.0)*0.1;

float ct = iGlobalTime;
float beat = 0.3*texture2D(iChannel0,vec2(0.4,0.0)).x;
float scale = iResolution.y / 50.0;
float ring = 20.0;
float radius = iResolution.x*1.0;
Expand Down
4 changes: 2 additions & 2 deletions addons/visualization.shadertoy/resources/circlewave.frag.glsl
Expand Up @@ -11,10 +11,10 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
// adjust frequency to look pretty
uv.x *= 1.0/2.0;

float seperation = 0.06;
float seperation = 0.06*(1.0-iMouse.x/iResolution.x);

vec3 wave = vec3(0.0);
const int n = 60;
const int n = 16;
for ( int i=0; i < n; i++ )
{
/* float u = uv.x*255.0;
Expand Down
20 changes: 10 additions & 10 deletions addons/visualization.shadertoy/resources/simplicitygalaxy.frag.glsl
Expand Up @@ -5,12 +5,11 @@
//Inspired by JoshP's Simplicity shader: https://www.shadertoy.com/view/lslGWr

// http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/
float field(in vec3 p,float s) {
float strength = 7. + .03 * log(1.e-6 + fract(sin(iGlobalTime) * 4373.11));
float field(in vec3 p,float s, float strength) {
float accum = s/4.;
float prev = 0.;
float tw = 0.;
for (int i = 0; i < 26; ++i) {
for (int i = 0; i < 13; ++i) {
float mag = dot(p, p);
p = abs(p) / mag + vec3(-.5, -.4, -1.5);
float w = exp(-float(i) / 7.);
Expand All @@ -22,12 +21,11 @@ float field(in vec3 p,float s) {
}

// Less iterations for second layer
float field2(in vec3 p, float s) {
float strength = 7. + .03 * log(1.e-6 + fract(sin(iGlobalTime) * 4373.11));
float field2(in vec3 p, float s, float strength) {
float accum = s/4.;
float prev = 0.;
float tw = 0.;
for (int i = 0; i < 18; ++i) {
for (int i = 0; i < 9; ++i) {
float mag = dot(p, p);
p = abs(p) / mag + vec3(-.5, -.4, -1.5);
float w = exp(-float(i) / 7.);
Expand All @@ -51,7 +49,8 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec2 uv = 2. * fragCoord.xy / iResolution.xy - 1.;
vec2 uvs = uv * iResolution.xy / max(iResolution.x, iResolution.y);
vec3 p = vec3(uvs / 4., 0) + vec3(1., -1.3, 0.);
p += .2 * vec3(sin(iGlobalTime / 16.), sin(iGlobalTime / 12.), sin(iGlobalTime / 128.));
vec3 temp = vec3(sin(iGlobalTime / 16.), sin(iGlobalTime / 12.), sin(iGlobalTime / 128.));
p += .2 * temp;

float freqs[4];
//Sound
Expand All @@ -60,13 +59,14 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
freqs[2] = texture2D( iChannel0, vec2( 0.15, 0.25 ) ).x;
freqs[3] = texture2D( iChannel0, vec2( 0.30, 0.25 ) ).x;

float t = field(p,freqs[2]);
float strength = 7. + .03 * log(1.e-6 + fract(sin(iGlobalTime) * 4373.11));
float t = field(p,freqs[2],strength);
float v = (1. - exp((abs(uv.x) - 1.) * 6.)) * (1. - exp((abs(uv.y) - 1.) * 6.));

//Second Layer
vec3 p2 = vec3(uvs / (4.+sin(iGlobalTime*0.11)*0.2+0.2+sin(iGlobalTime*0.15)*0.3+0.4), 1.5) + vec3(2., -1.3, -1.);
p2 += 0.25 * vec3(sin(iGlobalTime / 16.), sin(iGlobalTime / 12.), sin(iGlobalTime / 128.));
float t2 = field2(p2,freqs[3]);
p2 += 0.25 * temp;
float t2 = field2(p2,freqs[3],strength);
vec4 c2 = mix(.4, 1., v) * vec4(1.3 * t2 * t2 * t2 ,1.8 * t2 * t2 , t2* freqs[0], t2);


Expand Down
Expand Up @@ -40,10 +40,10 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
// Draw the circles
float o = 0.0;
float inc = 0.0;
float baseradius = 0.3 * ( 0.3 + sin01(rstandard + iGlobalTime * 0.2) );

for( float i = 1.0 ; i < 8.0 ; i += 1.0 )
{
float baseradius = 0.3 * ( 0.3 + sin01(rstandard + iGlobalTime * 0.2) );
float radius = baseradius + inc;

radius += 0.01 * ( sin01(pa * i + iGlobalTime * (i - 1.0) ) );
Expand Down
Expand Up @@ -18,7 +18,7 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
uv = -1.0 + 2.0 * uv;
uv.y += 0.1;
uv.x *= 2.;
const float n = 20.;
const float n = 10.;
float prev = 0.;
float curr = .6;
float next = texture2D(iChannel0, vec2(0.,0.)).r;
Expand Down
15 changes: 9 additions & 6 deletions addons/visualization.shadertoy/resources/wavesremix.frag.glsl
Expand Up @@ -15,17 +15,20 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
float lineIntensity;
float glowWidth;
vec3 color = vec3(0.0);

float sn0 = sin(iGlobalTime * 0.13);
float sn1 = sin(iGlobalTime * 0.23);
float cs1 = cos(iGlobalTime * 0.19);
float temp = texture2D(iChannel0, vec2(uvTrue.x, 1)).x - 0.5;

for(float i = 0.0; i < 5.0; i++) {

uv.y += (0.2 * sin(uv.x + i/7.0 - iGlobalTime * 0.6));
float Y = uv.y + getWeight(squared(i) * 20.0) *
(texture2D(iChannel0, vec2(uvTrue.x, 1)).x - 0.5);
float Y = uv.y + getWeight(squared(i) * 20.0) * temp;
lineIntensity = 0.4 + squared(1.6 * abs(mod(uvTrue.x + i / 1.3 + iGlobalTime,2.0) - 1.0));
glowWidth = abs(lineIntensity / (150.0 * Y));
color += vec3(glowWidth * (2.0 + sin(iGlobalTime * 0.13)),
glowWidth * (2.0 - sin(iGlobalTime * 0.23)),
glowWidth * (2.0 - cos(iGlobalTime * 0.19)));
color += vec3(glowWidth * (2.0 + sn0),
glowWidth * (2.0 - sn1),
glowWidth * (2.0 - cs1));
}

fragColor = vec4(color, 1.0);
Expand Down

0 comments on commit 35d7e1c

Please sign in to comment.