ScreenLockDetector/shaders/background.frag

39 lines
985 B
GLSL

#version 450
layout(location = 0) in vec4 fragColor;
layout(location = 1) in vec2 fragTexCoord;
layout(location = 2) in vec2 fragPosition;
layout(location = 0) out vec4 outColor;
layout(binding = 0) uniform UniformBufferObject {
float time;
vec2 resolution;
float rotation;
float wavePhase;
} ubo;
void main() {
// Normalize position to 0-1 range
vec2 uv = (fragPosition + 1.0) * 0.5;
// Create dynamic gradient based on time
float t = ubo.time / 360.0;
// Calculate color components with sine waves
float r = 0.39 + 0.20 * sin(t * 6.28318);
float g = 0.59 + 0.20 * sin(t * 6.28318 + 1.047);
float b = 0.78 + 0.22 * sin(t * 6.28318 + 2.094);
vec3 color1 = vec3(r, g, b);
vec3 color2 = vec3(0.12, 0.12, 0.24);
// Linear gradient from top-left to bottom-right
float gradient = uv.x * 0.5 + uv.y * 0.5;
// Mix colors
vec3 finalColor = mix(color1, color2, gradient);
outColor = vec4(finalColor, 1.0);
}