scenefx icon indicating copy to clipboard operation
scenefx copied to clipboard

Blur strength

Open ErikReider opened this issue 9 months ago • 6 comments

Adds support for blur strength.

https://github.com/user-attachments/assets/2038bd47-2504-49b5-af66-66b626997010

Here's what it looks like with just regular alpha:

image

Tested with SwayFX main branch using:

for_window [app_id="kitty" title="opacity test"] floating enable; resize set 800 400
exec kitty -T "opacity test" -o "background_opacity 0.0" -e $SHELL -c './opacity_script.sh; read'

script to run in nested kitty:

set_opacity() {
    opacity=$(perl -e "print ((100 - $i) / 100)")
    swaymsg "[app_id=\"kitty\" title=\"opacity test\"] opacity $opacity"
    echo "Opacity: $opacity"
    sleep 0.1
}

while true; do
    for ((i = 0; i < 100; i++)); do
        set_opacity "$i"
    done
    for ((i = 100; i >= 0; i--)); do
        set_opacity "$i"
    done
done

Tested in SwayFX:

  • [x] Floating toplevels (non-optimized blur)
  • [x] Tiled toplevels and “x-ray” floating toplevels (optimized blur)
  • [x] Scene rect color alpha adjusts blur alpha

ErikReider avatar Feb 18 '25 15:02 ErikReider

Updated the desc with a video of the implementation. There are some minor artifacts in the top right section of the window blur, where there are thin lines. This is due to the lowering of the num_passes and doubling of the blur radius (which displays more artifacts).

Not sure if there's anything that can be done here, except maybe mixing a max opacity blur with the lower opacity blur? Or maybe mixing the higher num_passes version with the lower one?

ErikReider avatar Feb 18 '25 20:02 ErikReider

Updated the desc with a video of the implementation. There are some minor artifacts in the top right section of the window blur, where there are thin lines. This is due to the lowering of the num_passes and doubling of the blur radius (which displays more artifacts).

Not sure if there's anything that can be done here, except maybe mixing a max opacity blur with the lower opacity blur? Or maybe mixing the higher num_passes version with the lower one?

Is this still present? I didn't notice it from the video

WillPower3309 avatar Feb 21 '25 22:02 WillPower3309

Updated the desc with a video of the implementation. There are some minor artifacts in the top right section of the window blur, where there are thin lines. This is due to the lowering of the num_passes and doubling of the blur radius (which displays more artifacts). Not sure if there's anything that can be done here, except maybe mixing a max opacity blur with the lower opacity blur? Or maybe mixing the higher num_passes version with the lower one?

Is this still present? I didn't notice it from the video

Not anymore! :D

ErikReider avatar Feb 21 '25 22:02 ErikReider

Converting to draft again, we should wait with this until it can be tested with SwayFX animations

ErikReider avatar Feb 22 '25 10:02 ErikReider

I added blur_strength and blur_alpha for finer tuning. Makes it easier for SwayFX to decide if it wants alpha or strength adjustments when fading in/out :D

ErikReider avatar Feb 26 '25 16:02 ErikReider

image

I'm off topic but - is that an inset border? Looks lovely, is it a SwayFX thing?

cccslater avatar Apr 05 '25 21:04 cccslater

Getting back to this, hoping to merge it soon. Can you remind me why we add a optimized_no_blur_buffer? not sure I follow why it's needed - did this fix a bug?

WillPower3309 avatar Oct 17 '25 04:10 WillPower3309

Getting back to this, hoping to merge it soon. Can you remind me why we add a optimized_no_blur_buffer? not sure I follow why it's needed - did this fix a bug?

It's for the edge case for blurring with optimizations (xray enabled) while setting a lower alpha.

When we adjust the alpha, we instead adjust/lower the blur strength for that scene_node, so we can't use the already blurred background in the optimized_blur framebuffer

ErikReider avatar Oct 17 '25 16:10 ErikReider