Skip to content

Commit

Permalink
[shader] - added 5 new presets
Browse files Browse the repository at this point in the history
  • Loading branch information
Memphiz committed Jun 8, 2015
1 parent 312685f commit faf2ef5
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 1 deletion.
36 changes: 36 additions & 0 deletions screensaver.shadertoy/resources/colorbubbles.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//http://glslsandbox.com/e#23988
const float fRadius = 0.08;

const float ySpeed = 1.7;
const float bubblePopHeight = 2.0;
const float bubbleSpreadDist = 2.0;


void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = -1.0 + 2.0*fragCoord / iResolution.xy;
uv.x *= iResolution.x / iResolution.y;

vec3 color = vec3(0.0);

// bubbles
for( int i=0; i<64; i++ )
{
// bubble seeds
float pha = tan(float(i)*6.+1.0)*0.5 + 0.5;
float siz = pow( cos(float(i)*2.4+4.0) * 0.5 + ySpeed, 4.0 );
float pox = cos(float(i)*2.55+3.1) * iResolution.x / iResolution.y;

// buble size, position and color
float rad = fRadius + sin(float(i))*0.12+0.29;
vec2 pos = vec2( pox+sin(iGlobalTime/50.+pha+siz), -abs(bubblePopHeight)-rad + (bubbleSpreadDist+2.0*rad)
*mod(pha+0.1*(iGlobalTime/5.)*(0.2+0.8*siz),1.0)) * vec2(1.0, 1.0);
float dis = length( uv - pos );
vec3 col = mix( vec3(0.9, 0.2, 0.0), vec3(0.2,0.3,0.6), 0.2+0.2*sin(float(i)*sin(iGlobalTime*pox*0.03)+1.9));

// render
color += col.xyz *(1.- smoothstep( rad*(0.65+0.20*sin(pox*iGlobalTime)), rad, dis )) * (1.0 - cos(pox*iGlobalTime));
}

fragColor = vec4(color,2.0);
}
25 changes: 25 additions & 0 deletions screensaver.shadertoy/resources/colored_balls.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// See: http://glslsandbox.com/e#24875.0

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 p = (fragCoord * 2.0 - iResolution.xy) / min(iResolution.x, iResolution.y);
vec3 destColor = vec3(0.0);

for(float i = 0.0; i < 10.0; i++){
float j = i + 1.23;
vec2 q = p + vec2(sin(iGlobalTime * j), cos(iGlobalTime * j));
destColor += 0.05 * abs(cos(iGlobalTime)) / length(q);
}

for(float i = 0.0; i < 10.0; i++){
float j = i + 6.54;
vec2 q = p + vec2(-sin(iGlobalTime * j) * abs(sin(iGlobalTime*3.0) + 0.5), cos(iGlobalTime * j) * abs(sin(iGlobalTime*3.0) + 0.5));
destColor += 0.02 * abs(tan(iGlobalTime/1.23)) / length(q);
}

float g = destColor.r * abs(sin(iGlobalTime*2.0));
float b = destColor.r * abs(sin(iGlobalTime*5.0));
float r = destColor.r * abs(cos(iGlobalTime*0.5));

fragColor = vec4(r, g, b, 1.0);
}
25 changes: 25 additions & 0 deletions screensaver.shadertoy/resources/heart.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//http://glslsandbox.com/e#24426

vec3 heart( float x, float y )
{
float s = (mod(iGlobalTime/1.35, 1.0 )+fract(iGlobalTime/1.35)) / 12.0;
s = 0.9 + 0.1*(1.0-exp(-5.0*s)*sin(50.0*s));
x *= s;
y *= s;
float a = atan(x,y)/3.14159265359;
float r = sqrt(x*x*1.5+y*y);

float h = abs(a);
float d = (13.0*h - 22.0*h*h + 10.1*h*h*h)/(6.0-5.0*h);
float g = pow(1.0-clamp(r/d,0.0,1.0),0.25);

return vec3(0.5+0.5*g,0.2,0.4);
}


void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 p = (-1.0+2.0*fragCoord/iResolution.xy);
vec3 col = heart(p.x, p.y-0.35 );
fragColor = vec4(col,1.0);
}
22 changes: 22 additions & 0 deletions screensaver.shadertoy/resources/knightrider.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// See: http://glslsandbox.com/e#24875.0

#define TWO_PI 3.283185
#define NUMBALLS 30.0
float d = -TWO_PI/36.0;
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 p = (2.*fragCoord - iResolution.xy)/min(iResolution.x, iResolution.y);
p *= mat2(cos(iGlobalTime), -sin(iGlobalTime), sin(iGlobalTime), cos(iGlobalTime));

float p1=iMouse.y*10.0;

vec3 c = vec3(0); //ftfy
for(float i = 1.0; i < NUMBALLS; i++) {
float t = TWO_PI * i/NUMBALLS + iGlobalTime;
float x = cos(t);
float y = sin(.0 * t + d);
vec2 q = 0.8*vec2(x, y);
c += 0.009/distance(p, q) * vec3(1.0 * abs(x), -7, abs(y));
}
fragColor = vec4(c, 7.0);
}
19 changes: 19 additions & 0 deletions screensaver.shadertoy/resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,22 @@ msgctxt "#30023"
msgid "Cellular"
msgstr ""

msgctxt "#30024"
msgid "Knight Rider"
msgstr ""

msgctxt "#30025"
msgid "Colored Balls"
msgstr ""

msgctxt "#30026"
msgid "Spiral Balls"
msgstr ""

msgctxt "#30027"
msgid "Bumping Heart"
msgstr ""

msgctxt "#30028"
msgid "Color Bubbles"
msgstr ""
2 changes: 1 addition & 1 deletion screensaver.shadertoy/resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<settings>
<setting id="preset" label="30000" type="select" lvalues="30100|30001|30002|30023|30003|30022|30004|30005|30006|30007|30008|30009|30010|30011|30012|30013|30014|30015|30016|30017|30018|30019|30020|30021" default="0"/>
<setting id="preset" label="30000" type="select" lvalues="30100|30001|30002|30027|30023|30003|30025|30028|30022|30004|30005|30006|30007|30024|30008|30009|30010|30011|30012|30013|30014|30015|30016|30017|30018|30026|30019|30020|30021" default="0"/>
</settings>
20 changes: 20 additions & 0 deletions screensaver.shadertoy/resources/spiral_balls.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See: http://glslsandbox.com/e#24875.0

#define TWO_PI 6.283185
#define NUMBALLS 50.0
float d = -TWO_PI/36.0;
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 p = (2.0*fragCoord - iResolution.xy)/min(iResolution.x, iResolution.y);
p *= mat2(cos(iGlobalTime), -sin(iGlobalTime), sin(iGlobalTime), cos(iGlobalTime));

vec3 c = vec3(0); //ftfy
for(float i = 0.0; i < NUMBALLS; i++) {
float t = TWO_PI * i/NUMBALLS + iGlobalTime;
float x = cos(t);
float y = sin(2.0 * t + d);
vec2 q = 0.8*vec2(x, y);
c += 0.01/distance(p, q) * vec3(0.5 * abs(x), 0, abs(y));
}
fragColor = vec4(c, 2.0);
}
5 changes: 5 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@ const std::vector<Preset> g_presets =
{
{"Ball", "ball.frag.glsl", 99,-1,-1,-1, 41},
{"Bleepy Blocks", "bleepyblocks.frag.glsl", 99,-1,-1,-1, 47},
{"Bumping Heart", "heart.frag.glsl", -1,-1,-1,-1, 3},
{"Cellular", "cellular.frag.glsl", -1,-1,-1,-1, 13},
{"Fast Clouds", "fastclouds.frag.glsl", 12,-1,-1,-1, 3},
{"Colored Balls", "colored_balls.frag.glsl", -1,-1,-1,-1, 3},
{"Color Bubbles", "colorbubbles.frag.glsl", -1,-1,-1,-1, 3},
{"Flaring", "flaring.frag.glsl", 12,-1,-1,-1, 16},
{"Interstellar", "stellar.frag.glsl", 14,-1,-1,-1, 5},
{"Interweaving Sine bands", "sinebands.frag.glsl", -1,-1,-1,-1, 31},
{"Juliasm", "juliasm.frag.glsl", -1,-1,-1,-1, 13},
{"Julia Trap", "juliatrap.frag.glsl", -1,-1,-1,-1, 18},
{"KnightRider", "knightrider.frag.glsl", -1,-1,-1,-1, 3},
{"Noise", "noise.frag.glsl", -1,-1,-1,-1, 34},
{"Noise Animation Electric", "noiseanimelectric.frag.glsl", 12,-1,-1,-1, 14},
{"Noise Animation Lava", "noiseanimlava.frag.glsl", 12,-1,-1,-1, 6},
Expand All @@ -76,6 +80,7 @@ const std::vector<Preset> g_presets =
{"Simple Fire", "simplefire.frag.glsl", -1,-1,-1,-1, 7},
{"Sky at Night", "skyatnight.frag.glsl", -1,-1,-1,-1, 4},
{"Spiral", "spiral.frag.glsl", -1,-1,-1,-1, 18},
{"Spiral Balls", "spiral_balls.frag.glsl", -1,-1,-1,-1, 3},
{"Warp", "warp.frag.glsl", 99,-1,-1,-1, 28},
{"Water Caustic", "watercaustic.frag.glsl", -1,-1,-1,-1, 5},
{"Worley Noise Waters", "worleynoisewaters.frag.glsl", -1,-1,-1,-1, 2},
Expand Down

0 comments on commit faf2ef5

Please sign in to comment.