mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-05 16:00:06 +01:00
41 lines
986 B
GLSL
41 lines
986 B
GLSL
// Tenjix
|
|
|
|
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
#define PI 3.1415926535897932384626433832795
|
|
|
|
uniform float u_time;
|
|
uniform vec2 u_resolution;
|
|
|
|
const float position = 0.0;
|
|
const float scale = 8.0;
|
|
const float intensity = 1.0;
|
|
|
|
float band(vec2 pos, float amplitude, float frequency) {
|
|
float wave = scale * amplitude * sin(2.0 * PI * frequency * pos.x + u_time) / 6.05;
|
|
float light = clamp(amplitude * frequency * 0.002, 0.001 + 0.001 / scale, 5.0) * scale / abs(wave - pos.y);
|
|
return light;
|
|
}
|
|
|
|
void main( void ) {
|
|
|
|
vec3 color = vec3(0., 0.5, 1.0);
|
|
color = color == vec3(0.0)? vec3(0.10, 0.5, 10.0) : color;
|
|
vec2 pos = (gl_FragCoord.xy / u_resolution.xy);
|
|
pos.y += - 0.5 - position;
|
|
|
|
float spectrum = 0.0;
|
|
|
|
spectrum += band(pos, 0.1, 10.0);
|
|
spectrum += band(pos, 0.2, 8.0);
|
|
spectrum += band(pos, 0.10, 5.0);
|
|
spectrum += band(pos, 0.09, 3.0);
|
|
spectrum += band(pos, 0.8, 2.0);
|
|
spectrum += band(pos, 1.0, 1.0);
|
|
|
|
gl_FragColor = vec4(color * spectrum, spectrum);
|
|
|
|
}
|