Add noise to blur shaders#1518
Merged
Merged
Conversation
Owner
|
wow, thanks. this is a very interesting effect. i haven't read your code yet, just wondering, does this have to be tied with blur? can this be a separate effect by itself? seems like it works a lot better with box blur than with dual-kawase? |
Contributor
Author
yshui
reviewed
May 31, 2026
A base struct is defined for arguments common to all blur methods. The create_blur_context interface method is changed to accept a pointer to the base type instead of a void pointer. It can't be a pointer-to-const because generate_dual_kawase_params may modify it. Changelog: Internal: Breaking changes to backend API: a `base` field of type `struct blur_args` is added to each blur args struct; the interface method `create_blur_context` now accepts `struct blur_args *` instead of `void *`.
Blur noise options are currently unused. Changelog: NewFeature: `--blur-noise-radius` and `--blur-noise-scale` global options are added for noise configuration. Changelog: NewFeature: `noise-radius` and `noise-scale` options are added to the `blur` configuration section.
ctx is not used after it is set to NULL.
The extension string is always empty when building the kernel blur shader.
This change is needed to apply noise with kernel blur, which requires normalized texture coordinates in the final pass. It is no longer necessary to track the presence of the pixel_norm uniform, since all passes now use it.
Two new uniforms are defined for noise configuration. They are currently unused. This also corrects an off-by-one error in NUMBER_OF_UNIFORMS.
If configured, noise displaces texture coordinates when sampling a blurred window background with any blur method. This can be used to create a rippled (low scale) or frosted glass (high scale) effect. The radius of the noise limits the displacement amount. This allows only features within the radius to contribute to the distorted background. Noise is only implemented for the OpenGL backend, and is only enabled when a blur method is configured. Noise is not applied to shadows. The Simplex noise implementation uses MIT-licensed shader code from Ashima Arts. See https://github.com/stegu/webgl-noise Changelog: NewFeature: Blur noise is implemented for the OpenGL backend.
Owner
|
force pushed to fix coding style, otherwise LGTM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This patch series adds noise to blur shaders that can be used to create a frosted glass effect.
Noise can be configured using the
--blur-noise-radiusand--blur-noise-scaleoptions, or in theblursection of the configuration file:Closes #1015
Comparison
dual_kawase blur (strength=16, noise-radius=80, noise-scale=0.5):
3x3 box blur with various noise-radius/noise-scale values: