-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
580 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/*{ | ||
"CREDIT" : "BinarySerpents by Trisomie21", | ||
"CATEGORIES" : [ | ||
"ci" | ||
], | ||
"DESCRIPTION": "https://www.shadertoy.com/view/MslGRH", | ||
"INPUTS": [ | ||
{ | ||
"NAME": "iChannel0", | ||
"TYPE": "image" | ||
}, | ||
{ | ||
"NAME": "iZoom", | ||
"TYPE" : "float", | ||
"MIN" : 0.0, | ||
"MAX" : 1.0, | ||
"DEFAULT" : 1.0}, | ||
{"NAME" :"iMouse", | ||
"TYPE" : "point2D", | ||
"DEFAULT" : [0.0, 0.0], | ||
"MAX" : [640.0, 480.0], | ||
"MIN" : [0.0, 0.0]}, | ||
{ | ||
"NAME": "iColor", | ||
"TYPE" : "color", | ||
"DEFAULT" : [ | ||
0.0, | ||
1.0, | ||
0.0, | ||
1.0 | ||
]} | ||
], | ||
} | ||
*/ | ||
// https://www.shadertoy.com/view/MslGRH | ||
|
||
// With tweaks by PauloFalcao | ||
|
||
float BinarySerpentsTexture3D(vec3 n, float res){ | ||
n = floor(n*res+.5); | ||
return fract(sin((n.x+n.y*1e5+n.z*1e7)*1e-4)*1e5); | ||
} | ||
|
||
float BinarySerpentsmap( vec3 p ){ | ||
p.x+=sin(p.z*4.0+TIME*4.0)*0.1*cos(TIME*0.1); | ||
p = mod(p,vec3(1.0, 1.0, 1.0))-0.5; | ||
return length(p.xy)-.1; | ||
} | ||
void mainImage(out vec4 fragColor, in vec2 fragCoord) | ||
{ | ||
vec2 uv = iZoom * fragCoord.xy/RENDERSIZE.xy * 2.0 - 0.5; | ||
vec3 camPos = vec3(cos(TIME*0.3), sin(TIME*0.3), 1.5); | ||
vec3 camTarget = vec3(0.0, 0.0, 0.0); | ||
|
||
vec3 camDir = normalize(camTarget-camPos); | ||
vec3 camUp = normalize(vec3(0.0, 1.0, 0.0)); | ||
vec3 camSide = cross(camDir, camUp); | ||
float focus = 2.0; | ||
|
||
vec3 rayDir = normalize(camSide*uv.x + camUp*uv.y + camDir*focus); | ||
vec3 ray = camPos; | ||
float d = 0.0, total_d = 0.0; | ||
const int MAX_MARCH = 100; | ||
const float MAX_DISTANCE = 5.0; | ||
float c = 1.0; | ||
for(int i=0; i<MAX_MARCH; ++i) { | ||
d = BinarySerpentsmap(ray); | ||
total_d += d; | ||
ray += rayDir * d; | ||
if(abs(d)<0.001) { break; } | ||
if(total_d>MAX_DISTANCE) { c = 0.; total_d=MAX_DISTANCE; break; } | ||
} | ||
|
||
float fog = 3.1; | ||
vec3 result = vec3( vec3(iColor.r, iColor.g, iColor.b) * (fog - total_d) / fog ); | ||
|
||
ray.z -= 5.+TIME*.5; | ||
float r = BinarySerpentsTexture3D(ray, 33.); | ||
|
||
fragColor = vec4(result*(step(r,.3)+r*.2+.1),1.0); | ||
} | ||
|
||
|
||
void main(void) { mainImage(gl_FragColor, gl_FragCoord.xy); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
/*{ | ||
"CREDIT" : "ComplexColorPlots by allemangD", | ||
"CATEGORIES" : [ | ||
"ci" | ||
], | ||
"DESCRIPTION": "https://www.shadertoy.com/view/lsycRW", | ||
"INPUTS": [ | ||
{ | ||
"NAME": "iChannel0", | ||
"TYPE" : "image" | ||
}, | ||
{ | ||
"NAME": "iZoom", | ||
"TYPE" : "float", | ||
"MIN" : 0.0, | ||
"MAX" : 1.0, | ||
"DEFAULT" : 1.0}, | ||
{"NAME" :"iMouse", | ||
"TYPE" : "point2D", | ||
"DEFAULT" : [0.0, 0.0], | ||
"MAX" : [640.0, 480.0], | ||
"MIN" : [0.0, 0.0]}, | ||
{ | ||
"NAME": "iColor", | ||
"TYPE" : "color", | ||
"DEFAULT" : [ | ||
0.7, | ||
0.5, | ||
0.0, | ||
1.0 | ||
]} | ||
], | ||
} | ||
*/ | ||
|
||
vec3 hsv2rgb(vec3 c) | ||
{ | ||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); | ||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); | ||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); | ||
} | ||
|
||
vec2 comp(in float x) { return vec2(x, 0.); } | ||
vec2 comp(in int x) { return vec2(float(x), 0.); } | ||
vec2 comp(in vec2 x) { return x; } | ||
|
||
vec2 cMul(in vec2 a, in vec2 b) | ||
{ | ||
return vec2(a.x*b.x - a.y*b.y, a.x*b.y + a.y*b.x); | ||
} | ||
vec2 cMul(in float a, in vec2 b) { return cMul(comp(a), comp(b)); } | ||
vec2 cMul(in int a, in vec2 b) { return cMul(comp(a), comp(b)); } | ||
vec2 cMul(in vec2 a, in float b) { return cMul(comp(a), comp(b)); } | ||
vec2 cMul(in vec2 a, in int b) { return cMul(comp(a), comp(b)); } | ||
vec2 cMul(in float a, in float b) { return cMul(comp(a), comp(b)); } | ||
|
||
vec2 cInv(in vec2 b) | ||
{ | ||
return vec2(b.x, -b.y)/length(b)/length(b); | ||
} | ||
vec2 cInv(in float a) { return cInv(comp(a)); } | ||
vec2 cInv(in int a) { return cInv(comp(a)); } | ||
|
||
vec2 cDiv(in vec2 a, in vec2 b) | ||
{ | ||
return cMul(a, cInv(b)); | ||
} | ||
vec2 cDiv(in float a, in vec2 b) { return cDiv(comp(a), comp(b)); } | ||
vec2 cDiv(in int a, in vec2 b) { return cDiv(comp(a), comp(b)); } | ||
vec2 cDiv(in vec2 a, in float b) { return cDiv(comp(a), comp(b)); } | ||
vec2 cDiv(in vec2 a, in int b) { return cDiv(comp(a), comp(b)); } | ||
vec2 cDiv(in float a, in float b) { return cDiv(comp(a), comp(b)); } | ||
|
||
vec2 cPow(in vec2 b1, in vec2 c2) | ||
{ | ||
float l, a, r, t, x, y; | ||
|
||
l = log(length(b1)); | ||
a = atan(b1.y, b1.x); | ||
|
||
r = exp(c2.x * l - c2.y * a); | ||
t = c2.x * a + c2.y * l; | ||
|
||
x = r * cos(t); | ||
y = r * sin(t); | ||
|
||
return vec2(x, y); | ||
} | ||
vec2 cPow(in float a, in vec2 b) { return cPow(comp(a), comp(b)); } | ||
vec2 cPow(in int a, in vec2 b) { return cPow(comp(a), comp(b)); } | ||
vec2 cPow(in vec2 a, in float b) { return cPow(comp(a), comp(b)); } | ||
vec2 cPow(in vec2 a, in int b) { return cPow(comp(a), comp(b)); } | ||
vec2 cPow(in float a, in float b) { return cPow(comp(a), comp(b)); } | ||
|
||
vec2 cExp(in vec2 a) { | ||
return exp(a.x) * vec2(cos(a.y), sin(a.y)); | ||
} | ||
vec2 cExp(in float a) { return cExp(comp(a)); } | ||
vec2 cExp(in int a) { return cExp(comp(a)); } | ||
|
||
vec2 cExpi(in vec2 a) { | ||
return exp(-a.y) * vec2(cos(a.x), sin(a.x)); | ||
} | ||
vec2 cExpi(in float a) { return cExpi(comp(a)); } | ||
vec2 cExpi(in int a) { return cExpi(comp(a)); } | ||
|
||
vec2 cLog(in vec2 a) { | ||
return vec2(log(length(a)), atan(a.y, a.x)); | ||
} | ||
vec2 cLog(in float a) { return cLog(comp(a)); } | ||
vec2 cLog(in int a) { return cLog(comp(a)); } | ||
|
||
vec2 cSin(in vec2 a) { | ||
return cDiv(cExpi(a)-cExpi(-a), vec2(0.,2.)); | ||
} | ||
vec2 cSin(in float a) { return cSin(comp(a)); } | ||
vec2 cSin(in int a) { return cSin(comp(a)); } | ||
|
||
vec2 cCos(in vec2 a) { | ||
return (cExpi(a)+cExpi(-a))/2.; | ||
} | ||
vec2 cCos(in float a) { return cCos(comp(a)); } | ||
vec2 cCos(in int a) { return cCos(comp(a)); } | ||
|
||
vec2 cCon(in vec2 a) { | ||
return a * vec2(1, -1); | ||
} | ||
vec2 cCon(in float a) { return comp(a); } | ||
vec2 cCon(in int a) { return comp(a); } | ||
|
||
vec2 f(in vec2 z) { | ||
vec2 u = cMul(vec2(3, 0), cExpi(TIME/4.)); | ||
vec2 v = cMul(vec2(1, 0), cExpi(TIME/2.)); | ||
vec2 w = cMul(vec2(8, 0), cExpi(-TIME)); | ||
|
||
vec2 a = cPow(z, 1) + u; | ||
vec2 b = cInv(cPow(z, 2) + v); | ||
vec2 c = cPow(z, 3) + w; | ||
|
||
return cMul(cMul(a, b), c); | ||
} | ||
void mainImage(out vec4 fragColor, in vec2 fragCoord) | ||
{ | ||
float SCALE = 8.0; | ||
|
||
// Normalized pixel coordinates (from 0 to 1) | ||
vec2 uv = fragCoord.xy/RENDERSIZE.xy - vec2(.5); | ||
uv.x *= RENDERSIZE.x/RENDERSIZE.y; | ||
uv *= SCALE; | ||
|
||
vec2 o = f(uv); | ||
float h = atan(o.y, o.x); | ||
vec3 col = hsv2rgb(vec3(h / 6.28, 1., 1.)); | ||
|
||
float sa, sb; | ||
float w = 0.05; | ||
|
||
sa = log(length(o)); | ||
sa = abs(sa - floor(sa)); | ||
col *= mix(.8, 1.0, sa); | ||
|
||
sb = atan(o.y, o.x); | ||
sb = (sb + 3.1415)/6.2832 * 8.0; | ||
sb = abs(sb - floor(sb)); | ||
|
||
if (sb < w || sb > 1. - w) | ||
col = mix(col, vec3(1), smoothstep(.025, .0, abs(fract(sb + .5 + w) - .5 - w))); | ||
|
||
// Output to screen | ||
fragColor = vec4(col,1.0); | ||
} | ||
void main(void) { mainImage(gl_FragColor, gl_FragCoord.xy); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*{ | ||
"CREDIT" : "NovaFractal by gleurop", | ||
"CATEGORIES" : [ | ||
"ci" | ||
], | ||
"DESCRIPTION": "https://www.shadertoy.com/view/Xsl3DM", | ||
"INPUTS": [ | ||
{ | ||
"NAME": "iChannel0", | ||
"TYPE" : "image" | ||
}, | ||
{ | ||
"NAME": "iZoom", | ||
"TYPE" : "float", | ||
"MIN" : 0.0, | ||
"MAX" : 1.0, | ||
"DEFAULT" : 1.0}, | ||
{"NAME" :"iMouse", | ||
"TYPE" : "point2D", | ||
"DEFAULT" : [0.0, 0.0], | ||
"MAX" : [640.0, 480.0], | ||
"MIN" : [0.0, 0.0]}, | ||
{ | ||
"NAME": "iColor", | ||
"TYPE" : "color", | ||
"DEFAULT" : [ | ||
0.7, | ||
0.5, | ||
0.0, | ||
1.0 | ||
]} | ||
], | ||
} | ||
*/ | ||
|
||
void mainImage( out vec4 fragColor, in vec2 fragCoord ) { | ||
vec2 p = fragCoord.xy / RENDERSIZE.xy * 2.0 - 1.0; | ||
p.x *= RENDERSIZE.x / RENDERSIZE.y; | ||
vec2 c = p; | ||
float iter = 0.0; | ||
vec4 color = vec4(0.0); | ||
for (int i = 0; i < 40; i++) { | ||
//vec4 g = texture2D(iChannel0, c); | ||
//color += g; | ||
float phi = atan(c.y, c.x) + TIME*0.01*iter; | ||
float r = dot(c,c); | ||
if (r < 16.0) { | ||
c.x = ((cos(2.0*phi))/r) + p.x; | ||
c.y = (-sin(2.0*phi)/r) + p.y; | ||
|
||
iter++; | ||
} | ||
} | ||
fragColor = vec4(color / 40.0 + max(0.75 - iter / 40.0, 0.0)); | ||
}void main(void) { mainImage(gl_FragColor, gl_FragCoord.xy); } |
Oops, something went wrong.