afegits altres shaders
pantalla completa tecla esc readme.md
This commit is contained in:
42
shaders/creation.frac.glsl
Normal file
42
shaders/creation.frac.glsl
Normal file
@@ -0,0 +1,42 @@
|
||||
#version 330 core
|
||||
precision highp float;
|
||||
|
||||
out vec4 FragColor;
|
||||
in vec2 vUV;
|
||||
uniform vec2 iResolution;
|
||||
uniform float iTime;
|
||||
|
||||
#define t iTime
|
||||
#define r iResolution.xy
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
||||
vec3 c = vec3(0.0);
|
||||
float l;
|
||||
float z = t;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
vec2 uv, p = fragCoord.xy / r;
|
||||
uv = p;
|
||||
p -= 0.5;
|
||||
p.x *= r.x / r.y;
|
||||
z += 0.07;
|
||||
l = length(p);
|
||||
// evitar división por cero
|
||||
float invl = (l > 0.0) ? (1.0 / l) : 0.0;
|
||||
uv += p * invl * (sin(z) + 1.0) * abs(sin(l * 9.0 - z - z));
|
||||
vec2 m = mod(uv, 1.0) - 0.5;
|
||||
float denom = length(m);
|
||||
// evitar división por cero en el denominador
|
||||
if (denom < 1e-6) denom = 1e-6;
|
||||
c[i] = 0.01 / denom;
|
||||
}
|
||||
// si l es cero, usar 1.0 para evitar NaN
|
||||
float L = (l > 0.0) ? l : 1.0;
|
||||
fragColor = vec4(c / L, t);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
65
shaders/fractal_pyramid.frag.glsl
Normal file
65
shaders/fractal_pyramid.frag.glsl
Normal file
@@ -0,0 +1,65 @@
|
||||
#version 330 core
|
||||
precision highp float;
|
||||
|
||||
out vec4 FragColor;
|
||||
in vec2 vUV;
|
||||
uniform vec2 iResolution;
|
||||
uniform float iTime;
|
||||
|
||||
vec3 palette(float d){
|
||||
return mix(vec3(0.2,0.7,0.9), vec3(1.0,0.0,1.0), d);
|
||||
}
|
||||
|
||||
vec2 rotate(vec2 p, float a){
|
||||
float c = cos(a);
|
||||
float s = sin(a);
|
||||
return p * mat2(c, s, -s, c);
|
||||
}
|
||||
|
||||
float mapScene(vec3 p){
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
float t = iTime * 0.2;
|
||||
p.xz = rotate(p.xz, t);
|
||||
p.xy = rotate(p.xy, t * 1.89);
|
||||
p.xz = abs(p.xz);
|
||||
p.xz -= 0.5;
|
||||
}
|
||||
return dot(sign(p), p) / 5.0;
|
||||
}
|
||||
|
||||
vec4 rm(vec3 ro, vec3 rd){
|
||||
float t = 0.0;
|
||||
vec3 col = vec3(0.0);
|
||||
float d = 1.0;
|
||||
for (int i = 0; i < 64; ++i){
|
||||
vec3 p = ro + rd * t;
|
||||
d = mapScene(p) * 0.5;
|
||||
if (d < 0.02) break;
|
||||
if (d > 100.0) break;
|
||||
col += palette(length(p) * 0.1) / (400.0 * d);
|
||||
t += d;
|
||||
}
|
||||
return vec4(col, 1.0 / (d * 100.0));
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord){
|
||||
vec2 uv = (fragCoord - (iResolution.xy * 0.5)) / iResolution.x;
|
||||
vec3 ro = vec3(0.0, 0.0, -50.0);
|
||||
ro.xz = rotate(ro.xz, iTime);
|
||||
vec3 cf = normalize(-ro);
|
||||
vec3 cs = normalize(cross(cf, vec3(0.0, 1.0, 0.0)));
|
||||
vec3 cu = normalize(cross(cf, cs));
|
||||
|
||||
vec3 uuv = ro + cf * 3.0 + uv.x * cs + uv.y * cu;
|
||||
vec3 rd = normalize(uuv - ro);
|
||||
|
||||
vec4 col = rm(ro, rd);
|
||||
fragColor = col;
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
47
shaders/kishimisu.frag.glsl
Normal file
47
shaders/kishimisu.frag.glsl
Normal file
@@ -0,0 +1,47 @@
|
||||
#version 330 core
|
||||
precision highp float;
|
||||
|
||||
out vec4 FragColor;
|
||||
in vec2 vUV;
|
||||
uniform vec2 iResolution;
|
||||
uniform float iTime;
|
||||
|
||||
vec3 palette( float t) {
|
||||
vec3 a = vec3(0.5, 0.5, 0.5);
|
||||
vec3 b = vec3(0.5, 0.5, 0.5);
|
||||
vec3 c = vec3(1.0, 1.0, 1.0);
|
||||
vec3 d = vec3(0.263, 0.416, 0.557);
|
||||
return a + b * cos( 6.28318 * (c * t * d) );
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
|
||||
vec2 uv0 = uv;
|
||||
vec3 finalColor = vec3(0.0);
|
||||
|
||||
for (float i = 0.0; i < 4.0; i++) {
|
||||
uv = fract(uv * 1.5) - 0.5;
|
||||
|
||||
float d = length(uv) * exp(-length(uv0));
|
||||
|
||||
vec3 col = palette(length(uv0) + i * 0.4 + iTime * 0.4);
|
||||
|
||||
d = sin(d * 8.0 + iTime) / 8.0;
|
||||
|
||||
d = abs(d);
|
||||
|
||||
d = pow(0.01 / d, 1.2);
|
||||
|
||||
finalColor += col * d;
|
||||
}
|
||||
|
||||
fragColor = vec4(finalColor, 1.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
104
shaders/octograms.frag.glsl
Normal file
104
shaders/octograms.frag.glsl
Normal file
@@ -0,0 +1,104 @@
|
||||
#version 330 core
|
||||
precision highp float;
|
||||
|
||||
out vec4 FragColor;
|
||||
in vec2 vUV;
|
||||
uniform vec2 iResolution;
|
||||
uniform float iTime;
|
||||
|
||||
float gTime = 0.0;
|
||||
const float REPEAT = 5.0;
|
||||
|
||||
// rotación 2D
|
||||
mat2 rot(float a) {
|
||||
float c = cos(a), s = sin(a);
|
||||
return mat2(c, s, -s, c);
|
||||
}
|
||||
|
||||
float sdBox(vec3 p, vec3 b) {
|
||||
vec3 q = abs(p) - b;
|
||||
return length(max(q, vec3(0.0))) + min(max(q.x, max(q.y, q.z)), 0.0);
|
||||
}
|
||||
|
||||
float boxGeom(vec3 pos, float scale) {
|
||||
pos *= scale;
|
||||
float base = sdBox(pos, vec3(.4, .4, .1)) / 1.5;
|
||||
pos.xy *= 5.0;
|
||||
pos.y -= 3.5;
|
||||
pos.xy *= rot(.75);
|
||||
float result = -base;
|
||||
return result;
|
||||
}
|
||||
|
||||
float box_set(vec3 pos, float iTimeLocal) {
|
||||
vec3 pos_origin = pos;
|
||||
pos = pos_origin;
|
||||
pos.y += sin(gTime * 0.4) * 2.5;
|
||||
pos.xy *= rot(.8);
|
||||
float box1 = boxGeom(pos, 2.0 - abs(sin(gTime * 0.4)) * 1.5);
|
||||
|
||||
pos = pos_origin;
|
||||
pos.y -= sin(gTime * 0.4) * 2.5;
|
||||
pos.xy *= rot(.8);
|
||||
float box2 = boxGeom(pos, 2.0 - abs(sin(gTime * 0.4)) * 1.5);
|
||||
|
||||
pos = pos_origin;
|
||||
pos.x += sin(gTime * 0.4) * 2.5;
|
||||
pos.xy *= rot(.8);
|
||||
float box3 = boxGeom(pos, 2.0 - abs(sin(gTime * 0.4)) * 1.5);
|
||||
|
||||
pos = pos_origin;
|
||||
pos.x -= sin(gTime * 0.4) * 2.5;
|
||||
pos.xy *= rot(.8);
|
||||
float box4 = boxGeom(pos, 2.0 - abs(sin(gTime * 0.4)) * 1.5);
|
||||
|
||||
pos = pos_origin;
|
||||
pos.xy *= rot(.8);
|
||||
float box5 = boxGeom(pos, .5) * 6.0;
|
||||
|
||||
pos = pos_origin;
|
||||
float box6 = boxGeom(pos, .5) * 6.0;
|
||||
|
||||
float result = max(max(max(max(max(box1, box2), box3), box4), box5), box6);
|
||||
return result;
|
||||
}
|
||||
|
||||
float mapScene(vec3 pos, float iTimeLocal) {
|
||||
return box_set(pos, iTimeLocal);
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
||||
vec2 p = (fragCoord.xy * 2.0 - iResolution.xy) / min(iResolution.x, iResolution.y);
|
||||
vec3 ro = vec3(0.0, -0.2, iTime * 4.0);
|
||||
vec3 ray = normalize(vec3(p, 1.5));
|
||||
ray.xy = ray.xy * rot(sin(iTime * .03) * 5.0);
|
||||
ray.yz = ray.yz * rot(sin(iTime * .05) * .2);
|
||||
float t = 0.1;
|
||||
vec3 col = vec3(0.0);
|
||||
float ac = 0.0;
|
||||
|
||||
for (int i = 0; i < 99; i++) {
|
||||
vec3 pos = ro + ray * t;
|
||||
pos = mod(pos - 2.0, 4.0) - 2.0;
|
||||
gTime = iTime - float(i) * 0.01;
|
||||
|
||||
float d = mapScene(pos, iTime);
|
||||
|
||||
d = max(abs(d), 0.01);
|
||||
ac += exp(-d * 23.0);
|
||||
|
||||
t += d * 0.55;
|
||||
}
|
||||
|
||||
col = vec3(ac * 0.02);
|
||||
col += vec3(0.0, 0.2 * abs(sin(iTime)), 0.5 + sin(iTime) * 0.2);
|
||||
|
||||
fragColor = vec4(col, 1.0 - t * (0.02 + 0.02 * sin(iTime)));
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
32
shaders/test.frag.glsl
Normal file
32
shaders/test.frag.glsl
Normal file
@@ -0,0 +1,32 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
in vec2 vUV;
|
||||
uniform vec2 iResolution;
|
||||
uniform float iTime;
|
||||
|
||||
vec3 palette( float t) {
|
||||
vec3 a = vec3(1.0, 0.5, 0.5);
|
||||
vec3 b = vec3(1.0, 0.5, 0.5);
|
||||
vec3 c = vec3(1.0, 1.0, 1.0);
|
||||
vec3 d = vec3(0.263, 0.416, 0.557);
|
||||
return a + b * cos( 6.28318 * (c * t * d) );
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
|
||||
float d = length(uv);
|
||||
vec3 col = palette(d);
|
||||
d = sin(d * 8.0 + iTime) / 8.0;
|
||||
d = abs(d);
|
||||
d = 0.02 / d;
|
||||
col *= d;
|
||||
fragColor = vec4(col, 1.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 fragCoordPixels = vUV * iResolution;
|
||||
vec4 outColor;
|
||||
mainImage(outColor, fragCoordPixels);
|
||||
FragColor = outColor;
|
||||
}
|
||||
Reference in New Issue
Block a user