Files
shadertoy/shaders/voxel_descent.frag.glsl
Sergio Valor 44de2c7013 Add FPS counter, VSync toggle, shader metadata system, and multi-pass infrastructure
- FPS counter in window title (updates every 500ms)
- F4 key toggles VSync on/off
- Shader metadata: Name and Author from comments
- iChannel metadata parsing for multi-pass support
- Base structures: ShaderBuffer, ShaderPass
- FBO/texture management functions
- Updated all 11 shaders with Name/Author metadata

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 15:22:06 +01:00

53 lines
1.3 KiB
GLSL

// Name: Voxel Descent
// Author: Jaenman
// URL: https://www.shadertoy.com/view/Wc3cRr
#version 330 core
precision highp float;
out vec4 FragColor;
in vec2 vUV;
uniform vec2 iResolution;
uniform float iTime;
/*================================
= Voxel Descent =
= Author: Jaenam =
================================*/
// Date: 2025-11-14
// License: Creative Commons (CC BY-NC-SA 4.0)
// Thanks to @diatribes for the plasma :D
void mainImage( out vec4 O, vec2 I )
{
float i=0.,d=0.,s=0.,t = iTime*.8;
vec3 p,q,z,k;
vec4 c = vec4(1,2,3,1);
mat2 R = mat2(cos(t/3.+vec4(0,33,11,0)));
// Initialize O before loop (was O*=i where i=0, reading uninitialized out parameter)
O = vec4(0.0);
for(; i++<1e2;O+=sin(.5*c+i*.2)/s)
z = normalize(vec3(I+I, 0) - vec3(iResolution.xy, iResolution.y)),
z.xy*=R,
p = d*z+sqrt(i)*i,
k=z/=length(z.xy),
z.z-=t, p.z+=t,
d+=s=.012+.07*abs(mix(cos(dot(sin(floor(p/8.)).yzx,cos(ceil(z/.1)))),length(k),.2)-i/1e2);
O*= exp(-.02*d*d);
// Add epsilon protection to prevent division overflow
O=tanh(O*O*mix(length(abs(c/max(dot(cos(t+p),vec3(6)), 0.001))),length(k),.5)/6e4);
}
void main() {
vec2 fragCoordPixels = vUV * iResolution;
vec4 outColor;
mainImage(outColor, fragCoordPixels);
FragColor = outColor;
}