diff --git a/docs/changelog.md b/docs/changelog.md
index 8723daa..3b8fc44 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -13,6 +13,7 @@ SPDX-License-Identifier: CC-BY-4.0
- Two convenience buttons have been added to the preferences dialog. One allows you to select all effects, the other one allows you to deselect all effects.
- A new main menu entry has been added which allows you to open the effect-profile directory. This is useful if you want to back up or share your profiles with others.
+- The Wisps effect now supports colorful wisps. You can now specify three colors for the effect. These colors make up a gradient which is used to color the wisps.
#### Bug Fixes
diff --git a/kwin/wisps/config.ui b/kwin/wisps/config.ui
index 87c9a7f..47d07c7 100755
--- a/kwin/wisps/config.ui
+++ b/kwin/wisps/config.ui
@@ -71,7 +71,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kwin/wisps/main.xml b/kwin/wisps/main.xml
index 870f169..ea6cd36 100755
--- a/kwin/wisps/main.xml
+++ b/kwin/wisps/main.xml
@@ -5,8 +5,7 @@ SPDX-FileCopyrightText: Simon Schneegans
SPDX-License-Identifier: GPL-3.0-or-later
-->
-
+
@@ -15,8 +14,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
1
-
+ #ff64c8
+
+ #6464ff
+
+
+ #64c8ff
+
\ No newline at end of file
diff --git a/kwin/wisps/onSettingsChanged.js b/kwin/wisps/onSettingsChanged.js
index b92ff16..0e789cc 100644
--- a/kwin/wisps/onSettingsChanged.js
+++ b/kwin/wisps/onSettingsChanged.js
@@ -7,4 +7,6 @@
effect.setUniform(this.shader, 'uDuration', this.duration * 0.001);
effect.setUniform(this.shader, 'uScale', effect.readConfig('Scale', 1.0));
-effect.setUniform(this.shader, 'uColor', this.readRGBConfig('Color'));
+effect.setUniform(this.shader, 'uColor1', this.readRGBConfig('Color1'));
+effect.setUniform(this.shader, 'uColor2', this.readRGBConfig('Color2'));
+effect.setUniform(this.shader, 'uColor3', this.readRGBConfig('Color3'));
diff --git a/resources/shaders/common.glsl b/resources/shaders/common.glsl
index 988dbf3..cacdf4c 100644
--- a/resources/shaders/common.glsl
+++ b/resources/shaders/common.glsl
@@ -64,6 +64,15 @@ vec4 getInputColor(vec2 coords) {
}
void setOutputColor(vec4 outColor) {
+
+ // If a uniform is not used, it will be optimized away. This condition is always
+ // false, but it will prevent the compiler from optimizing away the uniforms uForOpening
+ // and uIsFullscreen. On KWin, we need to do this as we do not have a way to check if a
+ // uniform is used in the shader.
+ if (outColor.a > 10e42 && uForOpening && uIsFullscreen) {
+ outColor = vec4(0.0);
+ }
+
fragColor = vec4(outColor.rgb * outColor.a, outColor.a);
}
@@ -90,6 +99,14 @@ vec4 getInputColor(vec2 coords) {
}
void setOutputColor(vec4 outColor) {
+ // If a uniform is not used, it will be optimized away. This condition is always
+ // false, but it will prevent the compiler from optimizing away the uniforms uForOpening
+ // and uIsFullscreen. On KWin, we need to do this as we do not have a way to check if a
+ // uniform is used in the shader.
+ if (outColor.a > 10e42 && uForOpening && uIsFullscreen) {
+ outColor = vec4(0.0);
+ }
+
gl_FragColor = vec4(outColor.rgb * outColor.a, outColor.a);
}
diff --git a/resources/shaders/wisps.frag b/resources/shaders/wisps.frag
index e7aaf85..9322bd7 100644
--- a/resources/shaders/wisps.frag
+++ b/resources/shaders/wisps.frag
@@ -15,8 +15,10 @@
// The content from common.glsl is automatically prepended to each shader effect.
uniform vec2 uSeed;
-uniform vec3 uColor;
uniform float uScale;
+uniform vec3 uColor1;
+uniform vec3 uColor2;
+uniform vec3 uColor3;
const float WISPS_RADIUS = 20.0;
const float WISPS_SPEED = 10.0;
@@ -28,7 +30,7 @@ const float SCALING = 0.9;
// Returns a grid of randomly moving points. Each grid cell contains one point which
// moves on an ellipse.
-float getWisps(vec2 texCoords, float gridSize, vec2 seed) {
+vec4 getWisps(vec2 texCoords, float gridSize, vec2 seed) {
// Shift coordinates by a random offset and make sure the have a 1:1 aspect ratio.
vec2 coords = (texCoords + hash22(seed)) * uSize;
@@ -56,13 +58,16 @@ float getWisps(vec2 texCoords, float gridSize, vec2 seed) {
cellUV += offset;
+ vec3 color = tritone(hash12(cellID * seed * 1.256), uColor1, uColor2, uColor3);
+
// Use distance to center of shifted / rotated UV coordinates to draw a glaring point.
float dist = length(cellUV - 0.5) * gridSize / radius;
if (dist < 1.0) {
- return min(5.0, 0.01 / pow(dist, 2.0));
+ float alpha = min(5.0, 0.01 / pow(dist, 2.0));
+ return vec4(color * alpha, alpha);
}
- return 0.0;
+ return vec4(0.0);
}
void main() {
@@ -78,9 +83,9 @@ void main() {
// Compute several layers of moving wisps.
vec2 uv = (iTexCoord.st - 0.5) / mix(1.0, 0.5, progress) + 0.5;
uv /= uScale;
- float wisps = 0.0;
+ vec4 wisps = vec4(0.0);
for (float i = 0.0; i < WISPS_LAYERS; ++i) {
- wisps += getWisps(uv * 0.3, WISPS_SPACING, uSeed * (i + 1.0));
+ wisps = alphaOver(wisps, getWisps(uv * 0.3, WISPS_SPACING, uSeed * (i + 1.0)));
}
// Compute shrinking edge mask.
@@ -100,8 +105,8 @@ void main() {
oColor.a *= windowMask * mask;
// Add the wisps.
- vec4 wispColor = wisps * vec4(uColor, min(wispsIn, 1.0 - wispsOut) * mask);
- oColor = alphaOver(oColor, wispColor);
+ wisps.a *= min(wispsIn, 1.0 - wispsOut) * mask;
+ oColor = alphaOver(oColor, wisps);
// These are pretty useful for understanding how this works.
// oColor = vec4(vec3(windowMask), 1.0);
diff --git a/resources/ui/adw/wisps.ui b/resources/ui/adw/wisps.ui
index 788e668..44b74f2 100644
--- a/resources/ui/adw/wisps.ui
+++ b/resources/ui/adw/wisps.ui
@@ -78,17 +78,33 @@ SPDX-License-Identifier: GPL-3.0-or-later