Wallpaper: shaders improvements with more parameters and new Stripes shader

This commit is contained in:
LemmyCook 2025-08-30 10:43:33 -04:00
parent d36bcb1d4d
commit 477d38d928
12 changed files with 260 additions and 66 deletions

View file

@ -1,3 +1,4 @@
// ===== wp_disc.frag =====
#version 450
layout(location = 0) in vec2 qt_TexCoord0;
@ -12,7 +13,7 @@ layout(std140, binding = 0) uniform buf {
float progress; // Transition progress (0.0 to 1.0)
float centerX; // X coordinate of disc center (0.0 to 1.0)
float centerY; // Y coordinate of disc center (0.0 to 1.0)
float smoothness; // Edge smoothness (0.01 to 0.5, default 0.05)
float smoothness; // Edge smoothness (0.0 to 1.0, 0=sharp, 1=very smooth)
float aspectRatio; // Width / Height of the screen
} ubuf;
@ -21,6 +22,10 @@ void main() {
vec4 color1 = texture(source1, uv); // Current (old) wallpaper
vec4 color2 = texture(source2, uv); // Next (new) wallpaper
// Map smoothness from 0.0-1.0 to 0.001-0.5 range
// Using a non-linear mapping for better control
float mappedSmoothness = mix(0.001, 0.5, ubuf.smoothness * ubuf.smoothness);
// Adjust UV coordinates to compensate for aspect ratio
// This makes distances circular instead of elliptical
vec2 adjustedUV = vec2(uv.x * ubuf.aspectRatio, uv.y);
@ -39,7 +44,7 @@ void main() {
// Scale progress to cover the maximum distance
// Add extra range for smoothness to ensure complete coverage
// Adjust smoothness for aspect ratio to maintain consistent visual appearance
float adjustedSmoothness = ubuf.smoothness * max(1.0, ubuf.aspectRatio);
float adjustedSmoothness = mappedSmoothness * max(1.0, ubuf.aspectRatio);
float radius = ubuf.progress * (maxDist + adjustedSmoothness);
// Use smoothstep for a smooth edge transition
@ -49,4 +54,4 @@ void main() {
fragColor = mix(color2, color1, factor);
fragColor *= ubuf.qt_Opacity;
}
}