mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-30 11:21:32 +11:00
82 lines
2.4 KiB
Plaintext
82 lines
2.4 KiB
Plaintext
|
#version 450
|
||
|
// Galaxy of Universes - 2014-06-19
|
||
|
// https://www.shadertoy.com/view/MdXSzS
|
||
|
// Big Bang? *pfft* It's just a small explosion somewhere in a rotating Galaxy of Universes!
|
||
|
// Thanks to Kali for his fractal formula.
|
||
|
|
||
|
// https://www.shadertoy.com/view/MdXSzS
|
||
|
// The Big Bang - just a small explosion somewhere in a massive Galaxy of Universes.
|
||
|
// Outside of this there's a massive galaxy of 'Galaxy of Universes'... etc etc. :D
|
||
|
|
||
|
// To fake a perspective it takes advantage of the screen being wider than it is tall.
|
||
|
|
||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||
|
{
|
||
|
mat4 MVP;
|
||
|
vec4 OutputSize;
|
||
|
vec4 OriginalSize;
|
||
|
vec4 SourceSize;
|
||
|
uint FrameCount;
|
||
|
} global;
|
||
|
|
||
|
#pragma stage vertex
|
||
|
layout(location = 0) in vec4 Position;
|
||
|
layout(location = 1) in vec2 TexCoord;
|
||
|
layout(location = 0) out vec2 vTexCoord;
|
||
|
const vec2 madd = vec2(0.5, 0.5);
|
||
|
void main()
|
||
|
{
|
||
|
gl_Position = global.MVP * Position;
|
||
|
vTexCoord = gl_Position.xy;
|
||
|
}
|
||
|
|
||
|
#pragma stage fragment
|
||
|
layout(location = 0) in vec2 vTexCoord;
|
||
|
layout(location = 0) out vec4 FragColor;
|
||
|
float iGlobalTime = float(global.FrameCount)*0.025;
|
||
|
vec2 iResolution = global.OutputSize.xy;
|
||
|
|
||
|
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||
|
{
|
||
|
vec2 uv = (fragCoord.xy / iResolution.xy) - .5;
|
||
|
float t = iGlobalTime * .1 + ((.25 + .05 * sin(iGlobalTime * .1))/(length(uv.xy) + .07)) * 2.2;
|
||
|
float si = sin(t);
|
||
|
float co = cos(t);
|
||
|
mat2 ma = mat2(co, si, -si, co);
|
||
|
|
||
|
float v1, v2, v3;
|
||
|
v1 = v2 = v3 = 0.0;
|
||
|
|
||
|
float s = 0.0;
|
||
|
for (int i = 0; i < 90; i++)
|
||
|
{
|
||
|
vec3 p = s * vec3(uv, 0.0);
|
||
|
p.xy *= ma;
|
||
|
p += vec3(.22, .3, s - 1.5 - sin(iGlobalTime * .13) * .1);
|
||
|
for (int i = 0; i < 8; i++) p = abs(p) / dot(p,p) - 0.659;
|
||
|
v1 += dot(p,p) * .0015 * (1.8 + sin(length(uv.xy * 13.0) + .5 - iGlobalTime * .2));
|
||
|
v2 += dot(p,p) * .0013 * (1.5 + sin(length(uv.xy * 14.5) + 1.2 - iGlobalTime * .3));
|
||
|
v3 += length(p.xy*10.) * .0003;
|
||
|
s += .035;
|
||
|
}
|
||
|
|
||
|
float len = length(uv);
|
||
|
v1 *= smoothstep(.7, .0, len);
|
||
|
v2 *= smoothstep(.5, .0, len);
|
||
|
v3 *= smoothstep(.9, .0, len);
|
||
|
|
||
|
vec3 col = vec3( v3 * (1.5 + sin(iGlobalTime * .2) * .4),
|
||
|
(v1 + v3) * .3,
|
||
|
v2) + smoothstep(0.2, .0, len) * .85 + smoothstep(.0, .6, v3) * .3;
|
||
|
|
||
|
fragColor=vec4(min(pow(abs(col), vec3(1.2)), 1.0), 1.0);
|
||
|
}
|
||
|
|
||
|
void main(void)
|
||
|
{
|
||
|
//just some shit to wrap shadertoy's stuff
|
||
|
vec2 FragmentCoord = vTexCoord.xy*global.OutputSize.xy;
|
||
|
FragmentCoord.y = -FragmentCoord.y;
|
||
|
mainImage(FragColor,FragmentCoord);
|
||
|
}
|